From 8e7801eeca7deeb5c83cfcb0ac2127d7009e5341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E4=BB=A5=E8=87=A3?= Date: Fri, 23 Aug 2024 11:35:25 +0800 Subject: [PATCH] feat: update api --- lark_oapi/api/__init__.py | 72 +++--- .../api/compensation/v1/model/__init__.py | 9 + .../compensation/v1/model/social_archive.py | 37 +++ .../v1/model/social_archive_adjust_record.py | 43 ++++ .../v1/model/social_archive_detail.py | 110 +++++++++ .../v1/model/social_archive_item.py | 75 ++++++ .../compensation/v1/model/social_insurance.py | 55 +++++ .../api/compensation/v1/model/social_plan.py | 81 +++++++ .../v1/model/social_plan_item_detail.py | 63 +++++ .../v1/model/social_plan_item_setting.py | 60 +++++ .../v1/model/social_plan_scope.py | 37 +++ lark_oapi/api/corehr/v1/model/__init__.py | 2 + .../v1/model/calendar_date_by_date_filter.py | 66 ++++++ .../v1/model/p2_corehr_job_data_changed_v1.py | 2 + .../api/corehr/v1/model/wk_calendar_date.py | 48 ++++ lark_oapi/api/corehr/v2/model/__init__.py | 5 + .../api/corehr/v2/model/department_tree.py | 42 ++++ lark_oapi/api/corehr/v2/model/offer_info.py | 6 + .../api/corehr/v2/model/offer_info_update.py | 6 + .../v2/model/pre_hire_employment_info.py | 6 + .../corehr/v2/model/reorganization_info.py | 12 - .../model/search_job_change_request_body.py | 6 + .../api/corehr/v2/model/signature_file.py | 6 + .../v2/model/tree_department_request.py | 52 ++++ .../v2/model/tree_department_request_body.py | 42 ++++ .../v2/model/tree_department_response.py | 17 ++ .../v2/model/tree_department_response_body.py | 43 ++++ .../api/corehr/v2/resource/department.py | 39 +++ lark_oapi/api/docx/v1/model/text_style.py | 6 + lark_oapi/api/hire/v1/model/__init__.py | 2 + .../v1/model/external_common_attachment.py | 42 ++++ .../api/hire/v1/model/external_interview.py | 8 + lark_oapi/api/hire/v1/model/external_offer.py | 73 ++++++ .../hire/v1/model/list_application_request.py | 6 + .../api/hire/v1/model/list_talent_request.py | 12 + lark_oapi/client.py | 210 ++++++++-------- lark_oapi/core/const.py | 2 +- .../api/acs/v1/create_rule_external_sample.py | 96 ++++---- samples/api/acs/v1/create_visitor_sample.py | 92 +++---- .../api/acs/v1/delete_rule_external_sample.py | 80 +++---- samples/api/acs/v1/delete_visitor_sample.py | 84 +++---- .../v1/device_bind_rule_external_sample.py | 92 +++---- .../get_access_record_access_photo_sample.py | 88 +++---- .../api/acs/v1/get_rule_external_sample.py | 84 +++---- samples/api/acs/v1/get_user_face_sample.py | 96 ++++---- samples/api/acs/v1/get_user_sample.py | 84 +++---- .../api/acs/v1/list_access_record_sample.py | 102 ++++---- samples/api/acs/v1/list_device_sample.py | 76 +++--- samples/api/acs/v1/list_user_sample.py | 88 +++---- samples/api/acs/v1/patch_user_sample.py | 96 ++++---- samples/api/acs/v1/update_user_face_sample.py | 108 ++++----- .../api/admin/v1/create_badge_grant_sample.py | 128 +++++----- .../api/admin/v1/create_badge_image_sample.py | 96 ++++---- samples/api/admin/v1/create_badge_sample.py | 108 ++++----- .../api/admin/v1/delete_badge_grant_sample.py | 84 +++---- .../api/admin/v1/get_badge_grant_sample.py | 92 +++---- samples/api/admin/v1/get_badge_sample.py | 80 +++---- .../admin/v1/list_admin_dept_stat_sample.py | 108 ++++----- .../admin/v1/list_admin_user_stat_sample.py | 112 ++++----- .../api/admin/v1/list_audit_info_sample.py | 130 +++++----- .../api/admin/v1/list_badge_grant_sample.py | 100 ++++---- samples/api/admin/v1/list_badge_sample.py | 88 +++---- samples/api/admin/v1/reset_password_sample.py | 96 ++++---- .../api/admin/v1/update_badge_grant_sample.py | 132 +++++------ samples/api/admin/v1/update_badge_sample.py | 112 ++++----- .../aily/v1/cancel_aily_session_run_sample.py | 84 +++---- ...create_aily_session_aily_message_sample.py | 112 ++++----- .../aily/v1/create_aily_session_run_sample.py | 104 ++++---- .../api/aily/v1/create_aily_session_sample.py | 92 +++---- .../api/aily/v1/delete_aily_session_sample.py | 80 +++---- .../get_aily_session_aily_message_sample.py | 84 +++---- .../aily/v1/get_aily_session_run_sample.py | 84 +++---- .../api/aily/v1/get_aily_session_sample.py | 80 +++---- .../list_aily_session_aily_message_sample.py | 96 ++++---- .../aily/v1/list_aily_session_run_sample.py | 88 +++---- .../api/aily/v1/update_aily_session_sample.py | 96 ++++---- ...lack_list_application_visibility_sample.py | 110 +++++---- ..._range_configuration_application_sample.py | 98 ++++---- ..._suggest_application_app_version_sample.py | 94 ++++---- ...t_overview_application_app_usage_sample.py | 118 +++++---- .../v6/get_application_app_version_sample.py | 92 +++---- .../application/v6/get_application_sample.py | 88 +++---- .../v6/list_app_recommend_rule_sample.py | 88 +++---- .../v6/list_application_app_version_sample.py | 100 ++++---- .../v6/list_application_feedback_sample.py | 108 ++++----- ...h_overview_application_app_usage_sample.py | 106 ++++----- .../overview_application_app_usage_sample.py | 108 ++++----- .../patch_application_app_version_sample.py | 108 ++++----- ...patch_application_contacts_range_sample.py | 109 +++++---- .../v6/patch_application_feedback_sample.py | 96 ++++---- .../v6/patch_application_sample.py | 96 ++++---- .../v6/patch_application_visibility_sample.py | 116 ++++----- .../application/v6/set_app_badge_sample.py | 108 ++++----- .../v6/underauditlist_application_sample.py | 92 +++---- .../update_application_management_sample.py | 92 +++---- .../approval/v4/add_sign_instance_sample.py | 116 ++++----- .../api/approval/v4/approve_task_sample.py | 112 ++++----- .../api/approval/v4/cancel_instance_sample.py | 100 ++++---- samples/api/approval/v4/cc_instance_sample.py | 108 ++++----- .../v4/check_external_instance_sample.py | 88 +++---- .../api/approval/v4/create_approval_sample.py | 136 +++++------ .../v4/create_external_approval_sample.py | 128 +++++----- .../v4/create_external_instance_sample.py | 180 +++++++------- .../v4/create_instance_comment_sample.py | 120 +++++----- .../api/approval/v4/create_instance_sample.py | 156 ++++++------ .../v4/delete_instance_comment_sample.py | 92 +++---- .../api/approval/v4/get_approval_sample.py | 92 +++---- .../v4/get_external_approval_sample.py | 84 +++---- .../api/approval/v4/get_instance_sample.py | 92 +++---- .../approval/v4/list_external_task_sample.py | 108 ++++----- .../v4/list_instance_comment_sample.py | 96 ++++---- .../api/approval/v4/list_instance_sample.py | 96 ++++---- .../approval/v4/preview_instance_sample.py | 116 ++++----- .../api/approval/v4/query_instance_sample.py | 136 +++++------ samples/api/approval/v4/query_task_sample.py | 96 ++++---- samples/api/approval/v4/reject_task_sample.py | 112 ++++----- .../v4/remove_instance_comment_sample.py | 88 +++---- .../api/approval/v4/resubmit_task_sample.py | 112 ++++----- .../approval/v4/search_cc_instance_sample.py | 136 +++++------ samples/api/approval/v4/search_task_sample.py | 144 +++++------ .../v4/specified_rollback_instance_sample.py | 108 ++++----- .../approval/v4/subscribe_approval_sample.py | 80 +++---- .../api/approval/v4/transfer_task_sample.py | 112 ++++----- .../v4/unsubscribe_approval_sample.py | 80 +++---- .../batch_create_user_daily_shift_sample.py | 96 ++++---- .../v1/batch_create_user_flow_sample.py | 92 +++---- .../api/attendance/v1/create_group_sample.py | 100 ++++---- .../api/attendance/v1/create_shift_sample.py | 148 ++++++------ .../v1/create_user_approval_sample.py | 92 +++---- .../v1/create_user_task_remedy_sample.py | 116 ++++----- .../v1/del_report_archive_rule_sample.py | 104 ++++---- .../api/attendance/v1/delete_group_sample.py | 80 +++---- .../api/attendance/v1/delete_shift_sample.py | 80 +++---- .../api/attendance/v1/download_file_sample.py | 88 +++---- samples/api/attendance/v1/get_group_sample.py | 88 +++---- .../get_leave_employ_expire_record_sample.py | 112 ++++----- samples/api/attendance/v1/get_shift_sample.py | 80 +++---- .../api/attendance/v1/get_user_flow_sample.py | 84 +++---- .../attendance/v1/list_archive_rule_sample.py | 84 +++---- .../api/attendance/v1/list_group_sample.py | 84 +++---- .../api/attendance/v1/list_shift_sample.py | 84 +++---- .../v1/modify_user_setting_sample.py | 92 +++---- .../v1/patch_leave_accrual_record_sample.py | 124 +++++----- .../v1/process_approval_info_sample.py | 96 ++++---- .../api/attendance/v1/query_shift_sample.py | 80 +++---- ...allowed_remedys_user_task_remedy_sample.py | 98 ++++---- .../v1/query_user_approval_sample.py | 116 ++++----- .../v1/query_user_daily_shift_sample.py | 100 ++++---- .../attendance/v1/query_user_flow_sample.py | 104 ++++---- .../v1/query_user_setting_sample.py | 92 +++---- .../v1/query_user_stats_data_sample.py | 120 +++++----- .../v1/query_user_stats_field_sample.py | 104 ++++---- .../v1/query_user_stats_view_sample.py | 100 ++++---- .../v1/query_user_task_remedy_sample.py | 108 ++++----- .../attendance/v1/query_user_task_sample.py | 112 ++++----- .../api/attendance/v1/search_group_sample.py | 88 +++---- .../v1/update_user_stats_view_sample.py | 96 ++++---- .../api/attendance/v1/upload_file_sample.py | 96 ++++---- .../v1/upload_report_archive_rule_sample.py | 104 ++++---- ..._stats_fields_query_archive_rule_sample.py | 106 ++++----- .../auth/v3/create_app_access_token_sample.py | 96 ++++---- .../v3/create_tenant_access_token_sample.py | 92 +++---- .../v3/internal_app_access_token_sample.py | 92 +++---- .../v3/internal_tenant_access_token_sample.py | 92 +++---- .../api/auth/v3/resend_app_ticket_sample.py | 92 +++---- .../authen/v1/create_access_token_sample.py | 92 +++---- .../v1/create_oidc_access_token_sample.py | 92 +++---- ...create_oidc_refresh_access_token_sample.py | 94 ++++---- .../v1/create_refresh_access_token_sample.py | 94 ++++---- samples/api/authen/v1/get_user_info_sample.py | 76 +++--- samples/api/baike/v1/create_draft_sample.py | 118 +++++---- samples/api/baike/v1/create_entity_sample.py | 114 +++++---- samples/api/baike/v1/download_file_sample.py | 88 +++---- samples/api/baike/v1/extract_entity_sample.py | 88 +++---- samples/api/baike/v1/get_entity_sample.py | 92 +++---- .../api/baike/v1/highlight_entity_sample.py | 88 +++---- .../baike/v1/list_classification_sample.py | 84 +++---- samples/api/baike/v1/list_entity_sample.py | 92 +++---- samples/api/baike/v1/match_entity_sample.py | 88 +++---- samples/api/baike/v1/search_entity_sample.py | 112 ++++----- samples/api/baike/v1/update_draft_sample.py | 118 +++++---- samples/api/baike/v1/update_entity_sample.py | 118 +++++---- samples/api/baike/v1/upload_file_sample.py | 96 ++++---- .../v1/batch_create_app_role_member_sample.py | 96 ++++---- .../batch_create_app_table_record_sample.py | 104 ++++---- .../v1/batch_create_app_table_sample.py | 96 ++++---- .../v1/batch_delete_app_role_member_sample.py | 96 ++++---- .../batch_delete_app_table_record_sample.py | 96 ++++---- .../v1/batch_delete_app_table_sample.py | 92 +++---- .../v1/batch_get_app_table_record_sample.py | 108 ++++----- .../batch_update_app_table_record_sample.py | 100 ++++---- .../bitable/v1/copy_app_dashboard_sample.py | 96 ++++---- samples/api/bitable/v1/copy_app_sample.py | 104 ++++---- .../v1/create_app_role_member_sample.py | 100 ++++---- .../api/bitable/v1/create_app_role_sample.py | 100 ++++---- samples/api/bitable/v1/create_app_sample.py | 96 ++++---- .../v1/create_app_table_field_sample.py | 116 ++++----- .../v1/create_app_table_record_sample.py | 104 ++++---- .../api/bitable/v1/create_app_table_sample.py | 92 +++---- .../v1/create_app_table_view_sample.py | 100 ++++---- .../v1/delete_app_role_member_sample.py | 92 +++---- .../api/bitable/v1/delete_app_role_sample.py | 84 +++---- .../v1/delete_app_table_field_sample.py | 88 +++---- .../v1/delete_app_table_record_sample.py | 88 +++---- .../api/bitable/v1/delete_app_table_sample.py | 84 +++---- .../v1/delete_app_table_view_sample.py | 88 +++---- samples/api/bitable/v1/get_app_sample.py | 80 +++---- .../bitable/v1/get_app_table_form_sample.py | 88 +++---- .../bitable/v1/get_app_table_record_sample.py | 108 ++++----- .../bitable/v1/get_app_table_view_sample.py | 88 +++---- .../bitable/v1/list_app_dashboard_sample.py | 88 +++---- .../bitable/v1/list_app_role_member_sample.py | 92 +++---- .../api/bitable/v1/list_app_role_sample.py | 88 +++---- .../bitable/v1/list_app_table_field_sample.py | 100 ++++---- .../v1/list_app_table_form_field_sample.py | 96 ++++---- .../v1/list_app_table_record_sample.py | 124 +++++----- .../api/bitable/v1/list_app_table_sample.py | 88 +++---- .../bitable/v1/list_app_table_view_sample.py | 96 ++++---- .../v1/patch_app_table_form_field_sample.py | 120 +++++----- .../bitable/v1/patch_app_table_form_sample.py | 116 ++++----- .../api/bitable/v1/patch_app_table_sample.py | 96 ++++---- .../bitable/v1/patch_app_table_view_sample.py | 104 ++++---- .../v1/search_app_table_record_sample.py | 124 +++++----- .../api/bitable/v1/update_app_role_sample.py | 104 ++++---- samples/api/bitable/v1/update_app_sample.py | 96 ++++---- .../v1/update_app_table_field_sample.py | 116 ++++----- .../v1/update_app_table_record_sample.py | 104 ++++---- samples/api/block/v2/create_entity_sample.py | 132 +++++------ samples/api/block/v2/create_message_sample.py | 104 ++++---- samples/api/block/v2/update_entity_sample.py | 136 +++++------ .../v1/download_as_image_whiteboard_sample.py | 88 +++---- .../board/v1/list_whiteboard_node_sample.py | 80 +++---- ...h_delete_calendar_event_attendee_sample.py | 118 +++++---- .../calendar/v4/create_calendar_acl_sample.py | 100 ++++---- .../create_calendar_event_attendee_sample.py | 116 ++++----- ...eate_calendar_event_meeting_chat_sample.py | 85 ++++--- ...te_calendar_event_meeting_minute_sample.py | 86 ++++--- .../v4/create_calendar_event_sample.py | 156 ++++++------ .../api/calendar/v4/create_calendar_sample.py | 104 ++++---- .../v4/create_exchange_binding_sample.py | 100 ++++---- .../v4/create_timeoff_event_sample.py | 112 ++++----- .../calendar/v4/delete_calendar_acl_sample.py | 84 +++---- ...lete_calendar_event_meeting_chat_sample.py | 89 ++++--- .../v4/delete_calendar_event_sample.py | 88 +++---- .../api/calendar/v4/delete_calendar_sample.py | 80 +++---- .../v4/delete_exchange_binding_sample.py | 80 +++---- .../v4/delete_timeoff_event_sample.py | 80 +++---- .../v4/generate_caldav_conf_setting_sample.py | 88 +++---- .../calendar/v4/get_calendar_event_sample.py | 100 ++++---- .../api/calendar/v4/get_calendar_sample.py | 80 +++---- .../v4/get_exchange_binding_sample.py | 84 +++---- .../v4/instance_view_calendar_event_sample.py | 92 +++---- .../v4/instances_calendar_event_sample.py | 100 ++++---- .../calendar/v4/list_calendar_acl_sample.py | 92 +++---- ...endar_event_attendee_chat_member_sample.py | 102 ++++---- .../v4/list_calendar_event_attendee_sample.py | 100 ++++---- .../calendar/v4/list_calendar_event_sample.py | 108 ++++----- .../api/calendar/v4/list_calendar_sample.py | 88 +++---- .../api/calendar/v4/list_freebusy_sample.py | 112 ++++----- .../v4/patch_calendar_event_sample.py | 156 ++++++------ .../api/calendar/v4/patch_calendar_sample.py | 108 ++++----- .../calendar/v4/primary_calendar_sample.py | 80 +++---- .../v4/reply_calendar_event_sample.py | 96 ++++---- .../v4/search_calendar_event_sample.py | 108 ++++----- .../api/calendar/v4/search_calendar_sample.py | 96 ++++---- .../calendar/v4/subscribe_calendar_sample.py | 80 +++---- .../v4/subscription_calendar_acl_sample.py | 80 +++---- .../v4/subscription_calendar_event_sample.py | 80 +++---- .../v4/subscription_calendar_sample.py | 76 +++--- .../v4/unsubscribe_calendar_sample.py | 80 +++---- .../v4/unsubscription_calendar_acl_sample.py | 80 +++---- .../unsubscription_calendar_event_sample.py | 80 +++---- .../v4/unsubscription_calendar_sample.py | 76 +++--- .../v1/list_change_reason_sample.py | 84 +++---- .../compensation/v1/list_indicator_sample.py | 84 +++---- .../v1/list_item_category_sample.py | 84 +++---- .../api/compensation/v1/list_item_sample.py | 84 +++---- .../api/compensation/v1/list_plan_sample.py | 84 +++---- .../compensation/v1/query_archive_sample.py | 108 ++++----- .../api/contact/v3/add_group_member_sample.py | 100 ++++---- .../v3/batch_add_group_member_sample.py | 92 +++---- ...ch_create_functional_role_member_sample.py | 97 ++++---- ...ch_delete_functional_role_member_sample.py | 97 ++++---- .../api/contact/v3/batch_department_sample.py | 88 +++---- .../contact/v3/batch_get_id_user_sample.py | 100 ++++---- .../v3/batch_remove_group_member_sample.py | 92 +++---- samples/api/contact/v3/batch_user_sample.py | 88 +++---- .../contact/v3/bind_department_unit_sample.py | 96 ++++---- .../contact/v3/children_department_sample.py | 102 ++++---- .../contact/v3/create_department_sample.py | 136 +++++------ .../v3/create_employee_type_enum_sample.py | 100 ++++---- .../v3/create_functional_role_sample.py | 88 +++---- samples/api/contact/v3/create_group_sample.py | 108 ++++----- .../contact/v3/create_job_family_sample.py | 108 ++++----- .../api/contact/v3/create_job_level_sample.py | 108 ++++----- samples/api/contact/v3/create_unit_sample.py | 96 ++++---- samples/api/contact/v3/create_user_sample.py | 200 ++++++++-------- .../contact/v3/delete_department_sample.py | 84 +++---- .../v3/delete_employee_type_enum_sample.py | 80 +++---- .../v3/delete_functional_role_sample.py | 80 +++---- samples/api/contact/v3/delete_group_sample.py | 80 +++---- .../contact/v3/delete_job_family_sample.py | 80 +++---- .../api/contact/v3/delete_job_level_sample.py | 80 +++---- samples/api/contact/v3/delete_unit_sample.py | 80 +++---- samples/api/contact/v3/delete_user_sample.py | 124 +++++----- .../v3/find_by_department_user_sample.py | 98 ++++---- .../api/contact/v3/get_department_sample.py | 88 +++---- .../v3/get_functional_role_member_sample.py | 92 +++---- samples/api/contact/v3/get_group_sample.py | 88 +++---- .../api/contact/v3/get_job_family_sample.py | 80 +++---- .../api/contact/v3/get_job_level_sample.py | 80 +++---- .../api/contact/v3/get_job_title_sample.py | 80 +++---- samples/api/contact/v3/get_unit_sample.py | 80 +++---- samples/api/contact/v3/get_user_sample.py | 88 +++---- .../api/contact/v3/get_work_city_sample.py | 80 +++---- .../api/contact/v3/list_custom_attr_sample.py | 84 +++---- .../api/contact/v3/list_department_sample.py | 100 ++++---- .../contact/v3/list_department_unit_sample.py | 94 ++++---- .../v3/list_employee_type_enum_sample.py | 84 +++---- .../v3/list_functional_role_member_sample.py | 96 ++++---- .../api/contact/v3/list_job_family_sample.py | 88 +++---- .../api/contact/v3/list_job_level_sample.py | 88 +++---- .../api/contact/v3/list_job_title_sample.py | 84 +++---- samples/api/contact/v3/list_scope_sample.py | 94 ++++---- samples/api/contact/v3/list_unit_sample.py | 86 ++++--- samples/api/contact/v3/list_user_sample.py | 96 ++++---- .../api/contact/v3/list_work_city_sample.py | 84 +++---- .../contact/v3/member_belong_group_sample.py | 98 ++++---- .../contact/v3/parent_department_sample.py | 98 ++++---- .../api/contact/v3/patch_department_sample.py | 132 +++++------ samples/api/contact/v3/patch_group_sample.py | 104 ++++---- samples/api/contact/v3/patch_unit_sample.py | 92 +++---- samples/api/contact/v3/patch_user_sample.py | 196 +++++++-------- .../contact/v3/remove_group_member_sample.py | 100 ++++---- .../api/contact/v3/resurrect_user_sample.py | 104 ++++---- .../scopes_functional_role_member_sample.py | 104 ++++---- .../contact/v3/search_department_sample.py | 106 ++++----- .../v3/simplelist_group_member_sample.py | 98 ++++---- .../api/contact/v3/simplelist_group_sample.py | 90 ++++--- ...nbind_department_chat_department_sample.py | 93 ++++---- .../v3/unbind_department_unit_sample.py | 96 ++++---- .../update_department_id_department_sample.py | 96 ++++---- .../contact/v3/update_department_sample.py | 128 +++++----- .../v3/update_employee_type_enum_sample.py | 104 ++++---- .../v3/update_functional_role_sample.py | 92 +++---- .../contact/v3/update_job_family_sample.py | 112 ++++----- .../api/contact/v3/update_job_level_sample.py | 112 ++++----- .../contact/v3/update_user_id_user_sample.py | 96 ++++---- samples/api/contact/v3/update_user_sample.py | 180 +++++++------- ...num_option_common_data_meta_data_sample.py | 101 ++++---- .../add_role_assign_authorization_sample.py | 100 ++++---- .../v1/convert_common_data_id_sample.py | 104 ++++---- .../api/corehr/v1/create_company_sample.py | 152 ++++++------ .../api/corehr/v1/create_contract_sample.py | 132 +++++------ .../api/corehr/v1/create_department_sample.py | 128 +++++----- .../corehr/v1/create_employee_type_sample.py | 108 ++++----- .../api/corehr/v1/create_employment_sample.py | 144 +++++------ .../api/corehr/v1/create_job_change_sample.py | 124 +++++----- .../api/corehr/v1/create_job_data_sample.py | 188 +++++++-------- .../api/corehr/v1/create_job_family_sample.py | 112 ++++----- .../api/corehr/v1/create_job_level_sample.py | 112 ++++----- samples/api/corehr/v1/create_job_sample.py | 128 +++++----- .../v1/create_leave_granting_record_sample.py | 124 +++++----- .../api/corehr/v1/create_location_sample.py | 120 +++++----- .../v1/create_national_id_type_sample.py | 120 +++++----- samples/api/corehr/v1/create_person_sample.py | 172 +++++++------- .../v1/create_working_hours_type_sample.py | 112 ++++----- .../api/corehr/v1/delete_company_sample.py | 80 +++---- .../api/corehr/v1/delete_contract_sample.py | 80 +++---- .../api/corehr/v1/delete_department_sample.py | 80 +++---- .../corehr/v1/delete_employee_type_sample.py | 80 +++---- .../api/corehr/v1/delete_employment_sample.py | 84 +++---- .../api/corehr/v1/delete_job_data_sample.py | 80 +++---- .../api/corehr/v1/delete_job_family_sample.py | 80 +++---- .../api/corehr/v1/delete_job_level_sample.py | 80 +++---- samples/api/corehr/v1/delete_job_sample.py | 80 +++---- .../v1/delete_leave_granting_record_sample.py | 80 +++---- .../api/corehr/v1/delete_location_sample.py | 80 +++---- .../v1/delete_national_id_type_sample.py | 80 +++---- samples/api/corehr/v1/delete_person_sample.py | 80 +++---- .../api/corehr/v1/delete_pre_hire_sample.py | 80 +++---- .../v1/delete_working_hours_type_sample.py | 80 +++---- ...num_option_common_data_meta_data_sample.py | 102 ++++---- .../v1/get_by_param_authorization_sample.py | 84 +++---- .../v1/get_by_param_custom_field_sample.py | 84 +++---- samples/api/corehr/v1/get_company_sample.py | 80 +++---- samples/api/corehr/v1/get_contract_sample.py | 80 +++---- .../corehr/v1/get_country_region_sample.py | 80 +++---- samples/api/corehr/v1/get_currency_sample.py | 80 +++---- .../api/corehr/v1/get_department_sample.py | 88 +++---- .../api/corehr/v1/get_employee_type_sample.py | 80 +++---- samples/api/corehr/v1/get_file_sample.py | 88 +++---- samples/api/corehr/v1/get_job_data_sample.py | 88 +++---- .../api/corehr/v1/get_job_family_sample.py | 80 +++---- samples/api/corehr/v1/get_job_level_sample.py | 80 +++---- samples/api/corehr/v1/get_job_sample.py | 80 +++---- samples/api/corehr/v1/get_location_sample.py | 80 +++---- .../corehr/v1/get_national_id_type_sample.py | 80 +++---- samples/api/corehr/v1/get_person_sample.py | 84 +++---- samples/api/corehr/v1/get_pre_hire_sample.py | 80 +++---- .../get_process_form_variable_data_sample.py | 80 +++---- .../api/corehr/v1/get_subdivision_sample.py | 80 +++---- samples/api/corehr/v1/get_subregion_sample.py | 80 +++---- .../v1/get_working_hours_type_sample.py | 80 +++---- .../corehr/v1/leave_balances_leave_sample.py | 100 ++++---- .../v1/leave_request_history_leave_sample.py | 172 +++++++------- .../api/corehr/v1/leave_types_leave_sample.py | 92 +++---- samples/api/corehr/v1/list_company_sample.py | 84 +++---- samples/api/corehr/v1/list_contract_sample.py | 84 +++---- .../corehr/v1/list_country_region_sample.py | 84 +++---- samples/api/corehr/v1/list_currency_sample.py | 84 +++---- .../api/corehr/v1/list_department_sample.py | 100 ++++---- .../corehr/v1/list_employee_type_sample.py | 84 +++---- samples/api/corehr/v1/list_job_data_sample.py | 112 ++++----- .../api/corehr/v1/list_job_family_sample.py | 84 +++---- .../api/corehr/v1/list_job_level_sample.py | 84 +++---- samples/api/corehr/v1/list_job_sample.py | 92 +++---- samples/api/corehr/v1/list_location_sample.py | 84 +++---- .../corehr/v1/list_national_id_type_sample.py | 96 ++++---- ...ist_object_api_name_custom_field_sample.py | 84 +++---- samples/api/corehr/v1/list_pre_hire_sample.py | 88 +++---- .../corehr/v1/list_security_group_sample.py | 84 +++---- .../api/corehr/v1/list_subdivision_sample.py | 88 +++---- .../api/corehr/v1/list_subregion_sample.py | 88 +++---- .../v1/list_working_hours_type_sample.py | 84 +++---- .../v1/match_compensation_standard_sample.py | 140 +++++------ samples/api/corehr/v1/patch_company_sample.py | 152 ++++++------ .../api/corehr/v1/patch_contract_sample.py | 136 +++++------ .../api/corehr/v1/patch_department_sample.py | 136 +++++------ .../corehr/v1/patch_employee_type_sample.py | 112 ++++----- .../api/corehr/v1/patch_employment_sample.py | 136 +++++------ .../api/corehr/v1/patch_job_data_sample.py | 196 +++++++-------- .../api/corehr/v1/patch_job_family_sample.py | 116 ++++----- .../api/corehr/v1/patch_job_level_sample.py | 116 ++++----- samples/api/corehr/v1/patch_job_sample.py | 132 +++++------ .../v1/patch_national_id_type_sample.py | 124 +++++----- samples/api/corehr/v1/patch_person_sample.py | 176 +++++++------- .../api/corehr/v1/patch_pre_hire_sample.py | 128 +++++----- .../v1/patch_working_hours_type_sample.py | 116 ++++----- .../corehr/v1/query_authorization_sample.py | 96 ++++---- .../corehr/v1/query_custom_field_sample.py | 80 +++---- .../api/corehr/v1/query_offboarding_sample.py | 92 +++---- .../corehr/v1/query_security_group_sample.py | 92 +++---- .../corehr/v1/query_transfer_reason_sample.py | 84 +++---- .../corehr/v1/query_transfer_type_sample.py | 84 +++---- ...remove_role_assign_authorization_sample.py | 88 +++---- .../corehr/v1/search_assigned_user_sample.py | 108 ++++----- .../corehr/v1/search_offboarding_sample.py | 136 +++++------ .../corehr/v1/submit_offboarding_sample.py | 128 +++++----- ...update_role_assign_authorization_sample.py | 100 ++++---- samples/api/corehr/v1/upload_person_sample.py | 96 ++++---- .../api/corehr/v2/batch_get_company_sample.py | 88 +++---- .../corehr/v2/batch_get_department_sample.py | 104 ++++---- .../corehr/v2/batch_get_employee_sample.py | 108 ++++----- .../v2/batch_get_employees_bp_sample.py | 96 ++++---- .../v2/batch_get_employees_job_data_sample.py | 112 ++++----- .../corehr/v2/batch_get_job_family_sample.py | 88 +++---- .../corehr/v2/batch_get_job_level_sample.py | 88 +++---- .../corehr/v2/batch_get_location_sample.py | 88 +++---- .../api/corehr/v2/complete_pre_hire_sample.py | 80 +++---- .../corehr/v2/create_cost_center_sample.py | 112 ++++----- .../v2/create_cost_center_version_sample.py | 116 ++++----- .../api/corehr/v2/create_employee_sample.py | 120 +++++----- samples/api/corehr/v2/create_person_sample.py | 216 ++++++++--------- .../api/corehr/v2/create_pre_hire_sample.py | 108 ++++----- .../v2/create_probation_assessment_sample.py | 100 ++++---- .../corehr/v2/delete_cost_center_sample.py | 92 +++---- .../v2/delete_cost_center_version_sample.py | 96 ++++---- .../api/corehr/v2/delete_pre_hire_sample.py | 80 +++---- .../v2/delete_probation_assessment_sample.py | 80 +++---- ...ble_disable_assessment_probation_sample.py | 95 ++++---- .../corehr/v2/get_by_department_bp_sample.py | 96 ++++---- samples/api/corehr/v2/get_job_sample.py | 80 +++---- .../get_process_form_variable_data_sample.py | 88 +++---- samples/api/corehr/v2/get_process_sample.py | 84 +++---- samples/api/corehr/v2/list_bp_sample.py | 92 +++---- samples/api/corehr/v2/list_job_sample.py | 92 +++---- samples/api/corehr/v2/list_process_sample.py | 100 ++++---- .../corehr/v2/parents_department_sample.py | 92 +++---- .../api/corehr/v2/patch_cost_center_sample.py | 104 ++++---- .../v2/patch_cost_center_version_sample.py | 120 +++++----- samples/api/corehr/v2/patch_person_sample.py | 224 +++++++++--------- .../api/corehr/v2/patch_pre_hire_sample.py | 108 ++++----- .../v2/patch_probation_assessment_sample.py | 120 +++++----- .../v2/query_employees_job_data_sample.py | 116 ++++----- .../api/corehr/v2/query_job_grade_sample.py | 104 ++++---- .../query_multi_timeline_department_sample.py | 116 ++++----- .../api/corehr/v2/query_pre_hire_sample.py | 108 ++++----- .../v2/query_timeline_department_sample.py | 104 ++++---- .../search_basic_info_bank_branch_sample.py | 116 ++++----- .../v2/search_basic_info_bank_sample.py | 112 ++++----- .../v2/search_basic_info_city_sample.py | 104 ++++---- ...search_basic_info_country_region_sample.py | 100 ++++---- ..._info_country_region_subdivision_sample.py | 106 ++++----- .../v2/search_basic_info_currency_sample.py | 100 ++++---- .../v2/search_basic_info_district_sample.py | 104 ++++---- .../search_basic_info_nationality_sample.py | 104 ++++---- .../api/corehr/v2/search_contract_sample.py | 104 ++++---- .../corehr/v2/search_cost_center_sample.py | 116 ++++----- .../api/corehr/v2/search_department_sample.py | 132 +++++------ .../api/corehr/v2/search_employee_sample.py | 188 +++++++-------- .../api/corehr/v2/search_job_change_sample.py | 130 +++++----- .../api/corehr/v2/search_pre_hire_sample.py | 160 ++++++------- .../api/corehr/v2/search_probation_sample.py | 152 ++++++------ .../api/corehr/v2/submit_probation_sample.py | 124 +++++----- .../corehr/v2/transit_task_pre_hire_sample.py | 92 +++---- .../api/corehr/v2/tree_department_sample.py | 76 ++++++ .../v2/update_process_approver_sample.py | 120 +++++----- .../corehr/v2/withdraw_probation_sample.py | 96 ++++---- .../v1/field_extraction_contract_sample.py | 100 ++++---- .../api/document_ai/v1/parse_resume_sample.py | 92 +++---- .../v1/recognize_bank_card_sample.py | 92 +++---- .../v1/recognize_business_card_sample.py | 92 +++---- .../v1/recognize_business_license_sample.py | 92 +++---- .../v1/recognize_chinese_passport_sample.py | 92 +++---- .../v1/recognize_driving_license_sample.py | 92 +++---- .../recognize_food_manage_license_sample.py | 92 +++---- .../recognize_food_produce_license_sample.py | 92 +++---- .../v1/recognize_health_certificate_sample.py | 92 +++---- ...gnize_hkm_mainland_travel_permit_sample.py | 94 ++++---- .../v1/recognize_id_card_sample.py | 92 +++---- .../v1/recognize_taxi_invoice_sample.py | 92 +++---- .../v1/recognize_train_invoice_sample.py | 92 +++---- ...ognize_tw_mainland_travel_permit_sample.py | 94 ++++---- .../v1/recognize_vat_invoice_sample.py | 92 +++---- .../v1/recognize_vehicle_invoice_sample.py | 92 +++---- .../v1/recognize_vehicle_license_sample.py | 92 +++---- ...h_delete_document_block_children_sample.py | 109 +++++---- .../v1/batch_update_document_block_sample.py | 104 ++++---- .../create_document_block_children_sample.py | 112 ++++----- samples/api/docx/v1/create_document_sample.py | 92 +++---- .../v1/get_document_block_children_sample.py | 102 ++++---- .../api/docx/v1/get_document_block_sample.py | 92 +++---- samples/api/docx/v1/get_document_sample.py | 80 +++---- .../api/docx/v1/list_document_block_sample.py | 98 ++++---- .../docx/v1/patch_document_block_sample.py | 168 ++++++------- .../docx/v1/raw_content_document_sample.py | 84 +++---- .../drive/v1/auth_permission_member_sample.py | 88 +++---- .../batch_create_permission_member_sample.py | 100 ++++---- ...batch_get_tmp_download_url_media_sample.py | 86 ++++--- .../v1/batch_query_file_comment_sample.py | 100 ++++---- .../api/drive/v1/batch_query_meta_sample.py | 96 ++++---- samples/api/drive/v1/copy_file_sample.py | 108 ++++----- .../api/drive/v1/create_export_task_sample.py | 100 ++++---- .../drive/v1/create_file_comment_sample.py | 100 ++++---- .../v1/create_file_subscription_sample.py | 104 ++++---- .../drive/v1/create_file_version_sample.py | 100 ++++---- .../api/drive/v1/create_folder_file_sample.py | 92 +++---- .../api/drive/v1/create_import_task_sample.py | 104 ++++---- .../v1/create_permission_member_sample.py | 116 ++++----- ...reate_permission_public_password_sample.py | 84 +++---- .../drive/v1/create_shortcut_file_sample.py | 96 ++++---- .../v1/delete_file_comment_reply_sample.py | 92 +++---- samples/api/drive/v1/delete_file_sample.py | 84 +++---- .../drive/v1/delete_file_version_sample.py | 92 +++---- .../v1/delete_permission_member_sample.py | 108 ++++----- ...elete_permission_public_password_sample.py | 84 +++---- .../drive/v1/delete_subscribe_file_sample.py | 88 +++---- .../drive/v1/download_export_task_sample.py | 88 +++---- samples/api/drive/v1/download_file_sample.py | 88 +++---- samples/api/drive/v1/download_media_sample.py | 94 ++++---- .../api/drive/v1/get_export_task_sample.py | 84 +++---- .../api/drive/v1/get_file_comment_sample.py | 92 +++---- .../drive/v1/get_file_statistics_sample.py | 84 +++---- .../drive/v1/get_file_subscription_sample.py | 96 ++++---- .../api/drive/v1/get_file_version_sample.py | 92 +++---- .../api/drive/v1/get_import_task_sample.py | 80 +++---- .../drive/v1/get_permission_public_sample.py | 84 +++---- .../api/drive/v1/get_subscribe_file_sample.py | 88 +++---- .../v1/list_file_comment_reply_sample.py | 100 ++++---- .../api/drive/v1/list_file_comment_sample.py | 104 ++++---- samples/api/drive/v1/list_file_sample.py | 100 ++++---- .../api/drive/v1/list_file_version_sample.py | 96 ++++---- .../drive/v1/list_file_view_record_sample.py | 96 ++++---- .../drive/v1/list_permission_member_sample.py | 92 +++---- samples/api/drive/v1/move_file_sample.py | 96 ++++---- .../api/drive/v1/patch_file_comment_sample.py | 100 ++++---- .../v1/patch_file_subscription_sample.py | 100 ++++---- .../v1/patch_permission_public_sample.py | 116 ++++----- samples/api/drive/v1/subscribe_file_sample.py | 88 +++---- .../api/drive/v1/task_check_file_sample.py | 80 +++---- ...transfer_owner_permission_member_sample.py | 116 ++++----- .../v1/update_file_comment_reply_sample.py | 108 ++++----- .../v1/update_permission_member_sample.py | 116 ++++----- ...pdate_permission_public_password_sample.py | 84 +++---- .../api/drive/v1/upload_all_file_sample.py | 112 ++++----- .../api/drive/v1/upload_all_media_sample.py | 116 ++++----- .../api/drive/v1/upload_finish_file_sample.py | 92 +++---- .../drive/v1/upload_finish_media_sample.py | 92 +++---- .../api/drive/v1/upload_part_file_sample.py | 108 ++++----- .../api/drive/v1/upload_part_media_sample.py | 108 ++++----- .../drive/v1/upload_prepare_file_sample.py | 100 ++++---- .../drive/v1/upload_prepare_media_sample.py | 104 ++++---- .../drive/v2/get_permission_public_sample.py | 84 +++---- .../v2/patch_permission_public_sample.py | 120 +++++----- samples/api/ehr/v1/get_attachment_sample.py | 88 +++---- samples/api/ehr/v1/list_employee_sample.py | 112 ++++----- .../api/event/v1/list_outbound_ip_sample.py | 84 +++---- .../v1/create_moto_sample.py | 104 ++++---- .../gray_test_open_sg/v1/get_moto_sample.py | 84 +++---- .../gray_test_open_sg/v1/list_moto_sample.py | 88 +++---- .../helpdesk/v1/agent_email_agent_sample.py | 76 +++--- .../v1/answer_user_query_ticket_sample.py | 96 ++++---- .../v1/cancel_approve_notification_sample.py | 80 +++---- .../v1/cancel_send_notification_sample.py | 92 +++---- .../v1/create_agent_schedule_sample.py | 88 +++---- .../helpdesk/v1/create_agent_skill_sample.py | 96 ++++---- .../helpdesk/v1/create_bot_message_sample.py | 104 ++++---- .../api/helpdesk/v1/create_category_sample.py | 96 ++++---- samples/api/helpdesk/v1/create_faq_sample.py | 88 +++---- .../helpdesk/v1/create_notification_sample.py | 168 ++++++------- .../create_ticket_customized_field_sample.py | 124 +++++----- .../v1/create_ticket_message_sample.py | 96 ++++---- .../v1/customized_fields_ticket_sample.py | 80 +++---- .../v1/delete_agent_schedules_sample.py | 80 +++---- .../helpdesk/v1/delete_agent_skill_sample.py | 80 +++---- .../api/helpdesk/v1/delete_category_sample.py | 80 +++---- samples/api/helpdesk/v1/delete_faq_sample.py | 80 +++---- .../delete_ticket_customized_field_sample.py | 80 +++---- .../v1/execute_send_notification_sample.py | 92 +++---- .../api/helpdesk/v1/faq_image_faq_sample.py | 92 +++---- .../helpdesk/v1/get_agent_schedules_sample.py | 80 +++---- .../api/helpdesk/v1/get_agent_skill_sample.py | 80 +++---- .../api/helpdesk/v1/get_category_sample.py | 80 +++---- samples/api/helpdesk/v1/get_faq_sample.py | 80 +++---- .../helpdesk/v1/get_notification_sample.py | 84 +++---- .../v1/get_ticket_customized_field_sample.py | 80 +++---- samples/api/helpdesk/v1/get_ticket_sample.py | 80 +++---- .../helpdesk/v1/list_agent_schedule_sample.py | 80 +++---- .../v1/list_agent_skill_rule_sample.py | 76 +++--- .../helpdesk/v1/list_agent_skill_sample.py | 76 +++--- .../api/helpdesk/v1/list_category_sample.py | 88 +++---- samples/api/helpdesk/v1/list_faq_sample.py | 96 ++++---- .../v1/list_ticket_customized_field_sample.py | 96 ++++---- .../helpdesk/v1/list_ticket_message_sample.py | 96 ++++---- samples/api/helpdesk/v1/list_ticket_sample.py | 144 +++++------ samples/api/helpdesk/v1/patch_agent_sample.py | 92 +++---- .../v1/patch_agent_schedules_sample.py | 92 +++---- .../helpdesk/v1/patch_agent_skill_sample.py | 92 +++---- .../api/helpdesk/v1/patch_category_sample.py | 96 ++++---- samples/api/helpdesk/v1/patch_faq_sample.py | 92 +++---- .../helpdesk/v1/patch_notification_sample.py | 172 +++++++------- .../patch_ticket_customized_field_sample.py | 108 ++++----- .../v1/preview_notification_sample.py | 80 +++---- samples/api/helpdesk/v1/search_faq_sample.py | 92 +++---- .../v1/start_service_ticket_sample.py | 100 ++++---- .../v1/submit_approve_notification_sample.py | 92 +++---- .../api/helpdesk/v1/subscribe_event_sample.py | 88 +++---- .../helpdesk/v1/ticket_image_ticket_sample.py | 96 ++++---- .../helpdesk/v1/unsubscribe_event_sample.py | 88 +++---- .../api/helpdesk/v1/update_ticket_sample.py | 116 ++++----- .../hire/v1/add_to_folder_talent_sample.py | 92 +++---- ..._delete_eco_account_custom_field_sample.py | 93 ++++---- ...co_background_check_custom_field_sample.py | 90 ++++--- ...ete_eco_background_check_package_sample.py | 98 ++++---- .../v1/batch_delete_eco_exam_paper_sample.py | 92 +++---- .../api/hire/v1/batch_get_id_talent_sample.py | 104 ++++---- ..._update_eco_account_custom_field_sample.py | 93 ++++---- ...co_background_check_custom_field_sample.py | 94 ++++---- ...ate_eco_background_check_package_sample.py | 98 ++++---- .../v1/batch_update_eco_exam_paper_sample.py | 92 +++---- .../v1/batch_update_job_manager_sample.py | 112 ++++----- .../v1/cancel_eco_background_check_sample.py | 88 +++---- samples/api/hire/v1/close_job_sample.py | 80 +++---- .../api/hire/v1/combined_create_job_sample.py | 220 ++++++++--------- .../hire/v1/combined_create_talent_sample.py | 156 ++++++------ .../api/hire/v1/combined_update_job_sample.py | 208 ++++++++-------- .../hire/v1/combined_update_talent_sample.py | 156 ++++++------ samples/api/hire/v1/config_job_sample.py | 84 +++---- .../api/hire/v1/create_application_sample.py | 108 ++++----- .../api/hire/v1/create_attachment_sample.py | 80 +++---- ...e_by_attachment_website_delivery_sample.py | 125 +++++----- ...reate_by_resume_website_delivery_sample.py | 112 ++++----- .../create_eco_account_custom_field_sample.py | 92 +++---- ...co_background_check_custom_field_sample.py | 94 ++++---- ...ate_eco_background_check_package_sample.py | 97 ++++---- .../hire/v1/create_eco_exam_paper_sample.py | 92 +++---- samples/api/hire/v1/create_exam_sample.py | 108 ++++----- .../v1/create_external_application_sample.py | 128 +++++----- ...create_external_background_check_sample.py | 108 ++++----- ...te_external_interview_assessment_sample.py | 109 +++++---- .../v1/create_external_interview_sample.py | 106 +++++---- .../create_external_referral_reward_sample.py | 160 ++++++------- .../hire/v1/create_job_requirement_sample.py | 204 ++++++++-------- samples/api/hire/v1/create_note_sample.py | 116 ++++----- samples/api/hire/v1/create_offer_sample.py | 128 +++++----- .../hire/v1/create_referral_account_sample.py | 92 +++---- .../v1/create_talent_external_info_sample.py | 92 +++---- .../v1/create_tripartite_agreement_sample.py | 96 ++++---- .../hire/v1/create_website_channel_sample.py | 92 +++---- .../v1/create_website_site_user_sample.py | 108 ++++----- .../v1/deactivate_referral_account_sample.py | 80 +++---- .../v1/delete_external_application_sample.py | 84 +++---- .../delete_external_referral_reward_sample.py | 80 +++---- .../hire/v1/delete_job_requirement_sample.py | 80 +++---- samples/api/hire/v1/delete_note_sample.py | 80 +++---- .../v1/delete_tripartite_agreement_sample.py | 80 +++---- .../hire/v1/delete_website_channel_sample.py | 84 +++---- samples/api/hire/v1/get_agency_sample.py | 84 +++---- samples/api/hire/v1/get_application_sample.py | 88 +++---- samples/api/hire/v1/get_attachment_sample.py | 84 +++---- .../v1/get_by_application_employee_sample.py | 100 ++++---- .../v1/get_by_application_referral_sample.py | 84 +++---- .../hire/v1/get_by_talent_interview_sample.py | 88 +++---- samples/api/hire/v1/get_employee_sample.py | 100 ++++---- .../get_interview_record_attachment_sample.py | 88 +++---- .../hire/v1/get_interview_record_sample.py | 84 +++---- samples/api/hire/v1/get_job_manager_sample.py | 88 +++---- samples/api/hire/v1/get_job_sample.py | 96 ++++---- samples/api/hire/v1/get_note_sample.py | 84 +++---- .../v1/get_offer_application_form_sample.py | 80 +++---- samples/api/hire/v1/get_offer_sample.py | 100 ++++---- .../api/hire/v1/get_offer_schema_sample.py | 80 +++---- .../get_referral_website_job_post_sample.py | 92 +++---- samples/api/hire/v1/get_role_sample.py | 80 +++---- samples/api/hire/v1/get_talent_sample.py | 84 +++---- .../v1/get_website_delivery_task_sample.py | 84 +++---- .../hire/v1/get_website_job_post_sample.py | 96 ++++---- .../v1/intern_offer_status_offer_sample.py | 100 ++++---- .../v1/list_application_interview_sample.py | 96 ++++---- .../api/hire/v1/list_application_sample.py | 114 ++++----- .../v1/list_background_check_order_sample.py | 100 ++++---- .../v1/list_by_id_job_requirement_sample.py | 108 ++++----- samples/api/hire/v1/list_evaluation_sample.py | 100 ++++---- .../hire/v1/list_evaluation_task_sample.py | 96 ++++---- .../hire/v1/list_exam_marking_task_sample.py | 96 ++++---- .../v1/list_external_application_sample.py | 88 +++---- .../v1/list_interview_feedback_form_sample.py | 88 +++---- .../hire/v1/list_interview_record_sample.py | 92 +++---- ...st_interview_registration_schema_sample.py | 85 ++++--- .../v1/list_interview_round_type_sample.py | 80 +++---- samples/api/hire/v1/list_interview_sample.py | 108 ++++----- .../api/hire/v1/list_interview_task_sample.py | 96 ++++---- .../api/hire/v1/list_job_function_sample.py | 84 +++---- .../api/hire/v1/list_job_process_sample.py | 84 +++---- .../hire/v1/list_job_requirement_sample.py | 124 +++++----- .../v1/list_job_requirement_schema_sample.py | 84 +++---- samples/api/hire/v1/list_job_sample.py | 108 ++++----- samples/api/hire/v1/list_job_schema_sample.py | 88 +++---- samples/api/hire/v1/list_job_type_sample.py | 84 +++---- samples/api/hire/v1/list_location_sample.py | 88 +++---- samples/api/hire/v1/list_note_sample.py | 92 +++---- .../v1/list_offer_application_form_sample.py | 84 +++---- samples/api/hire/v1/list_offer_sample.py | 96 ++++---- .../api/hire/v1/list_questionnaire_sample.py | 100 ++++---- .../list_referral_website_job_post_sample.py | 100 ++++---- .../v1/list_registration_schema_sample.py | 88 +++---- .../api/hire/v1/list_resume_source_sample.py | 84 +++---- samples/api/hire/v1/list_role_sample.py | 84 +++---- samples/api/hire/v1/list_subject_sample.py | 92 +++---- .../api/hire/v1/list_talent_folder_sample.py | 88 +++---- samples/api/hire/v1/list_talent_sample.py | 104 ++++---- .../hire/v1/list_termination_reason_sample.py | 84 +++---- samples/api/hire/v1/list_todo_sample.py | 96 ++++---- .../v1/list_tripartite_agreement_sample.py | 92 +++---- .../hire/v1/list_website_channel_sample.py | 88 +++---- .../hire/v1/list_website_job_post_sample.py | 116 ++++----- samples/api/hire/v1/list_website_sample.py | 84 +++---- .../api/hire/v1/login_info_eco_exam_sample.py | 100 ++++---- .../hire/v1/move_talent_talent_pool_sample.py | 96 ++++---- .../api/hire/v1/offer_application_sample.py | 100 ++++---- .../api/hire/v1/offer_status_offer_sample.py | 104 ++++---- .../hire/v1/onboard_status_talent_sample.py | 100 ++++---- samples/api/hire/v1/open_job_sample.py | 96 ++++---- .../hire/v1/patch_ehr_import_task_sample.py | 100 ++++---- samples/api/hire/v1/patch_employee_sample.py | 120 +++++----- ...ch_external_interview_assessment_sample.py | 105 ++++---- samples/api/hire/v1/patch_note_sample.py | 108 ++++----- .../api/hire/v1/preview_attachment_sample.py | 80 +++---- samples/api/hire/v1/protect_agency_sample.py | 120 +++++----- .../hire/v1/protect_search_agency_sample.py | 88 +++---- .../hire/v1/publish_advertisement_sample.py | 92 +++---- samples/api/hire/v1/query_agency_sample.py | 84 +++---- samples/api/hire/v1/query_location_sample.py | 100 ++++---- .../api/hire/v1/query_talent_object_sample.py | 76 +++--- .../reconciliation_referral_account_sample.py | 96 ++++---- .../api/hire/v1/recover_application_sample.py | 80 +++---- samples/api/hire/v1/recruiter_job_sample.py | 84 +++---- .../v1/search_diversity_inclusion_sample.py | 92 +++---- .../v1/search_job_publish_record_sample.py | 112 ++++----- samples/api/hire/v1/search_referral_sample.py | 100 ++++---- .../v1/search_talent_operation_log_sample.py | 108 ++++----- .../api/hire/v1/search_talent_pool_sample.py | 88 +++---- samples/api/hire/v1/search_test_sample.py | 108 ++++----- .../hire/v1/search_website_job_post_sample.py | 144 +++++------ .../hire/v1/terminate_application_sample.py | 100 ++++---- .../v1/transfer_onboard_application_sample.py | 148 ++++++------ .../v1/transfer_stage_application_sample.py | 92 +++---- .../api/hire/v1/update_config_job_sample.py | 140 +++++------ .../v1/update_external_application_sample.py | 132 +++++------ .../hire/v1/update_job_requirement_sample.py | 204 ++++++++-------- .../v1/update_offer_custom_field_sample.py | 96 ++++---- samples/api/hire/v1/update_offer_sample.py | 124 +++++----- ...te_progress_eco_background_check_sample.py | 113 +++++---- ...date_result_eco_background_check_sample.py | 100 ++++---- .../hire/v1/update_result_eco_exam_sample.py | 104 ++++---- .../v1/update_talent_external_info_sample.py | 92 +++---- .../v1/update_tripartite_agreement_sample.py | 96 ++++---- .../hire/v1/update_website_channel_sample.py | 96 ++++---- .../v1/withdraw_referral_account_sample.py | 96 ++++---- .../v1/create_identity_sample.py | 104 ++++---- .../v1/add_managers_chat_managers_sample.py | 96 ++++---- .../api/im/v1/create_chat_members_sample.py | 100 ++++---- .../api/im/v1/create_chat_menu_tree_sample.py | 92 +++---- samples/api/im/v1/create_chat_sample.py | 168 ++++++------- samples/api/im/v1/create_chat_tab_sample.py | 92 +++---- samples/api/im/v1/create_file_sample.py | 104 ++++---- samples/api/im/v1/create_image_sample.py | 96 ++++---- .../im/v1/create_message_reaction_sample.py | 92 +++---- samples/api/im/v1/create_message_sample.py | 104 ++++---- samples/api/im/v1/create_pin_sample.py | 88 +++---- .../api/im/v1/delete_batch_message_sample.py | 80 +++---- .../api/im/v1/delete_chat_members_sample.py | 96 ++++---- .../api/im/v1/delete_chat_menu_tree_sample.py | 92 +++---- samples/api/im/v1/delete_chat_sample.py | 80 +++---- .../delete_managers_chat_managers_sample.py | 96 ++++---- .../im/v1/delete_message_reaction_sample.py | 84 +++---- samples/api/im/v1/delete_message_sample.py | 80 +++---- samples/api/im/v1/delete_pin_sample.py | 80 +++---- .../api/im/v1/delete_tabs_chat_tab_sample.py | 92 +++---- ...elete_top_notice_chat_top_notice_sample.py | 80 +++---- samples/api/im/v1/forward_message_sample.py | 100 ++++---- samples/api/im/v1/forward_thread_sample.py | 100 ++++---- .../api/im/v1/get_chat_announcement_sample.py | 84 +++---- samples/api/im/v1/get_chat_members_sample.py | 92 +++---- .../api/im/v1/get_chat_menu_tree_sample.py | 80 +++---- .../api/im/v1/get_chat_moderation_sample.py | 92 +++---- samples/api/im/v1/get_chat_sample.py | 84 +++---- samples/api/im/v1/get_file_sample.py | 88 +++---- samples/api/im/v1/get_image_sample.py | 88 +++---- .../api/im/v1/get_message_resource_sample.py | 96 ++++---- samples/api/im/v1/get_message_sample.py | 84 +++---- .../v1/get_progress_batch_message_sample.py | 80 +++---- .../im/v1/is_in_chat_chat_members_sample.py | 80 +++---- samples/api/im/v1/link_chat_sample.py | 92 +++---- samples/api/im/v1/list_chat_sample.py | 92 +++---- .../api/im/v1/list_message_reaction_sample.py | 96 ++++---- samples/api/im/v1/list_message_sample.py | 104 ++++---- samples/api/im/v1/list_pin_sample.py | 96 ++++---- .../api/im/v1/list_tabs_chat_tab_sample.py | 80 +++---- .../api/im/v1/me_join_chat_members_sample.py | 80 +++---- .../api/im/v1/merge_forward_message_sample.py | 100 ++++---- .../im/v1/patch_chat_announcement_sample.py | 96 ++++---- .../api/im/v1/patch_chat_menu_item_sample.py | 100 ++++---- samples/api/im/v1/patch_message_sample.py | 92 +++---- .../im/v1/push_follow_up_message_sample.py | 92 +++---- .../put_top_notice_chat_top_notice_sample.py | 92 +++---- .../im/v1/read_user_batch_message_sample.py | 80 +++---- .../api/im/v1/read_users_message_sample.py | 92 +++---- samples/api/im/v1/reply_message_sample.py | 104 ++++---- samples/api/im/v1/search_chat_sample.py | 92 +++---- .../api/im/v1/sort_chat_menu_tree_sample.py | 92 +++---- .../api/im/v1/sort_tabs_chat_tab_sample.py | 92 +++---- .../im/v1/update_chat_moderation_sample.py | 104 ++++---- samples/api/im/v1/update_chat_sample.py | 164 ++++++------- samples/api/im/v1/update_message_sample.py | 96 ++++---- .../api/im/v1/update_tabs_chat_tab_sample.py | 92 +++---- .../api/im/v1/urgent_app_message_sample.py | 96 ++++---- .../api/im/v1/urgent_phone_message_sample.py | 96 ++++---- .../api/im/v1/urgent_sms_message_sample.py | 96 ++++---- .../im/v2/batch_update_url_preview_sample.py | 92 +++---- .../api/im/v2/create_app_feed_card_sample.py | 96 ++++---- .../create_biz_entity_tag_relation_sample.py | 96 ++++---- samples/api/im/v2/create_tag_sample.py | 88 +++---- .../v2/delete_app_feed_card_batch_sample.py | 92 +++---- .../v2/get_biz_entity_tag_relation_sample.py | 84 +++---- samples/api/im/v2/patch_feed_card_sample.py | 100 ++++---- samples/api/im/v2/patch_tag_sample.py | 92 +++---- .../v2/update_app_feed_card_batch_sample.py | 92 +++---- .../update_biz_entity_tag_relation_sample.py | 96 ++++---- .../api/im/v2/update_chat_button_sample.py | 100 ++++---- samples/api/lingo/v1/create_draft_sample.py | 126 +++++----- samples/api/lingo/v1/create_entity_sample.py | 122 +++++----- samples/api/lingo/v1/delete_entity_sample.py | 88 +++---- samples/api/lingo/v1/download_file_sample.py | 88 +++---- samples/api/lingo/v1/get_entity_sample.py | 92 +++---- .../api/lingo/v1/highlight_entity_sample.py | 88 +++---- .../lingo/v1/list_classification_sample.py | 88 +++---- samples/api/lingo/v1/list_entity_sample.py | 96 ++++---- samples/api/lingo/v1/list_repo_sample.py | 76 +++--- samples/api/lingo/v1/match_entity_sample.py | 92 +++---- samples/api/lingo/v1/search_entity_sample.py | 116 ++++----- samples/api/lingo/v1/update_draft_sample.py | 122 +++++----- samples/api/lingo/v1/update_entity_sample.py | 122 +++++----- samples/api/lingo/v1/upload_file_sample.py | 96 ++++---- .../batch_create_mailgroup_manager_sample.py | 96 ++++---- .../batch_create_mailgroup_member_sample.py | 100 ++++---- ...eate_mailgroup_permission_member_sample.py | 102 ++++---- ...tch_create_public_mailbox_member_sample.py | 96 ++++---- .../batch_delete_mailgroup_manager_sample.py | 96 ++++---- .../batch_delete_mailgroup_member_sample.py | 92 +++---- ...lete_mailgroup_permission_member_sample.py | 94 ++++---- ...tch_delete_public_mailbox_member_sample.py | 92 +++---- .../v1/clear_public_mailbox_member_sample.py | 80 +++---- .../mail/v1/create_mailgroup_alias_sample.py | 92 +++---- .../mail/v1/create_mailgroup_member_sample.py | 112 ++++----- ...eate_mailgroup_permission_member_sample.py | 113 +++++---- .../api/mail/v1/create_mailgroup_sample.py | 100 ++++---- .../v1/create_public_mailbox_alias_sample.py | 92 +++---- .../v1/create_public_mailbox_member_sample.py | 100 ++++---- .../mail/v1/create_public_mailbox_sample.py | 96 ++++---- .../v1/create_user_mailbox_alias_sample.py | 92 +++---- .../mail/v1/delete_mailgroup_alias_sample.py | 84 +++---- .../mail/v1/delete_mailgroup_member_sample.py | 84 +++---- ...lete_mailgroup_permission_member_sample.py | 85 ++++--- .../api/mail/v1/delete_mailgroup_sample.py | 80 +++---- .../v1/delete_public_mailbox_alias_sample.py | 84 +++---- .../v1/delete_public_mailbox_member_sample.py | 84 +++---- .../mail/v1/delete_public_mailbox_sample.py | 80 +++---- .../v1/delete_user_mailbox_alias_sample.py | 84 +++---- .../api/mail/v1/delete_user_mailbox_sample.py | 84 +++---- .../mail/v1/get_mailgroup_member_sample.py | 92 +++---- .../get_mailgroup_permission_member_sample.py | 92 +++---- samples/api/mail/v1/get_mailgroup_sample.py | 80 +++---- .../v1/get_public_mailbox_member_sample.py | 88 +++---- .../api/mail/v1/get_public_mailbox_sample.py | 80 +++---- .../mail/v1/list_mailgroup_alias_sample.py | 80 +++---- .../mail/v1/list_mailgroup_manager_sample.py | 92 +++---- .../mail/v1/list_mailgroup_member_sample.py | 96 ++++---- ...list_mailgroup_permission_member_sample.py | 96 ++++---- samples/api/mail/v1/list_mailgroup_sample.py | 92 +++---- .../v1/list_public_mailbox_alias_sample.py | 80 +++---- .../v1/list_public_mailbox_member_sample.py | 92 +++---- .../api/mail/v1/list_public_mailbox_sample.py | 84 +++---- .../mail/v1/list_user_mailbox_alias_sample.py | 88 +++---- samples/api/mail/v1/patch_mailgroup_sample.py | 104 ++++---- .../mail/v1/patch_public_mailbox_sample.py | 96 ++++---- samples/api/mail/v1/query_user_sample.py | 88 +++---- .../api/mail/v1/update_mailgroup_sample.py | 104 ++++---- .../mail/v1/update_public_mailbox_sample.py | 96 ++++---- .../v1/bind_user_auth_data_relation_sample.py | 104 ++++---- .../unbind_user_auth_data_relation_sample.py | 104 ++++---- samples/api/okr/v1/batch_get_okr_sample.py | 88 +++---- samples/api/okr/v1/create_period_sample.py | 92 +++---- .../okr/v1/create_progress_record_sample.py | 116 ++++----- .../okr/v1/delete_progress_record_sample.py | 80 +++---- .../api/okr/v1/get_progress_record_sample.py | 84 +++---- samples/api/okr/v1/list_period_rule_sample.py | 76 +++--- samples/api/okr/v1/list_period_sample.py | 84 +++---- samples/api/okr/v1/list_user_okr_sample.py | 100 ++++---- samples/api/okr/v1/patch_period_sample.py | 92 +++---- samples/api/okr/v1/query_review_sample.py | 88 +++---- .../okr/v1/update_progress_record_sample.py | 96 ++++---- samples/api/okr/v1/upload_image_sample.py | 100 ++++---- .../v1/basic_recognize_image_sample.py | 88 +++---- .../api/passport/v1/query_session_sample.py | 92 +++---- .../v1/batch_close_system_status_sample.py | 96 ++++---- .../v1/batch_open_system_status_sample.py | 96 ++++---- .../v1/create_system_status_sample.py | 108 ++++----- .../v1/delete_system_status_sample.py | 80 +++---- .../v1/list_system_status_sample.py | 84 +++---- .../v1/patch_system_status_sample.py | 96 ++++---- samples/api/report/v1/query_rule_sample.py | 88 +++---- samples/api/report/v1/query_task_sample.py | 112 ++++----- .../api/report/v1/remove_rule_view_sample.py | 96 ++++---- samples/api/search/v2/create_app_sample.py | 100 ++++---- .../v2/create_data_source_item_sample.py | 108 ++++----- .../search/v2/create_data_source_sample.py | 138 ++++++----- .../api/search/v2/create_message_sample.py | 132 +++++------ samples/api/search/v2/create_schema_sample.py | 100 ++++---- .../v2/delete_data_source_item_sample.py | 84 +++---- .../search/v2/delete_data_source_sample.py | 80 +++---- samples/api/search/v2/delete_schema_sample.py | 80 +++---- .../search/v2/get_data_source_item_sample.py | 84 +++---- .../api/search/v2/get_data_source_sample.py | 80 +++---- samples/api/search/v2/get_schema_sample.py | 80 +++---- .../api/search/v2/list_data_source_sample.py | 88 +++---- .../api/search/v2/patch_data_source_sample.py | 120 +++++----- samples/api/search/v2/patch_schema_sample.py | 96 ++++---- .../v1/list_data_openapi_log_sample.py | 108 ++++----- .../sheets/v3/create_spreadsheet_sample.py | 92 +++---- .../create_spreadsheet_sheet_filter_sample.py | 104 ++++---- ...heet_sheet_filter_view_condition_sample.py | 114 +++++---- ...te_spreadsheet_sheet_filter_view_sample.py | 105 ++++---- ...te_spreadsheet_sheet_float_image_sample.py | 121 +++++----- .../delete_spreadsheet_sheet_filter_sample.py | 84 +++---- ...heet_sheet_filter_view_condition_sample.py | 94 ++++---- ...te_spreadsheet_sheet_filter_view_sample.py | 89 ++++--- ...te_spreadsheet_sheet_float_image_sample.py | 89 ++++--- .../v3/find_spreadsheet_sheet_sample.py | 100 ++++---- .../api/sheets/v3/get_spreadsheet_sample.py | 84 +++---- .../v3/get_spreadsheet_sheet_filter_sample.py | 84 +++---- ...heet_sheet_filter_view_condition_sample.py | 94 ++++---- ...et_spreadsheet_sheet_filter_view_sample.py | 88 +++---- ...et_spreadsheet_sheet_float_image_sample.py | 88 +++---- .../sheets/v3/get_spreadsheet_sheet_sample.py | 84 +++---- ...move_dimension_spreadsheet_sheet_sample.py | 100 ++++---- .../api/sheets/v3/patch_spreadsheet_sample.py | 92 +++---- ...ch_spreadsheet_sheet_filter_view_sample.py | 105 ++++---- ...ch_spreadsheet_sheet_float_image_sample.py | 121 +++++----- ...heet_sheet_filter_view_condition_sample.py | 90 ++++--- ...ry_spreadsheet_sheet_filter_view_sample.py | 85 ++++--- ...ry_spreadsheet_sheet_float_image_sample.py | 85 ++++--- .../v3/query_spreadsheet_sheet_sample.py | 80 +++---- .../v3/replace_spreadsheet_sheet_sample.py | 104 ++++---- .../update_spreadsheet_sheet_filter_sample.py | 100 ++++---- ...heet_sheet_filter_view_condition_sample.py | 114 +++++---- .../v1/file_recognize_speech_sample.py | 92 +++---- .../v1/stream_recognize_speech_sample.py | 92 +++---- .../batch_delete_collaborator_task_sample.py | 96 ++++---- .../v1/batch_delete_follower_task_sample.py | 96 ++++---- samples/api/task/v1/complete_task_sample.py | 80 +++---- .../v1/create_task_collaborator_sample.py | 100 ++++---- .../api/task/v1/create_task_comment_sample.py | 108 ++++----- .../task/v1/create_task_follower_sample.py | 100 ++++---- .../task/v1/create_task_reminder_sample.py | 92 +++---- samples/api/task/v1/create_task_sample.py | 136 +++++------ .../v1/delete_task_collaborator_sample.py | 88 +++---- .../api/task/v1/delete_task_comment_sample.py | 84 +++---- .../task/v1/delete_task_follower_sample.py | 88 +++---- .../task/v1/delete_task_reminder_sample.py | 84 +++---- samples/api/task/v1/delete_task_sample.py | 80 +++---- .../api/task/v1/get_task_comment_sample.py | 88 +++---- samples/api/task/v1/get_task_sample.py | 84 +++---- .../task/v1/list_task_collaborator_sample.py | 92 +++---- .../api/task/v1/list_task_comment_sample.py | 96 ++++---- .../api/task/v1/list_task_follower_sample.py | 92 +++---- .../api/task/v1/list_task_reminder_sample.py | 88 +++---- samples/api/task/v1/list_task_sample.py | 100 ++++---- samples/api/task/v1/patch_task_sample.py | 100 ++++---- samples/api/task/v1/uncomplete_task_sample.py | 80 +++---- .../api/task/v1/update_task_comment_sample.py | 104 ++++---- .../api/task/v2/add_custom_field_sample.py | 96 ++++---- .../task/v2/add_dependencies_task_sample.py | 92 +++---- .../api/task/v2/add_members_task_sample.py | 100 ++++---- .../task/v2/add_members_tasklist_sample.py | 96 ++++---- .../api/task/v2/add_reminders_task_sample.py | 96 ++++---- .../api/task/v2/add_tasklist_task_sample.py | 100 ++++---- samples/api/task/v2/create_comment_sample.py | 104 ++++---- .../v2/create_custom_field_option_sample.py | 108 ++++----- .../api/task/v2/create_custom_field_sample.py | 128 +++++----- samples/api/task/v2/create_section_sample.py | 108 ++++----- samples/api/task/v2/create_task_sample.py | 156 ++++++------ .../api/task/v2/create_task_subtask_sample.py | 160 ++++++------- ...e_tasklist_activity_subscription_sample.py | 109 +++++---- samples/api/task/v2/create_tasklist_sample.py | 96 ++++---- .../api/task/v2/delete_attachment_sample.py | 80 +++---- samples/api/task/v2/delete_comment_sample.py | 80 +++---- samples/api/task/v2/delete_section_sample.py | 80 +++---- samples/api/task/v2/delete_task_sample.py | 80 +++---- ...e_tasklist_activity_subscription_sample.py | 85 ++++--- samples/api/task/v2/delete_tasklist_sample.py | 80 +++---- samples/api/task/v2/get_attachment_sample.py | 84 +++---- samples/api/task/v2/get_comment_sample.py | 84 +++---- .../api/task/v2/get_custom_field_sample.py | 84 +++---- samples/api/task/v2/get_section_sample.py | 84 +++---- samples/api/task/v2/get_task_sample.py | 84 +++---- ...t_tasklist_activity_subscription_sample.py | 89 ++++--- samples/api/task/v2/get_tasklist_sample.py | 84 +++---- samples/api/task/v2/list_attachment_sample.py | 96 ++++---- samples/api/task/v2/list_comment_sample.py | 100 ++++---- .../api/task/v2/list_custom_field_sample.py | 96 ++++---- samples/api/task/v2/list_section_sample.py | 96 ++++---- samples/api/task/v2/list_task_sample.py | 96 ++++---- .../api/task/v2/list_task_subtask_sample.py | 92 +++---- ...t_tasklist_activity_subscription_sample.py | 89 ++++--- samples/api/task/v2/list_tasklist_sample.py | 88 +++---- samples/api/task/v2/patch_comment_sample.py | 100 ++++---- .../v2/patch_custom_field_option_sample.py | 100 ++++---- .../api/task/v2/patch_custom_field_sample.py | 100 ++++---- samples/api/task/v2/patch_section_sample.py | 100 ++++---- samples/api/task/v2/patch_task_sample.py | 100 ++++---- ...h_tasklist_activity_subscription_sample.py | 105 ++++---- samples/api/task/v2/patch_tasklist_sample.py | 104 ++++---- .../api/task/v2/remove_custom_field_sample.py | 96 ++++---- .../v2/remove_dependencies_task_sample.py | 92 +++---- .../api/task/v2/remove_members_task_sample.py | 96 ++++---- .../task/v2/remove_members_tasklist_sample.py | 96 ++++---- .../task/v2/remove_reminders_task_sample.py | 96 ++++---- .../task/v2/remove_tasklist_task_sample.py | 96 ++++---- samples/api/task/v2/tasklists_task_sample.py | 80 +++---- samples/api/task/v2/tasks_section_sample.py | 104 ++++---- samples/api/task/v2/tasks_tasklist_sample.py | 104 ++++---- .../api/task/v2/upload_attachment_sample.py | 104 ++++---- ...query_tenant_product_assign_info_sample.py | 76 +++--- samples/api/tenant/v2/query_tenant_sample.py | 76 +++--- .../api/translation/v1/detect_text_sample.py | 88 +++---- .../translation/v1/translate_text_sample.py | 100 ++++---- samples/api/vc/v1/apply_reserve_sample.py | 100 ++++---- samples/api/vc/v1/create_room_level_sample.py | 96 ++++---- samples/api/vc/v1/create_room_sample.py | 116 ++++----- .../api/vc/v1/create_scope_config_sample.py | 100 ++++---- samples/api/vc/v1/del__room_level_sample.py | 92 +++---- samples/api/vc/v1/delete_reserve_sample.py | 80 +++---- samples/api/vc/v1/delete_room_sample.py | 80 +++---- samples/api/vc/v1/download_export_sample.py | 88 +++---- samples/api/vc/v1/end_meeting_sample.py | 80 +++---- .../v1/get_active_meeting_reserve_sample.py | 88 +++---- samples/api/vc/v1/get_daily_report_sample.py | 88 +++---- samples/api/vc/v1/get_export_sample.py | 80 +++---- samples/api/vc/v1/get_meeting_list_sample.py | 116 ++++----- .../api/vc/v1/get_meeting_recording_sample.py | 80 +++---- samples/api/vc/v1/get_meeting_sample.py | 92 +++---- .../api/vc/v1/get_participant_list_sample.py | 112 ++++----- .../v1/get_participant_quality_list_sample.py | 112 ++++----- .../vc/v1/get_reserve_config_admin_sample.py | 88 +++---- ...et_reserve_config_disable_inform_sample.py | 88 +++---- .../vc/v1/get_reserve_config_form_sample.py | 88 +++---- samples/api/vc/v1/get_reserve_sample.py | 84 +++---- .../get_resource_reservation_list_sample.py | 108 ++++----- samples/api/vc/v1/get_room_level_sample.py | 80 +++---- samples/api/vc/v1/get_room_sample.py | 84 +++---- samples/api/vc/v1/get_scope_config_sample.py | 88 +++---- .../api/vc/v1/get_top_user_report_sample.py | 100 ++++---- samples/api/vc/v1/invite_meeting_sample.py | 96 ++++---- samples/api/vc/v1/kickout_meeting_sample.py | 96 ++++---- samples/api/vc/v1/list_alert_sample.py | 100 ++++---- .../api/vc/v1/list_by_no_meeting_sample.py | 96 ++++---- samples/api/vc/v1/list_room_level_sample.py | 88 +++---- samples/api/vc/v1/list_room_sample.py | 92 +++---- .../api/vc/v1/meeting_list_export_sample.py | 116 ++++----- samples/api/vc/v1/mget_room_level_sample.py | 88 +++---- samples/api/vc/v1/mget_room_sample.py | 92 +++---- .../vc/v1/participant_list_export_sample.py | 112 ++++----- .../participant_quality_list_export_sample.py | 112 ++++----- .../v1/patch_reserve_config_admin_sample.py | 100 ++++---- ...ch_reserve_config_disable_inform_sample.py | 100 ++++---- .../vc/v1/patch_reserve_config_form_sample.py | 100 ++++---- .../api/vc/v1/patch_reserve_config_sample.py | 108 ++++----- samples/api/vc/v1/patch_room_level_sample.py | 100 ++++---- samples/api/vc/v1/patch_room_sample.py | 120 +++++----- samples/api/vc/v1/query_room_config_sample.py | 104 ++++---- .../v1/reserve_scope_reserve_config_sample.py | 88 +++---- ...resource_reservation_list_export_sample.py | 108 ++++----- samples/api/vc/v1/search_room_level_sample.py | 80 +++---- samples/api/vc/v1/search_room_sample.py | 112 ++++----- ...eckboard_access_code_room_config_sample.py | 113 +++++---- samples/api/vc/v1/set_host_meeting_sample.py | 100 ++++---- ...set_permission_meeting_recording_sample.py | 100 ++++---- ...set_room_access_code_room_config_sample.py | 112 ++++----- samples/api/vc/v1/set_room_config_sample.py | 116 ++++----- .../vc/v1/start_meeting_recording_sample.py | 92 +++---- .../vc/v1/stop_meeting_recording_sample.py | 80 +++---- samples/api/vc/v1/update_reserve_sample.py | 100 ++++---- .../v1/get_verification_sample.py | 76 +++--- samples/api/wiki/v2/copy_space_node_sample.py | 104 ++++---- .../api/wiki/v2/create_space_member_sample.py | 104 ++++---- .../api/wiki/v2/create_space_node_sample.py | 108 ++++----- samples/api/wiki/v2/create_space_sample.py | 96 ++++---- .../api/wiki/v2/delete_space_member_sample.py | 104 ++++---- samples/api/wiki/v2/get_node_space_sample.py | 84 +++---- samples/api/wiki/v2/get_space_sample.py | 84 +++---- samples/api/wiki/v2/get_task_sample.py | 84 +++---- .../api/wiki/v2/list_space_member_sample.py | 88 +++---- samples/api/wiki/v2/list_space_node_sample.py | 92 +++---- samples/api/wiki/v2/list_space_sample.py | 88 +++---- .../v2/move_docs_to_wiki_space_node_sample.py | 104 ++++---- samples/api/wiki/v2/move_space_node_sample.py | 100 ++++---- .../wiki/v2/update_space_setting_sample.py | 100 ++++---- .../wiki/v2/update_title_space_node_sample.py | 96 ++++---- ...rch_custom_workplace_access_data_sample.py | 97 ++++---- .../v1/search_workplace_access_data_sample.py | 92 +++---- ...arch_workplace_block_access_data_sample.py | 97 ++++---- 1153 files changed, 56093 insertions(+), 55055 deletions(-) create mode 100644 lark_oapi/api/compensation/v1/model/social_archive.py create mode 100644 lark_oapi/api/compensation/v1/model/social_archive_adjust_record.py create mode 100644 lark_oapi/api/compensation/v1/model/social_archive_detail.py create mode 100644 lark_oapi/api/compensation/v1/model/social_archive_item.py create mode 100644 lark_oapi/api/compensation/v1/model/social_insurance.py create mode 100644 lark_oapi/api/compensation/v1/model/social_plan.py create mode 100644 lark_oapi/api/compensation/v1/model/social_plan_item_detail.py create mode 100644 lark_oapi/api/compensation/v1/model/social_plan_item_setting.py create mode 100644 lark_oapi/api/compensation/v1/model/social_plan_scope.py create mode 100644 lark_oapi/api/corehr/v1/model/calendar_date_by_date_filter.py create mode 100644 lark_oapi/api/corehr/v1/model/wk_calendar_date.py create mode 100644 lark_oapi/api/corehr/v2/model/department_tree.py create mode 100644 lark_oapi/api/corehr/v2/model/tree_department_request.py create mode 100644 lark_oapi/api/corehr/v2/model/tree_department_request_body.py create mode 100644 lark_oapi/api/corehr/v2/model/tree_department_response.py create mode 100644 lark_oapi/api/corehr/v2/model/tree_department_response_body.py create mode 100644 lark_oapi/api/hire/v1/model/external_common_attachment.py create mode 100644 lark_oapi/api/hire/v1/model/external_offer.py create mode 100644 samples/api/corehr/v2/tree_department_sample.py diff --git a/lark_oapi/api/__init__.py b/lark_oapi/api/__init__.py index 8d60a99e1..3bebb8b53 100644 --- a/lark_oapi/api/__init__.py +++ b/lark_oapi/api/__init__.py @@ -1,46 +1,46 @@ -from . import human_authentication -from . import mail -from . import corehr -from . import helpdesk -from . import okr -from . import attendance -from . import auth -from . import contact -from . import event -from . import gray_test_open_sg -from . import im -from . import personal_settings -from . import report -from . import aily -from . import drive -from . import ehr -from . import search -from . import speech_to_text -from . import sheets -from . import verification -from . import calendar -from . import compensation -from . import lingo from . import tenant from . import translation -from . import wiki +from . import compensation +from . import ehr +from . import task +from . import block +from . import okr +from . import report from . import document_ai from . import docx +from . import drive from . import hire -from . import meeting_room +from . import mdm +from . import attendance +from . import bitable +from . import corehr +from . import personal_settings +from . import wiki from . import vc -from . import application -from . import authen +from . import acs +from . import im +from . import lingo +from . import passport +from . import search +from . import sheets +from . import aily from . import baike +from . import optical_char_recognition +from . import speech_to_text from . import workplace -from . import block +from . import calendar +from . import helpdesk +from . import mail from . import board -from . import task -from . import acs -from . import approval -from . import bitable -from . import passport -from . import security_and_compliance +from . import gray_test_open_sg +from . import human_authentication +from . import meeting_room +from . import verification from . import admin -from . import mdm -from . import optical_char_recognition +from . import auth +from . import authen +from . import event +from . import security_and_compliance +from . import application +from . import approval +from . import contact diff --git a/lark_oapi/api/compensation/v1/model/__init__.py b/lark_oapi/api/compensation/v1/model/__init__.py index 87a4c1c67..ebfcf65c3 100644 --- a/lark_oapi/api/compensation/v1/model/__init__.py +++ b/lark_oapi/api/compensation/v1/model/__init__.py @@ -18,6 +18,15 @@ from .plan_indicator import * from .plan_item import * from .plan_scope import * +from .social_archive import * +from .social_archive_adjust_record import * +from .social_archive_detail import * +from .social_archive_item import * +from .social_insurance import * +from .social_plan import * +from .social_plan_item_detail import * +from .social_plan_item_setting import * +from .social_plan_scope import * from .query_archive_request_body import * from .query_archive_request import * from .list_change_reason_request import * diff --git a/lark_oapi/api/compensation/v1/model/social_archive.py b/lark_oapi/api/compensation/v1/model/social_archive.py new file mode 100644 index 000000000..37e0b0bd1 --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_archive.py @@ -0,0 +1,37 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .social_archive_detail import SocialArchiveDetail + + +class SocialArchive(object): + _types = { + "user_id": str, + "details": List[SocialArchiveDetail], + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.details: Optional[List[SocialArchiveDetail]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialArchiveBuilder": + return SocialArchiveBuilder() + + +class SocialArchiveBuilder(object): + def __init__(self) -> None: + self._social_archive = SocialArchive() + + def user_id(self, user_id: str) -> "SocialArchiveBuilder": + self._social_archive.user_id = user_id + return self + + def details(self, details: List[SocialArchiveDetail]) -> "SocialArchiveBuilder": + self._social_archive.details = details + return self + + def build(self) -> "SocialArchive": + return self._social_archive diff --git a/lark_oapi/api/compensation/v1/model/social_archive_adjust_record.py b/lark_oapi/api/compensation/v1/model/social_archive_adjust_record.py new file mode 100644 index 000000000..af30e1e49 --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_archive_adjust_record.py @@ -0,0 +1,43 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .social_archive_detail import SocialArchiveDetail + + +class SocialArchiveAdjustRecord(object): + _types = { + "user_id": str, + "record_type": str, + "details": SocialArchiveDetail, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.record_type: Optional[str] = None + self.details: Optional[SocialArchiveDetail] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialArchiveAdjustRecordBuilder": + return SocialArchiveAdjustRecordBuilder() + + +class SocialArchiveAdjustRecordBuilder(object): + def __init__(self) -> None: + self._social_archive_adjust_record = SocialArchiveAdjustRecord() + + def user_id(self, user_id: str) -> "SocialArchiveAdjustRecordBuilder": + self._social_archive_adjust_record.user_id = user_id + return self + + def record_type(self, record_type: str) -> "SocialArchiveAdjustRecordBuilder": + self._social_archive_adjust_record.record_type = record_type + return self + + def details(self, details: SocialArchiveDetail) -> "SocialArchiveAdjustRecordBuilder": + self._social_archive_adjust_record.details = details + return self + + def build(self) -> "SocialArchiveAdjustRecord": + return self._social_archive_adjust_record diff --git a/lark_oapi/api/compensation/v1/model/social_archive_detail.py b/lark_oapi/api/compensation/v1/model/social_archive_detail.py new file mode 100644 index 000000000..cd212c170 --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_archive_detail.py @@ -0,0 +1,110 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .i18n import I18n +from .social_archive_item import SocialArchiveItem + + +class SocialArchiveDetail(object): + _types = { + "description": I18n, + "insurance_type": str, + "insurance_status": str, + "id": str, + "tid": str, + "plan_id": str, + "plan_tid": str, + "location_id": str, + "company_id": str, + "account_type": str, + "insurance_account": str, + "base_salary": str, + "insurance_details": List[SocialArchiveItem], + "effective_date": str, + } + + def __init__(self, d=None): + self.description: Optional[I18n] = None + self.insurance_type: Optional[str] = None + self.insurance_status: Optional[str] = None + self.id: Optional[str] = None + self.tid: Optional[str] = None + self.plan_id: Optional[str] = None + self.plan_tid: Optional[str] = None + self.location_id: Optional[str] = None + self.company_id: Optional[str] = None + self.account_type: Optional[str] = None + self.insurance_account: Optional[str] = None + self.base_salary: Optional[str] = None + self.insurance_details: Optional[List[SocialArchiveItem]] = None + self.effective_date: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialArchiveDetailBuilder": + return SocialArchiveDetailBuilder() + + +class SocialArchiveDetailBuilder(object): + def __init__(self) -> None: + self._social_archive_detail = SocialArchiveDetail() + + def description(self, description: I18n) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.description = description + return self + + def insurance_type(self, insurance_type: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.insurance_type = insurance_type + return self + + def insurance_status(self, insurance_status: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.insurance_status = insurance_status + return self + + def id(self, id: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.id = id + return self + + def tid(self, tid: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.tid = tid + return self + + def plan_id(self, plan_id: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.plan_id = plan_id + return self + + def plan_tid(self, plan_tid: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.plan_tid = plan_tid + return self + + def location_id(self, location_id: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.location_id = location_id + return self + + def company_id(self, company_id: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.company_id = company_id + return self + + def account_type(self, account_type: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.account_type = account_type + return self + + def insurance_account(self, insurance_account: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.insurance_account = insurance_account + return self + + def base_salary(self, base_salary: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.base_salary = base_salary + return self + + def insurance_details(self, insurance_details: List[SocialArchiveItem]) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.insurance_details = insurance_details + return self + + def effective_date(self, effective_date: str) -> "SocialArchiveDetailBuilder": + self._social_archive_detail.effective_date = effective_date + return self + + def build(self) -> "SocialArchiveDetail": + return self._social_archive_detail diff --git a/lark_oapi/api/compensation/v1/model/social_archive_item.py b/lark_oapi/api/compensation/v1/model/social_archive_item.py new file mode 100644 index 000000000..3e9b3e9ce --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_archive_item.py @@ -0,0 +1,75 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .i18n import I18n +from .social_plan_item_setting import SocialPlanItemSetting +from .social_plan_item_setting import SocialPlanItemSetting + + +class SocialArchiveItem(object): + _types = { + "insurance_id": str, + "insurance_name": I18n, + "company_deduction": str, + "company_setting": SocialPlanItemSetting, + "personal_deduction": str, + "personal_setting": SocialPlanItemSetting, + "payment_frequency": str, + "payment_months": List[int], + } + + def __init__(self, d=None): + self.insurance_id: Optional[str] = None + self.insurance_name: Optional[I18n] = None + self.company_deduction: Optional[str] = None + self.company_setting: Optional[SocialPlanItemSetting] = None + self.personal_deduction: Optional[str] = None + self.personal_setting: Optional[SocialPlanItemSetting] = None + self.payment_frequency: Optional[str] = None + self.payment_months: Optional[List[int]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialArchiveItemBuilder": + return SocialArchiveItemBuilder() + + +class SocialArchiveItemBuilder(object): + def __init__(self) -> None: + self._social_archive_item = SocialArchiveItem() + + def insurance_id(self, insurance_id: str) -> "SocialArchiveItemBuilder": + self._social_archive_item.insurance_id = insurance_id + return self + + def insurance_name(self, insurance_name: I18n) -> "SocialArchiveItemBuilder": + self._social_archive_item.insurance_name = insurance_name + return self + + def company_deduction(self, company_deduction: str) -> "SocialArchiveItemBuilder": + self._social_archive_item.company_deduction = company_deduction + return self + + def company_setting(self, company_setting: SocialPlanItemSetting) -> "SocialArchiveItemBuilder": + self._social_archive_item.company_setting = company_setting + return self + + def personal_deduction(self, personal_deduction: str) -> "SocialArchiveItemBuilder": + self._social_archive_item.personal_deduction = personal_deduction + return self + + def personal_setting(self, personal_setting: SocialPlanItemSetting) -> "SocialArchiveItemBuilder": + self._social_archive_item.personal_setting = personal_setting + return self + + def payment_frequency(self, payment_frequency: str) -> "SocialArchiveItemBuilder": + self._social_archive_item.payment_frequency = payment_frequency + return self + + def payment_months(self, payment_months: List[int]) -> "SocialArchiveItemBuilder": + self._social_archive_item.payment_months = payment_months + return self + + def build(self) -> "SocialArchiveItem": + return self._social_archive_item diff --git a/lark_oapi/api/compensation/v1/model/social_insurance.py b/lark_oapi/api/compensation/v1/model/social_insurance.py new file mode 100644 index 000000000..4a4d916df --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_insurance.py @@ -0,0 +1,55 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .i18n import I18n + + +class SocialInsurance(object): + _types = { + "id": str, + "name": I18n, + "insurance_type": str, + "active": bool, + "is_system": bool, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.name: Optional[I18n] = None + self.insurance_type: Optional[str] = None + self.active: Optional[bool] = None + self.is_system: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialInsuranceBuilder": + return SocialInsuranceBuilder() + + +class SocialInsuranceBuilder(object): + def __init__(self) -> None: + self._social_insurance = SocialInsurance() + + def id(self, id: str) -> "SocialInsuranceBuilder": + self._social_insurance.id = id + return self + + def name(self, name: I18n) -> "SocialInsuranceBuilder": + self._social_insurance.name = name + return self + + def insurance_type(self, insurance_type: str) -> "SocialInsuranceBuilder": + self._social_insurance.insurance_type = insurance_type + return self + + def active(self, active: bool) -> "SocialInsuranceBuilder": + self._social_insurance.active = active + return self + + def is_system(self, is_system: bool) -> "SocialInsuranceBuilder": + self._social_insurance.is_system = is_system + return self + + def build(self) -> "SocialInsurance": + return self._social_insurance diff --git a/lark_oapi/api/compensation/v1/model/social_plan.py b/lark_oapi/api/compensation/v1/model/social_plan.py new file mode 100644 index 000000000..4afc1e30b --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_plan.py @@ -0,0 +1,81 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .i18n import I18n +from .social_plan_scope import SocialPlanScope +from .i18n import I18n + + +class SocialPlan(object): + _types = { + "plan_id": str, + "plan_tid": str, + "name": I18n, + "effective_date": str, + "active": bool, + "insurance_type": str, + "scope": SocialPlanScope, + "item_detail": bool, + "remark": I18n, + } + + def __init__(self, d=None): + self.plan_id: Optional[str] = None + self.plan_tid: Optional[str] = None + self.name: Optional[I18n] = None + self.effective_date: Optional[str] = None + self.active: Optional[bool] = None + self.insurance_type: Optional[str] = None + self.scope: Optional[SocialPlanScope] = None + self.item_detail: Optional[bool] = None + self.remark: Optional[I18n] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialPlanBuilder": + return SocialPlanBuilder() + + +class SocialPlanBuilder(object): + def __init__(self) -> None: + self._social_plan = SocialPlan() + + def plan_id(self, plan_id: str) -> "SocialPlanBuilder": + self._social_plan.plan_id = plan_id + return self + + def plan_tid(self, plan_tid: str) -> "SocialPlanBuilder": + self._social_plan.plan_tid = plan_tid + return self + + def name(self, name: I18n) -> "SocialPlanBuilder": + self._social_plan.name = name + return self + + def effective_date(self, effective_date: str) -> "SocialPlanBuilder": + self._social_plan.effective_date = effective_date + return self + + def active(self, active: bool) -> "SocialPlanBuilder": + self._social_plan.active = active + return self + + def insurance_type(self, insurance_type: str) -> "SocialPlanBuilder": + self._social_plan.insurance_type = insurance_type + return self + + def scope(self, scope: SocialPlanScope) -> "SocialPlanBuilder": + self._social_plan.scope = scope + return self + + def item_detail(self, item_detail: bool) -> "SocialPlanBuilder": + self._social_plan.item_detail = item_detail + return self + + def remark(self, remark: I18n) -> "SocialPlanBuilder": + self._social_plan.remark = remark + return self + + def build(self) -> "SocialPlan": + return self._social_plan diff --git a/lark_oapi/api/compensation/v1/model/social_plan_item_detail.py b/lark_oapi/api/compensation/v1/model/social_plan_item_detail.py new file mode 100644 index 000000000..5753fe1d9 --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_plan_item_detail.py @@ -0,0 +1,63 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .i18n import I18n +from .social_plan_item_setting import SocialPlanItemSetting +from .social_plan_item_setting import SocialPlanItemSetting + + +class SocialPlanItemDetail(object): + _types = { + "item_id": str, + "item_name": I18n, + "item_setting_of_person": SocialPlanItemSetting, + "item_setting_of_company": SocialPlanItemSetting, + "payment_frequency": str, + "payment_months": List[int], + } + + def __init__(self, d=None): + self.item_id: Optional[str] = None + self.item_name: Optional[I18n] = None + self.item_setting_of_person: Optional[SocialPlanItemSetting] = None + self.item_setting_of_company: Optional[SocialPlanItemSetting] = None + self.payment_frequency: Optional[str] = None + self.payment_months: Optional[List[int]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialPlanItemDetailBuilder": + return SocialPlanItemDetailBuilder() + + +class SocialPlanItemDetailBuilder(object): + def __init__(self) -> None: + self._social_plan_item_detail = SocialPlanItemDetail() + + def item_id(self, item_id: str) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.item_id = item_id + return self + + def item_name(self, item_name: I18n) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.item_name = item_name + return self + + def item_setting_of_person(self, item_setting_of_person: SocialPlanItemSetting) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.item_setting_of_person = item_setting_of_person + return self + + def item_setting_of_company(self, item_setting_of_company: SocialPlanItemSetting) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.item_setting_of_company = item_setting_of_company + return self + + def payment_frequency(self, payment_frequency: str) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.payment_frequency = payment_frequency + return self + + def payment_months(self, payment_months: List[int]) -> "SocialPlanItemDetailBuilder": + self._social_plan_item_detail.payment_months = payment_months + return self + + def build(self) -> "SocialPlanItemDetail": + return self._social_plan_item_detail diff --git a/lark_oapi/api/compensation/v1/model/social_plan_item_setting.py b/lark_oapi/api/compensation/v1/model/social_plan_item_setting.py new file mode 100644 index 000000000..b34738dba --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_plan_item_setting.py @@ -0,0 +1,60 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class SocialPlanItemSetting(object): + _types = { + "lower_limit": str, + "upper_limit": str, + "payment_ratio": str, + "payment_rounding_rule": str, + "payment_decimals": int, + "fixed_payment": str, + } + + def __init__(self, d=None): + self.lower_limit: Optional[str] = None + self.upper_limit: Optional[str] = None + self.payment_ratio: Optional[str] = None + self.payment_rounding_rule: Optional[str] = None + self.payment_decimals: Optional[int] = None + self.fixed_payment: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialPlanItemSettingBuilder": + return SocialPlanItemSettingBuilder() + + +class SocialPlanItemSettingBuilder(object): + def __init__(self) -> None: + self._social_plan_item_setting = SocialPlanItemSetting() + + def lower_limit(self, lower_limit: str) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.lower_limit = lower_limit + return self + + def upper_limit(self, upper_limit: str) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.upper_limit = upper_limit + return self + + def payment_ratio(self, payment_ratio: str) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.payment_ratio = payment_ratio + return self + + def payment_rounding_rule(self, payment_rounding_rule: str) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.payment_rounding_rule = payment_rounding_rule + return self + + def payment_decimals(self, payment_decimals: int) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.payment_decimals = payment_decimals + return self + + def fixed_payment(self, fixed_payment: str) -> "SocialPlanItemSettingBuilder": + self._social_plan_item_setting.fixed_payment = fixed_payment + return self + + def build(self) -> "SocialPlanItemSetting": + return self._social_plan_item_setting diff --git a/lark_oapi/api/compensation/v1/model/social_plan_scope.py b/lark_oapi/api/compensation/v1/model/social_plan_scope.py new file mode 100644 index 000000000..eae9d2916 --- /dev/null +++ b/lark_oapi/api/compensation/v1/model/social_plan_scope.py @@ -0,0 +1,37 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .plan_condition import PlanCondition + + +class SocialPlanScope(object): + _types = { + "is_all": bool, + "rules": List[list], + } + + def __init__(self, d=None): + self.is_all: Optional[bool] = None + self.rules: Optional[List[list]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "SocialPlanScopeBuilder": + return SocialPlanScopeBuilder() + + +class SocialPlanScopeBuilder(object): + def __init__(self) -> None: + self._social_plan_scope = SocialPlanScope() + + def is_all(self, is_all: bool) -> "SocialPlanScopeBuilder": + self._social_plan_scope.is_all = is_all + return self + + def rules(self, rules: List[list]) -> "SocialPlanScopeBuilder": + self._social_plan_scope.rules = rules + return self + + def build(self) -> "SocialPlanScope": + return self._social_plan_scope diff --git a/lark_oapi/api/corehr/v1/model/__init__.py b/lark_oapi/api/corehr/v1/model/__init__.py index 4c28d1185..ae35518ef 100644 --- a/lark_oapi/api/corehr/v1/model/__init__.py +++ b/lark_oapi/api/corehr/v1/model/__init__.py @@ -11,6 +11,7 @@ from .bank_account import * from .bp_role_organization import * from .bpm_dataengine_i18n import * +from .calendar_date_by_date_filter import * from .common_schema_config import * from .common_schema_option import * from .company import * @@ -139,6 +140,7 @@ from .transfer_reason import * from .transfer_type import * from .user_id import * +from .wk_calendar_date import * from .wk_calendar_i18n import * from .wk_option import * from .work_calendar_detail import * diff --git a/lark_oapi/api/corehr/v1/model/calendar_date_by_date_filter.py b/lark_oapi/api/corehr/v1/model/calendar_date_by_date_filter.py new file mode 100644 index 000000000..b697bd423 --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/calendar_date_by_date_filter.py @@ -0,0 +1,66 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class CalendarDateByDateFilter(object): + _types = { + "wk_calendar_ids": List[str], + "dates": List[str], + "begin_date": str, + "end_date": str, + "offset": int, + "limit": int, + "ids": List[str], + } + + def __init__(self, d=None): + self.wk_calendar_ids: Optional[List[str]] = None + self.dates: Optional[List[str]] = None + self.begin_date: Optional[str] = None + self.end_date: Optional[str] = None + self.offset: Optional[int] = None + self.limit: Optional[int] = None + self.ids: Optional[List[str]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "CalendarDateByDateFilterBuilder": + return CalendarDateByDateFilterBuilder() + + +class CalendarDateByDateFilterBuilder(object): + def __init__(self) -> None: + self._calendar_date_by_date_filter = CalendarDateByDateFilter() + + def wk_calendar_ids(self, wk_calendar_ids: List[str]) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.wk_calendar_ids = wk_calendar_ids + return self + + def dates(self, dates: List[str]) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.dates = dates + return self + + def begin_date(self, begin_date: str) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.begin_date = begin_date + return self + + def end_date(self, end_date: str) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.end_date = end_date + return self + + def offset(self, offset: int) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.offset = offset + return self + + def limit(self, limit: int) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.limit = limit + return self + + def ids(self, ids: List[str]) -> "CalendarDateByDateFilterBuilder": + self._calendar_date_by_date_filter.ids = ids + return self + + def build(self) -> "CalendarDateByDateFilter": + return self._calendar_date_by_date_filter diff --git a/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_changed_v1.py b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_changed_v1.py index d5ab86030..db20d75c6 100644 --- a/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_changed_v1.py +++ b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_changed_v1.py @@ -11,12 +11,14 @@ class P2CorehrJobDataChangedV1Data(object): "job_data_id": str, "employment_id": str, "target_user_id": UserId, + "job_change_id": str, } def __init__(self, d=None): self.job_data_id: Optional[str] = None self.employment_id: Optional[str] = None self.target_user_id: Optional[UserId] = None + self.job_change_id: Optional[str] = None init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v1/model/wk_calendar_date.py b/lark_oapi/api/corehr/v1/model/wk_calendar_date.py new file mode 100644 index 000000000..71cec07ad --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/wk_calendar_date.py @@ -0,0 +1,48 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class WkCalendarDate(object): + _types = { + "calendar_id": str, + "date": str, + "date_type": str, + "id": str, + } + + def __init__(self, d=None): + self.calendar_id: Optional[str] = None + self.date: Optional[str] = None + self.date_type: Optional[str] = None + self.id: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "WkCalendarDateBuilder": + return WkCalendarDateBuilder() + + +class WkCalendarDateBuilder(object): + def __init__(self) -> None: + self._wk_calendar_date = WkCalendarDate() + + def calendar_id(self, calendar_id: str) -> "WkCalendarDateBuilder": + self._wk_calendar_date.calendar_id = calendar_id + return self + + def date(self, date: str) -> "WkCalendarDateBuilder": + self._wk_calendar_date.date = date + return self + + def date_type(self, date_type: str) -> "WkCalendarDateBuilder": + self._wk_calendar_date.date_type = date_type + return self + + def id(self, id: str) -> "WkCalendarDateBuilder": + self._wk_calendar_date.id = id + return self + + def build(self) -> "WkCalendarDate": + return self._wk_calendar_date diff --git a/lark_oapi/api/corehr/v2/model/__init__.py b/lark_oapi/api/corehr/v2/model/__init__.py index ad81419df..875f97685 100644 --- a/lark_oapi/api/corehr/v2/model/__init__.py +++ b/lark_oapi/api/corehr/v2/model/__init__.py @@ -48,6 +48,7 @@ from .department_parent_info import * from .department_parents import * from .department_timeline import * +from .department_tree import * from .dependent import * from .dependent_for_update import * from .dimension import * @@ -301,6 +302,8 @@ from .query_timeline_department_request import * from .search_department_request_body import * from .search_department_request import * +from .tree_department_request_body import * +from .tree_department_request import * from .batch_get_employee_request_body import * from .batch_get_employee_request import * from .create_employee_request_body import * @@ -399,6 +402,8 @@ from .query_timeline_department_response import * from .search_department_response_body import * from .search_department_response import * +from .tree_department_response_body import * +from .tree_department_response import * from .batch_get_employee_response_body import * from .batch_get_employee_response import * from .create_employee_response_body import * diff --git a/lark_oapi/api/corehr/v2/model/department_tree.py b/lark_oapi/api/corehr/v2/model/department_tree.py new file mode 100644 index 000000000..f6ce1fcd4 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/department_tree.py @@ -0,0 +1,42 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class DepartmentTree(object): + _types = { + "id": str, + "level": int, + "children": List[str], + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.level: Optional[int] = None + self.children: Optional[List[str]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "DepartmentTreeBuilder": + return DepartmentTreeBuilder() + + +class DepartmentTreeBuilder(object): + def __init__(self) -> None: + self._department_tree = DepartmentTree() + + def id(self, id: str) -> "DepartmentTreeBuilder": + self._department_tree.id = id + return self + + def level(self, level: int) -> "DepartmentTreeBuilder": + self._department_tree.level = level + return self + + def children(self, children: List[str]) -> "DepartmentTreeBuilder": + self._department_tree.children = children + return self + + def build(self) -> "DepartmentTree": + return self._department_tree diff --git a/lark_oapi/api/corehr/v2/model/offer_info.py b/lark_oapi/api/corehr/v2/model/offer_info.py index 45ccb08e4..688d4c8fc 100644 --- a/lark_oapi/api/corehr/v2/model/offer_info.py +++ b/lark_oapi/api/corehr/v2/model/offer_info.py @@ -52,6 +52,7 @@ class OfferInfo(object): "flow_id": str, "check_in_time": str, "check_in_method": str, + "seniority_date": str, } def __init__(self, d=None): @@ -99,6 +100,7 @@ def __init__(self, d=None): self.flow_id: Optional[str] = None self.check_in_time: Optional[str] = None self.check_in_method: Optional[str] = None + self.seniority_date: Optional[str] = None init(self, d, self._types) @staticmethod @@ -286,5 +288,9 @@ def check_in_method(self, check_in_method: str) -> "OfferInfoBuilder": self._offer_info.check_in_method = check_in_method return self + def seniority_date(self, seniority_date: str) -> "OfferInfoBuilder": + self._offer_info.seniority_date = seniority_date + return self + def build(self) -> "OfferInfo": return self._offer_info diff --git a/lark_oapi/api/corehr/v2/model/offer_info_update.py b/lark_oapi/api/corehr/v2/model/offer_info_update.py index c11a9811a..5b2cb58ac 100644 --- a/lark_oapi/api/corehr/v2/model/offer_info_update.py +++ b/lark_oapi/api/corehr/v2/model/offer_info_update.py @@ -49,6 +49,7 @@ class OfferInfoUpdate(object): "work_location_id": str, "working_calendar": str, "working_hours_type": str, + "seniority_date": str, } def __init__(self, d=None): @@ -92,6 +93,7 @@ def __init__(self, d=None): self.work_location_id: Optional[str] = None self.working_calendar: Optional[str] = None self.working_hours_type: Optional[str] = None + self.seniority_date: Optional[str] = None init(self, d, self._types) @staticmethod @@ -263,5 +265,9 @@ def working_hours_type(self, working_hours_type: str) -> "OfferInfoUpdateBuilder self._offer_info_update.working_hours_type = working_hours_type return self + def seniority_date(self, seniority_date: str) -> "OfferInfoUpdateBuilder": + self._offer_info_update.seniority_date = seniority_date + return self + def build(self) -> "OfferInfoUpdate": return self._offer_info_update diff --git a/lark_oapi/api/corehr/v2/model/pre_hire_employment_info.py b/lark_oapi/api/corehr/v2/model/pre_hire_employment_info.py index 8a44e2a3b..e692c2212 100644 --- a/lark_oapi/api/corehr/v2/model/pre_hire_employment_info.py +++ b/lark_oapi/api/corehr/v2/model/pre_hire_employment_info.py @@ -53,6 +53,7 @@ class PreHireEmploymentInfo(object): "created_at": str, "created_by": str, "updated_by": str, + "seniority_date": str, } def __init__(self, d=None): @@ -96,6 +97,7 @@ def __init__(self, d=None): self.created_at: Optional[str] = None self.created_by: Optional[str] = None self.updated_by: Optional[str] = None + self.seniority_date: Optional[str] = None init(self, d, self._types) @staticmethod @@ -268,5 +270,9 @@ def updated_by(self, updated_by: str) -> "PreHireEmploymentInfoBuilder": self._pre_hire_employment_info.updated_by = updated_by return self + def seniority_date(self, seniority_date: str) -> "PreHireEmploymentInfoBuilder": + self._pre_hire_employment_info.seniority_date = seniority_date + return self + def build(self) -> "PreHireEmploymentInfo": return self._pre_hire_employment_info diff --git a/lark_oapi/api/corehr/v2/model/reorganization_info.py b/lark_oapi/api/corehr/v2/model/reorganization_info.py index a29b0794d..b87c110cc 100644 --- a/lark_oapi/api/corehr/v2/model/reorganization_info.py +++ b/lark_oapi/api/corehr/v2/model/reorganization_info.py @@ -31,8 +31,6 @@ class ReorganizationInfo(object): "target_cost_center": CostCenter, "original_is_confidential": bool, "target_is_confidential": bool, - "original_staffing_model": bool, - "target_staffing_model": bool, "original_parent_department_id": str, "target_parent_department_id": str, "draft_target_parent_department_id": str, @@ -56,8 +54,6 @@ def __init__(self, d=None): self.target_cost_center: Optional[CostCenter] = None self.original_is_confidential: Optional[bool] = None self.target_is_confidential: Optional[bool] = None - self.original_staffing_model: Optional[bool] = None - self.target_staffing_model: Optional[bool] = None self.original_parent_department_id: Optional[str] = None self.target_parent_department_id: Optional[str] = None self.draft_target_parent_department_id: Optional[str] = None @@ -131,14 +127,6 @@ def target_is_confidential(self, target_is_confidential: bool) -> "Reorganizatio self._reorganization_info.target_is_confidential = target_is_confidential return self - def original_staffing_model(self, original_staffing_model: bool) -> "ReorganizationInfoBuilder": - self._reorganization_info.original_staffing_model = original_staffing_model - return self - - def target_staffing_model(self, target_staffing_model: bool) -> "ReorganizationInfoBuilder": - self._reorganization_info.target_staffing_model = target_staffing_model - return self - def original_parent_department_id(self, original_parent_department_id: str) -> "ReorganizationInfoBuilder": self._reorganization_info.original_parent_department_id = original_parent_department_id return self diff --git a/lark_oapi/api/corehr/v2/model/search_job_change_request_body.py b/lark_oapi/api/corehr/v2/model/search_job_change_request_body.py index df65bc1c6..7edcbf7a5 100644 --- a/lark_oapi/api/corehr/v2/model/search_job_change_request_body.py +++ b/lark_oapi/api/corehr/v2/model/search_job_change_request_body.py @@ -13,6 +13,7 @@ class SearchJobChangeRequestBody(object): "effective_date_end": str, "updated_time_start": str, "updated_time_end": str, + "target_department_ids": List[str], } def __init__(self, d=None): @@ -23,6 +24,7 @@ def __init__(self, d=None): self.effective_date_end: Optional[str] = None self.updated_time_start: Optional[str] = None self.updated_time_end: Optional[str] = None + self.target_department_ids: Optional[List[str]] = None init(self, d, self._types) @staticmethod @@ -62,5 +64,9 @@ def updated_time_end(self, updated_time_end: str) -> "SearchJobChangeRequestBody self._search_job_change_request_body.updated_time_end = updated_time_end return self + def target_department_ids(self, target_department_ids: List[str]) -> "SearchJobChangeRequestBodyBuilder": + self._search_job_change_request_body.target_department_ids = target_department_ids + return self + def build(self) -> "SearchJobChangeRequestBody": return self._search_job_change_request_body diff --git a/lark_oapi/api/corehr/v2/model/signature_file.py b/lark_oapi/api/corehr/v2/model/signature_file.py index 1db995396..8ddfa39d4 100644 --- a/lark_oapi/api/corehr/v2/model/signature_file.py +++ b/lark_oapi/api/corehr/v2/model/signature_file.py @@ -18,6 +18,7 @@ class SignatureFile(object): "contract_code": str, "effective_date": str, "template_id": str, + "sign_url": str, } def __init__(self, d=None): @@ -31,6 +32,7 @@ def __init__(self, d=None): self.contract_code: Optional[str] = None self.effective_date: Optional[str] = None self.template_id: Optional[str] = None + self.sign_url: Optional[str] = None init(self, d, self._types) @staticmethod @@ -82,5 +84,9 @@ def template_id(self, template_id: str) -> "SignatureFileBuilder": self._signature_file.template_id = template_id return self + def sign_url(self, sign_url: str) -> "SignatureFileBuilder": + self._signature_file.sign_url = sign_url + return self + def build(self) -> "SignatureFile": return self._signature_file diff --git a/lark_oapi/api/corehr/v2/model/tree_department_request.py b/lark_oapi/api/corehr/v2/model/tree_department_request.py new file mode 100644 index 000000000..c315dc199 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/tree_department_request.py @@ -0,0 +1,52 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.model import BaseRequest +from lark_oapi.core.enum import HttpMethod, AccessTokenType +from .tree_department_request_body import TreeDepartmentRequestBody + + +class TreeDepartmentRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.page_size: Optional[int] = None + self.page_token: Optional[str] = None + self.department_id_type: Optional[str] = None + self.request_body: Optional[TreeDepartmentRequestBody] = None + + @staticmethod + def builder() -> "TreeDepartmentRequestBuilder": + return TreeDepartmentRequestBuilder() + + +class TreeDepartmentRequestBuilder(object): + + def __init__(self) -> None: + tree_department_request = TreeDepartmentRequest() + tree_department_request.http_method = HttpMethod.POST + tree_department_request.uri = "/open-apis/corehr/v2/departments/tree" + tree_department_request.token_types = {AccessTokenType.TENANT} + self._tree_department_request: TreeDepartmentRequest = tree_department_request + + def page_size(self, page_size: int) -> "TreeDepartmentRequestBuilder": + self._tree_department_request.page_size = page_size + self._tree_department_request.add_query("page_size", page_size) + return self + + def page_token(self, page_token: str) -> "TreeDepartmentRequestBuilder": + self._tree_department_request.page_token = page_token + self._tree_department_request.add_query("page_token", page_token) + return self + + def department_id_type(self, department_id_type: str) -> "TreeDepartmentRequestBuilder": + self._tree_department_request.department_id_type = department_id_type + self._tree_department_request.add_query("department_id_type", department_id_type) + return self + + def request_body(self, request_body: TreeDepartmentRequestBody) -> "TreeDepartmentRequestBuilder": + self._tree_department_request.request_body = request_body + self._tree_department_request.body = request_body + return self + + def build(self) -> TreeDepartmentRequest: + return self._tree_department_request diff --git a/lark_oapi/api/corehr/v2/model/tree_department_request_body.py b/lark_oapi/api/corehr/v2/model/tree_department_request_body.py new file mode 100644 index 000000000..bc0016fc6 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/tree_department_request_body.py @@ -0,0 +1,42 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class TreeDepartmentRequestBody(object): + _types = { + "department_id": str, + "need_inactive": bool, + "effective_date": str, + } + + def __init__(self, d=None): + self.department_id: Optional[str] = None + self.need_inactive: Optional[bool] = None + self.effective_date: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "TreeDepartmentRequestBodyBuilder": + return TreeDepartmentRequestBodyBuilder() + + +class TreeDepartmentRequestBodyBuilder(object): + def __init__(self) -> None: + self._tree_department_request_body = TreeDepartmentRequestBody() + + def department_id(self, department_id: str) -> "TreeDepartmentRequestBodyBuilder": + self._tree_department_request_body.department_id = department_id + return self + + def need_inactive(self, need_inactive: bool) -> "TreeDepartmentRequestBodyBuilder": + self._tree_department_request_body.need_inactive = need_inactive + return self + + def effective_date(self, effective_date: str) -> "TreeDepartmentRequestBodyBuilder": + self._tree_department_request_body.effective_date = effective_date + return self + + def build(self) -> "TreeDepartmentRequestBody": + return self._tree_department_request_body diff --git a/lark_oapi/api/corehr/v2/model/tree_department_response.py b/lark_oapi/api/corehr/v2/model/tree_department_response.py new file mode 100644 index 000000000..004aff27c --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/tree_department_response.py @@ -0,0 +1,17 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from lark_oapi.core.model import BaseResponse +from .tree_department_response_body import TreeDepartmentResponseBody + + +class TreeDepartmentResponse(BaseResponse): + _types = { + "data": TreeDepartmentResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[TreeDepartmentResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v2/model/tree_department_response_body.py b/lark_oapi/api/corehr/v2/model/tree_department_response_body.py new file mode 100644 index 000000000..75ef160b9 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/tree_department_response_body.py @@ -0,0 +1,43 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .department_tree import DepartmentTree + + +class TreeDepartmentResponseBody(object): + _types = { + "items": List[DepartmentTree], + "page_token": str, + "has_more": bool, + } + + def __init__(self, d=None): + self.items: Optional[List[DepartmentTree]] = None + self.page_token: Optional[str] = None + self.has_more: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "TreeDepartmentResponseBodyBuilder": + return TreeDepartmentResponseBodyBuilder() + + +class TreeDepartmentResponseBodyBuilder(object): + def __init__(self) -> None: + self._tree_department_response_body = TreeDepartmentResponseBody() + + def items(self, items: List[DepartmentTree]) -> "TreeDepartmentResponseBodyBuilder": + self._tree_department_response_body.items = items + return self + + def page_token(self, page_token: str) -> "TreeDepartmentResponseBodyBuilder": + self._tree_department_response_body.page_token = page_token + return self + + def has_more(self, has_more: bool) -> "TreeDepartmentResponseBodyBuilder": + self._tree_department_response_body.has_more = has_more + return self + + def build(self) -> "TreeDepartmentResponseBody": + return self._tree_department_response_body diff --git a/lark_oapi/api/corehr/v2/resource/department.py b/lark_oapi/api/corehr/v2/resource/department.py index 751c79947..c23670d7c 100644 --- a/lark_oapi/api/corehr/v2/resource/department.py +++ b/lark_oapi/api/corehr/v2/resource/department.py @@ -19,6 +19,8 @@ from ..model.query_timeline_department_response import QueryTimelineDepartmentResponse from ..model.search_department_request import SearchDepartmentRequest from ..model.search_department_response import SearchDepartmentResponse +from ..model.tree_department_request import TreeDepartmentRequest +from ..model.tree_department_response import TreeDepartmentResponse class Department(object): @@ -218,3 +220,40 @@ async def asearch(self, request: SearchDepartmentRequest, response.raw = resp return response + + def tree(self, request: TreeDepartmentRequest, option: Optional[RequestOption] = None) -> TreeDepartmentResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 添加 content-type + if request.body is not None: + option.headers[CONTENT_TYPE] = f"{APPLICATION_JSON}; charset=utf-8" + + # 发起请求 + resp: RawResponse = Transport.execute(self.config, request, option) + + # 反序列化 + response: TreeDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), TreeDepartmentResponse) + response.raw = resp + + return response + + async def atree(self, request: TreeDepartmentRequest, + option: Optional[RequestOption] = None) -> TreeDepartmentResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: TreeDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), TreeDepartmentResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/docx/v1/model/text_style.py b/lark_oapi/api/docx/v1/model/text_style.py index b157f4eb7..fc39ea848 100644 --- a/lark_oapi/api/docx/v1/model/text_style.py +++ b/lark_oapi/api/docx/v1/model/text_style.py @@ -13,6 +13,7 @@ class TextStyle(object): "wrap": bool, "background_color": str, "indentation_level": str, + "sequence": str, } def __init__(self, d=None): @@ -23,6 +24,7 @@ def __init__(self, d=None): self.wrap: Optional[bool] = None self.background_color: Optional[str] = None self.indentation_level: Optional[str] = None + self.sequence: Optional[str] = None init(self, d, self._types) @staticmethod @@ -62,5 +64,9 @@ def indentation_level(self, indentation_level: str) -> "TextStyleBuilder": self._text_style.indentation_level = indentation_level return self + def sequence(self, sequence: str) -> "TextStyleBuilder": + self._text_style.sequence = sequence + return self + def build(self) -> "TextStyle": return self._text_style diff --git a/lark_oapi/api/hire/v1/model/__init__.py b/lark_oapi/api/hire/v1/model/__init__.py index bf2b2a5fc..a55c99cd2 100644 --- a/lark_oapi/api/hire/v1/model/__init__.py +++ b/lark_oapi/api/hire/v1/model/__init__.py @@ -158,10 +158,12 @@ from .external_application import * from .external_background_check import * from .external_background_check_attachment import * +from .external_common_attachment import * from .external_grant_role_info import * from .external_interview import * from .external_interview_assessment import * from .external_interview_assessment_dimension import * +from .external_offer import * from .external_reward import * from .filter import * from .five_start_scoring_result import * diff --git a/lark_oapi/api/hire/v1/model/external_common_attachment.py b/lark_oapi/api/hire/v1/model/external_common_attachment.py new file mode 100644 index 000000000..c92c41dff --- /dev/null +++ b/lark_oapi/api/hire/v1/model/external_common_attachment.py @@ -0,0 +1,42 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init + + +class ExternalCommonAttachment(object): + _types = { + "id": str, + "name": str, + "size": int, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.name: Optional[str] = None + self.size: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ExternalCommonAttachmentBuilder": + return ExternalCommonAttachmentBuilder() + + +class ExternalCommonAttachmentBuilder(object): + def __init__(self) -> None: + self._external_common_attachment = ExternalCommonAttachment() + + def id(self, id: str) -> "ExternalCommonAttachmentBuilder": + self._external_common_attachment.id = id + return self + + def name(self, name: str) -> "ExternalCommonAttachmentBuilder": + self._external_common_attachment.name = name + return self + + def size(self, size: int) -> "ExternalCommonAttachmentBuilder": + self._external_common_attachment.size = size + return self + + def build(self) -> "ExternalCommonAttachment": + return self._external_common_attachment diff --git a/lark_oapi/api/hire/v1/model/external_interview.py b/lark_oapi/api/hire/v1/model/external_interview.py index de77939f2..30f714bda 100644 --- a/lark_oapi/api/hire/v1/model/external_interview.py +++ b/lark_oapi/api/hire/v1/model/external_interview.py @@ -2,6 +2,7 @@ from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type from lark_oapi.core.construct import init +from .external_interview_assessment import ExternalInterviewAssessment class ExternalInterview(object): @@ -12,6 +13,7 @@ class ExternalInterview(object): "participate_status": int, "begin_time": int, "end_time": int, + "interview_assessments": List[ExternalInterviewAssessment], } def __init__(self, d=None): @@ -21,6 +23,7 @@ def __init__(self, d=None): self.participate_status: Optional[int] = None self.begin_time: Optional[int] = None self.end_time: Optional[int] = None + self.interview_assessments: Optional[List[ExternalInterviewAssessment]] = None init(self, d, self._types) @staticmethod @@ -56,5 +59,10 @@ def end_time(self, end_time: int) -> "ExternalInterviewBuilder": self._external_interview.end_time = end_time return self + def interview_assessments(self, + interview_assessments: List[ExternalInterviewAssessment]) -> "ExternalInterviewBuilder": + self._external_interview.interview_assessments = interview_assessments + return self + def build(self) -> "ExternalInterview": return self._external_interview diff --git a/lark_oapi/api/hire/v1/model/external_offer.py b/lark_oapi/api/hire/v1/model/external_offer.py new file mode 100644 index 000000000..66f9b37b2 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/external_offer.py @@ -0,0 +1,73 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.construct import init +from .external_common_attachment import ExternalCommonAttachment + + +class ExternalOffer(object): + _types = { + "id": str, + "external_id": str, + "external_application_id": str, + "biz_create_time": str, + "owner": str, + "offer_status": str, + "attachment_id_list": List[str], + "attachment_list": List[ExternalCommonAttachment], + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.external_id: Optional[str] = None + self.external_application_id: Optional[str] = None + self.biz_create_time: Optional[str] = None + self.owner: Optional[str] = None + self.offer_status: Optional[str] = None + self.attachment_id_list: Optional[List[str]] = None + self.attachment_list: Optional[List[ExternalCommonAttachment]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ExternalOfferBuilder": + return ExternalOfferBuilder() + + +class ExternalOfferBuilder(object): + def __init__(self) -> None: + self._external_offer = ExternalOffer() + + def id(self, id: str) -> "ExternalOfferBuilder": + self._external_offer.id = id + return self + + def external_id(self, external_id: str) -> "ExternalOfferBuilder": + self._external_offer.external_id = external_id + return self + + def external_application_id(self, external_application_id: str) -> "ExternalOfferBuilder": + self._external_offer.external_application_id = external_application_id + return self + + def biz_create_time(self, biz_create_time: str) -> "ExternalOfferBuilder": + self._external_offer.biz_create_time = biz_create_time + return self + + def owner(self, owner: str) -> "ExternalOfferBuilder": + self._external_offer.owner = owner + return self + + def offer_status(self, offer_status: str) -> "ExternalOfferBuilder": + self._external_offer.offer_status = offer_status + return self + + def attachment_id_list(self, attachment_id_list: List[str]) -> "ExternalOfferBuilder": + self._external_offer.attachment_id_list = attachment_id_list + return self + + def attachment_list(self, attachment_list: List[ExternalCommonAttachment]) -> "ExternalOfferBuilder": + self._external_offer.attachment_list = attachment_list + return self + + def build(self) -> "ExternalOffer": + return self._external_offer diff --git a/lark_oapi/api/hire/v1/model/list_application_request.py b/lark_oapi/api/hire/v1/model/list_application_request.py index d29affa9e..a6208365f 100644 --- a/lark_oapi/api/hire/v1/model/list_application_request.py +++ b/lark_oapi/api/hire/v1/model/list_application_request.py @@ -13,6 +13,7 @@ def __init__(self) -> None: self.talent_id: Optional[str] = None self.active_status: Optional[str] = None self.job_id: Optional[str] = None + self.lock_status: Optional[List[int]] = None self.page_token: Optional[str] = None self.page_size: Optional[int] = None self.update_start_time: Optional[int] = None @@ -57,6 +58,11 @@ def job_id(self, job_id: str) -> "ListApplicationRequestBuilder": self._list_application_request.add_query("job_id", job_id) return self + def lock_status(self, lock_status: List[int]) -> "ListApplicationRequestBuilder": + self._list_application_request.lock_status = lock_status + self._list_application_request.add_query("lock_status", lock_status) + return self + def page_token(self, page_token: str) -> "ListApplicationRequestBuilder": self._list_application_request.page_token = page_token self._list_application_request.add_query("page_token", page_token) diff --git a/lark_oapi/api/hire/v1/model/list_talent_request.py b/lark_oapi/api/hire/v1/model/list_talent_request.py index bca00a2e4..ef260101d 100644 --- a/lark_oapi/api/hire/v1/model/list_talent_request.py +++ b/lark_oapi/api/hire/v1/model/list_talent_request.py @@ -8,9 +8,11 @@ class ListTalentRequest(BaseRequest): def __init__(self) -> None: super().__init__() + self.keyword: Optional[str] = None self.update_start_time: Optional[int] = None self.update_end_time: Optional[int] = None self.page_size: Optional[int] = None + self.sort_by: Optional[int] = None self.page_token: Optional[str] = None self.user_id_type: Optional[str] = None self.query_option: Optional[str] = None @@ -29,6 +31,11 @@ def __init__(self) -> None: list_talent_request.token_types = {AccessTokenType.TENANT} self._list_talent_request: ListTalentRequest = list_talent_request + def keyword(self, keyword: str) -> "ListTalentRequestBuilder": + self._list_talent_request.keyword = keyword + self._list_talent_request.add_query("keyword", keyword) + return self + def update_start_time(self, update_start_time: int) -> "ListTalentRequestBuilder": self._list_talent_request.update_start_time = update_start_time self._list_talent_request.add_query("update_start_time", update_start_time) @@ -44,6 +51,11 @@ def page_size(self, page_size: int) -> "ListTalentRequestBuilder": self._list_talent_request.add_query("page_size", page_size) return self + def sort_by(self, sort_by: int) -> "ListTalentRequestBuilder": + self._list_talent_request.sort_by = sort_by + self._list_talent_request.add_query("sort_by", sort_by) + return self + def page_token(self, page_token: str) -> "ListTalentRequestBuilder": self._list_talent_request.page_token = page_token self._list_talent_request.add_query("page_token", page_token) diff --git a/lark_oapi/client.py b/lark_oapi/client.py index 5515bfc10..afed16c5a 100644 --- a/lark_oapi/client.py +++ b/lark_oapi/client.py @@ -8,102 +8,102 @@ from .core.model import * from .core.token import TokenManager, verify from .core.http import Transport -from .api.task.service import TaskService -from .api.acs.service import AcsService -from .api.approval.service import ApprovalService -from .api.bitable.service import BitableService -from .api.block.service import BlockService -from .api.board.service import BoardService +from .api.meeting_room.service import MeetingRoomService +from .api.verification.service import VerificationService from .api.admin.service import AdminService -from .api.mdm.service import MdmService -from .api.optical_char_recognition.service import OpticalCharRecognitionService -from .api.passport.service import PassportService -from .api.security_and_compliance.service import SecurityAndComplianceService -from .api.human_authentication.service import HumanAuthenticationService -from .api.mail.service import MailService -from .api.okr.service import OkrService -from .api.attendance.service import AttendanceService from .api.auth.service import AuthService +from .api.authen.service import AuthenService +from .api.board.service import BoardService +from .api.gray_test_open_sg.service import GrayTestOpenSgService +from .api.human_authentication.service import HumanAuthenticationService +from .api.application.service import ApplicationService +from .api.approval.service import ApprovalService from .api.contact.service import ContactService -from .api.corehr.service import CorehrService -from .api.helpdesk.service import HelpdeskService -from .api.im.service import ImService -from .api.personal_settings.service import PersonalSettingsService -from .api.report.service import ReportService -from .api.aily.service import AilyService -from .api.drive.service import DriveService -from .api.ehr.service import EhrService from .api.event.service import EventService -from .api.gray_test_open_sg.service import GrayTestOpenSgService -from .api.search.service import SearchService -from .api.speech_to_text.service import SpeechToTextService -from .api.calendar.service import CalendarService +from .api.security_and_compliance.service import SecurityAndComplianceService from .api.compensation.service import CompensationService -from .api.lingo.service import LingoService -from .api.sheets.service import SheetsService -from .api.verification.service import VerificationService +from .api.ehr.service import EhrService +from .api.task.service import TaskService from .api.tenant.service import TenantService from .api.translation.service import TranslationService -from .api.wiki.service import WikiService +from .api.block.service import BlockService +from .api.okr.service import OkrService +from .api.report.service import ReportService from .api.hire.service import HireService -from .api.meeting_room.service import MeetingRoomService -from .api.vc.service import VcService -from .api.application.service import ApplicationService -from .api.authen.service import AuthenService -from .api.baike.service import BaikeService +from .api.mdm.service import MdmService +from .api.attendance.service import AttendanceService +from .api.bitable.service import BitableService +from .api.corehr.service import CorehrService from .api.document_ai.service import DocumentAiService from .api.docx.service import DocxService +from .api.drive.service import DriveService +from .api.personal_settings.service import PersonalSettingsService +from .api.wiki.service import WikiService +from .api.acs.service import AcsService +from .api.im.service import ImService +from .api.lingo.service import LingoService +from .api.vc.service import VcService +from .api.aily.service import AilyService +from .api.baike.service import BaikeService +from .api.optical_char_recognition.service import OpticalCharRecognitionService +from .api.passport.service import PassportService +from .api.search.service import SearchService +from .api.sheets.service import SheetsService +from .api.calendar.service import CalendarService +from .api.helpdesk.service import HelpdeskService +from .api.mail.service import MailService +from .api.speech_to_text.service import SpeechToTextService from .api.workplace.service import WorkplaceService class Client(object): def __init__(self) -> None: self._config: Optional[Config] = None - self.task: Optional[TaskService] = None - self.acs: Optional[AcsService] = None - self.approval: Optional[ApprovalService] = None - self.bitable: Optional[BitableService] = None - self.block: Optional[BlockService] = None - self.board: Optional[BoardService] = None + self.meeting_room: Optional[MeetingRoomService] = None + self.verification: Optional[VerificationService] = None self.admin: Optional[AdminService] = None - self.mdm: Optional[MdmService] = None - self.optical_char_recognition: Optional[OpticalCharRecognitionService] = None - self.passport: Optional[PassportService] = None - self.security_and_compliance: Optional[SecurityAndComplianceService] = None - self.human_authentication: Optional[HumanAuthenticationService] = None - self.mail: Optional[MailService] = None - self.okr: Optional[OkrService] = None - self.attendance: Optional[AttendanceService] = None self.auth: Optional[AuthService] = None + self.authen: Optional[AuthenService] = None + self.board: Optional[BoardService] = None + self.gray_test_open_sg: Optional[GrayTestOpenSgService] = None + self.human_authentication: Optional[HumanAuthenticationService] = None + self.application: Optional[ApplicationService] = None + self.approval: Optional[ApprovalService] = None self.contact: Optional[ContactService] = None - self.corehr: Optional[CorehrService] = None - self.helpdesk: Optional[HelpdeskService] = None - self.im: Optional[ImService] = None - self.personal_settings: Optional[PersonalSettingsService] = None - self.report: Optional[ReportService] = None - self.aily: Optional[AilyService] = None - self.drive: Optional[DriveService] = None - self.ehr: Optional[EhrService] = None self.event: Optional[EventService] = None - self.gray_test_open_sg: Optional[GrayTestOpenSgService] = None - self.search: Optional[SearchService] = None - self.speech_to_text: Optional[SpeechToTextService] = None - self.calendar: Optional[CalendarService] = None + self.security_and_compliance: Optional[SecurityAndComplianceService] = None self.compensation: Optional[CompensationService] = None - self.lingo: Optional[LingoService] = None - self.sheets: Optional[SheetsService] = None - self.verification: Optional[VerificationService] = None + self.ehr: Optional[EhrService] = None + self.task: Optional[TaskService] = None self.tenant: Optional[TenantService] = None self.translation: Optional[TranslationService] = None - self.wiki: Optional[WikiService] = None + self.block: Optional[BlockService] = None + self.okr: Optional[OkrService] = None + self.report: Optional[ReportService] = None self.hire: Optional[HireService] = None - self.meeting_room: Optional[MeetingRoomService] = None - self.vc: Optional[VcService] = None - self.application: Optional[ApplicationService] = None - self.authen: Optional[AuthenService] = None - self.baike: Optional[BaikeService] = None + self.mdm: Optional[MdmService] = None + self.attendance: Optional[AttendanceService] = None + self.bitable: Optional[BitableService] = None + self.corehr: Optional[CorehrService] = None self.document_ai: Optional[DocumentAiService] = None self.docx: Optional[DocxService] = None + self.drive: Optional[DriveService] = None + self.personal_settings: Optional[PersonalSettingsService] = None + self.wiki: Optional[WikiService] = None + self.acs: Optional[AcsService] = None + self.im: Optional[ImService] = None + self.lingo: Optional[LingoService] = None + self.vc: Optional[VcService] = None + self.aily: Optional[AilyService] = None + self.baike: Optional[BaikeService] = None + self.optical_char_recognition: Optional[OpticalCharRecognitionService] = None + self.passport: Optional[PassportService] = None + self.search: Optional[SearchService] = None + self.sheets: Optional[SheetsService] = None + self.calendar: Optional[CalendarService] = None + self.helpdesk: Optional[HelpdeskService] = None + self.mail: Optional[MailService] = None + self.speech_to_text: Optional[SpeechToTextService] = None self.workplace: Optional[WorkplaceService] = None @staticmethod @@ -207,51 +207,51 @@ def build(self) -> Client: self._init_logger() # 初始化 服务 - client.task = TaskService(self._config) - client.acs = AcsService(self._config) - client.approval = ApprovalService(self._config) - client.bitable = BitableService(self._config) - client.block = BlockService(self._config) - client.board = BoardService(self._config) + client.meeting_room = MeetingRoomService(self._config) + client.verification = VerificationService(self._config) client.admin = AdminService(self._config) - client.mdm = MdmService(self._config) - client.optical_char_recognition = OpticalCharRecognitionService(self._config) - client.passport = PassportService(self._config) - client.security_and_compliance = SecurityAndComplianceService(self._config) - client.human_authentication = HumanAuthenticationService(self._config) - client.mail = MailService(self._config) - client.okr = OkrService(self._config) - client.attendance = AttendanceService(self._config) client.auth = AuthService(self._config) + client.authen = AuthenService(self._config) + client.board = BoardService(self._config) + client.gray_test_open_sg = GrayTestOpenSgService(self._config) + client.human_authentication = HumanAuthenticationService(self._config) + client.application = ApplicationService(self._config) + client.approval = ApprovalService(self._config) client.contact = ContactService(self._config) - client.corehr = CorehrService(self._config) - client.helpdesk = HelpdeskService(self._config) - client.im = ImService(self._config) - client.personal_settings = PersonalSettingsService(self._config) - client.report = ReportService(self._config) - client.aily = AilyService(self._config) - client.drive = DriveService(self._config) - client.ehr = EhrService(self._config) client.event = EventService(self._config) - client.gray_test_open_sg = GrayTestOpenSgService(self._config) - client.search = SearchService(self._config) - client.speech_to_text = SpeechToTextService(self._config) - client.calendar = CalendarService(self._config) + client.security_and_compliance = SecurityAndComplianceService(self._config) client.compensation = CompensationService(self._config) - client.lingo = LingoService(self._config) - client.sheets = SheetsService(self._config) - client.verification = VerificationService(self._config) + client.ehr = EhrService(self._config) + client.task = TaskService(self._config) client.tenant = TenantService(self._config) client.translation = TranslationService(self._config) - client.wiki = WikiService(self._config) + client.block = BlockService(self._config) + client.okr = OkrService(self._config) + client.report = ReportService(self._config) client.hire = HireService(self._config) - client.meeting_room = MeetingRoomService(self._config) - client.vc = VcService(self._config) - client.application = ApplicationService(self._config) - client.authen = AuthenService(self._config) - client.baike = BaikeService(self._config) + client.mdm = MdmService(self._config) + client.attendance = AttendanceService(self._config) + client.bitable = BitableService(self._config) + client.corehr = CorehrService(self._config) client.document_ai = DocumentAiService(self._config) client.docx = DocxService(self._config) + client.drive = DriveService(self._config) + client.personal_settings = PersonalSettingsService(self._config) + client.wiki = WikiService(self._config) + client.acs = AcsService(self._config) + client.im = ImService(self._config) + client.lingo = LingoService(self._config) + client.vc = VcService(self._config) + client.aily = AilyService(self._config) + client.baike = BaikeService(self._config) + client.optical_char_recognition = OpticalCharRecognitionService(self._config) + client.passport = PassportService(self._config) + client.search = SearchService(self._config) + client.sheets = SheetsService(self._config) + client.calendar = CalendarService(self._config) + client.helpdesk = HelpdeskService(self._config) + client.mail = MailService(self._config) + client.speech_to_text = SpeechToTextService(self._config) client.workplace = WorkplaceService(self._config) return client diff --git a/lark_oapi/core/const.py b/lark_oapi/core/const.py index e2f7bac58..fa15b3087 100644 --- a/lark_oapi/core/const.py +++ b/lark_oapi/core/const.py @@ -1,6 +1,6 @@ # Info PROJECT = "oapi-sdk-python" -VERSION = "1.3.1" +VERSION = "1.3.2" # Domain FEISHU_DOMAIN = "https://open.feishu.cn" diff --git a/samples/api/acs/v1/create_rule_external_sample.py b/samples/api/acs/v1/create_rule_external_sample.py index e26531616..44f95c52e 100644 --- a/samples/api/acs/v1/create_rule_external_sample.py +++ b/samples/api/acs/v1/create_rule_external_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRuleExternalRequest = CreateRuleExternalRequest.builder() \ - .rule_id("7298933941867135276") \ - .user_id_type("user_id") \ - .request_body(CreateRuleExternalRequestBody.builder() - .rule(Rule.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateRuleExternalRequest = CreateRuleExternalRequest.builder() \ + .rule_id("7298933941867135276") \ + .user_id_type("user_id") \ + .request_body(CreateRuleExternalRequestBody.builder() + .rule(Rule.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateRuleExternalResponse = client.acs.v1.rule_external.create(request) + # 发起请求 + response: CreateRuleExternalResponse = client.acs.v1.rule_external.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRuleExternalRequest = CreateRuleExternalRequest.builder() \ - .rule_id("7298933941867135276") \ - .user_id_type("user_id") \ - .request_body(CreateRuleExternalRequestBody.builder() - .rule(Rule.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateRuleExternalRequest = CreateRuleExternalRequest.builder() \ + .rule_id("7298933941867135276") \ + .user_id_type("user_id") \ + .request_body(CreateRuleExternalRequestBody.builder() + .rule(Rule.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateRuleExternalResponse = await client.acs.v1.rule_external.acreate(request) + # 发起请求 + response: CreateRuleExternalResponse = await client.acs.v1.rule_external.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/create_visitor_sample.py b/samples/api/acs/v1/create_visitor_sample.py index 2cc274510..1011c8017 100644 --- a/samples/api/acs/v1/create_visitor_sample.py +++ b/samples/api/acs/v1/create_visitor_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateVisitorRequest = CreateVisitorRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateVisitorRequestBody.builder() - .user(UserExternal.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateVisitorRequest = CreateVisitorRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateVisitorRequestBody.builder() + .user(UserExternal.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateVisitorResponse = client.acs.v1.visitor.create(request) + # 发起请求 + response: CreateVisitorResponse = client.acs.v1.visitor.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.visitor.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.visitor.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateVisitorRequest = CreateVisitorRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateVisitorRequestBody.builder() - .user(UserExternal.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateVisitorRequest = CreateVisitorRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateVisitorRequestBody.builder() + .user(UserExternal.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateVisitorResponse = await client.acs.v1.visitor.acreate(request) + # 发起请求 + response: CreateVisitorResponse = await client.acs.v1.visitor.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.visitor.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.visitor.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/delete_rule_external_sample.py b/samples/api/acs/v1/delete_rule_external_sample.py index f7e145c07..80b72bf8c 100644 --- a/samples/api/acs/v1/delete_rule_external_sample.py +++ b/samples/api/acs/v1/delete_rule_external_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteRuleExternalRequest = DeleteRuleExternalRequest.builder() \ - .rule_id("7298933941867135276") \ - .build() + # 构造请求对象 + request: DeleteRuleExternalRequest = DeleteRuleExternalRequest.builder() \ + .rule_id("7298933941867135276") \ + .build() - # 发起请求 - response: DeleteRuleExternalResponse = client.acs.v1.rule_external.delete(request) + # 发起请求 + response: DeleteRuleExternalResponse = client.acs.v1.rule_external.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteRuleExternalRequest = DeleteRuleExternalRequest.builder() \ - .rule_id("7298933941867135276") \ - .build() + # 构造请求对象 + request: DeleteRuleExternalRequest = DeleteRuleExternalRequest.builder() \ + .rule_id("7298933941867135276") \ + .build() - # 发起请求 - response: DeleteRuleExternalResponse = await client.acs.v1.rule_external.adelete(request) + # 发起请求 + response: DeleteRuleExternalResponse = await client.acs.v1.rule_external.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/delete_visitor_sample.py b/samples/api/acs/v1/delete_visitor_sample.py index ec34ea9b6..e395d145e 100644 --- a/samples/api/acs/v1/delete_visitor_sample.py +++ b/samples/api/acs/v1/delete_visitor_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteVisitorRequest = DeleteVisitorRequest.builder() \ - .visitor_id("6939433228970082566") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteVisitorRequest = DeleteVisitorRequest.builder() \ + .visitor_id("6939433228970082566") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteVisitorResponse = client.acs.v1.visitor.delete(request) + # 发起请求 + response: DeleteVisitorResponse = client.acs.v1.visitor.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.visitor.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.visitor.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteVisitorRequest = DeleteVisitorRequest.builder() \ - .visitor_id("6939433228970082566") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteVisitorRequest = DeleteVisitorRequest.builder() \ + .visitor_id("6939433228970082566") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteVisitorResponse = await client.acs.v1.visitor.adelete(request) + # 发起请求 + response: DeleteVisitorResponse = await client.acs.v1.visitor.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.visitor.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.visitor.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/device_bind_rule_external_sample.py b/samples/api/acs/v1/device_bind_rule_external_sample.py index a81082e8d..6fc98b5da 100644 --- a/samples/api/acs/v1/device_bind_rule_external_sample.py +++ b/samples/api/acs/v1/device_bind_rule_external_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeviceBindRuleExternalRequest = DeviceBindRuleExternalRequest.builder() \ - .request_body(DeviceBindRuleExternalRequestBody.builder() - .device_id("6939433228970082593") - .rule_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeviceBindRuleExternalRequest = DeviceBindRuleExternalRequest.builder() \ + .request_body(DeviceBindRuleExternalRequestBody.builder() + .device_id("6939433228970082593") + .rule_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeviceBindRuleExternalResponse = client.acs.v1.rule_external.device_bind(request) + # 发起请求 + response: DeviceBindRuleExternalResponse = client.acs.v1.rule_external.device_bind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.device_bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.device_bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeviceBindRuleExternalRequest = DeviceBindRuleExternalRequest.builder() \ - .request_body(DeviceBindRuleExternalRequestBody.builder() - .device_id("6939433228970082593") - .rule_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeviceBindRuleExternalRequest = DeviceBindRuleExternalRequest.builder() \ + .request_body(DeviceBindRuleExternalRequestBody.builder() + .device_id("6939433228970082593") + .rule_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeviceBindRuleExternalResponse = await client.acs.v1.rule_external.adevice_bind(request) + # 发起请求 + response: DeviceBindRuleExternalResponse = await client.acs.v1.rule_external.adevice_bind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.adevice_bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.adevice_bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/get_access_record_access_photo_sample.py b/samples/api/acs/v1/get_access_record_access_photo_sample.py index 25cd50891..bdb236357 100644 --- a/samples/api/acs/v1/get_access_record_access_photo_sample.py +++ b/samples/api/acs/v1/get_access_record_access_photo_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAccessRecordAccessPhotoRequest = GetAccessRecordAccessPhotoRequest.builder() \ - .access_record_id("6939433228970082591") \ - .build() + # 构造请求对象 + request: GetAccessRecordAccessPhotoRequest = GetAccessRecordAccessPhotoRequest.builder() \ + .access_record_id("6939433228970082591") \ + .build() - # 发起请求 - response: GetAccessRecordAccessPhotoResponse = client.acs.v1.access_record_access_photo.get(request) + # 发起请求 + response: GetAccessRecordAccessPhotoResponse = client.acs.v1.access_record_access_photo.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.access_record_access_photo.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.access_record_access_photo.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAccessRecordAccessPhotoRequest = GetAccessRecordAccessPhotoRequest.builder() \ - .access_record_id("6939433228970082591") \ - .build() + # 构造请求对象 + request: GetAccessRecordAccessPhotoRequest = GetAccessRecordAccessPhotoRequest.builder() \ + .access_record_id("6939433228970082591") \ + .build() - # 发起请求 - response: GetAccessRecordAccessPhotoResponse = await client.acs.v1.access_record_access_photo.aget(request) + # 发起请求 + response: GetAccessRecordAccessPhotoResponse = await client.acs.v1.access_record_access_photo.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.access_record_access_photo.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.access_record_access_photo.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/get_rule_external_sample.py b/samples/api/acs/v1/get_rule_external_sample.py index fca8cc961..5a5699cea 100644 --- a/samples/api/acs/v1/get_rule_external_sample.py +++ b/samples/api/acs/v1/get_rule_external_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRuleExternalRequest = GetRuleExternalRequest.builder() \ - .device_id("7296700518380863767") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetRuleExternalRequest = GetRuleExternalRequest.builder() \ + .device_id("7296700518380863767") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetRuleExternalResponse = client.acs.v1.rule_external.get(request) + # 发起请求 + response: GetRuleExternalResponse = client.acs.v1.rule_external.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRuleExternalRequest = GetRuleExternalRequest.builder() \ - .device_id("7296700518380863767") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetRuleExternalRequest = GetRuleExternalRequest.builder() \ + .device_id("7296700518380863767") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetRuleExternalResponse = await client.acs.v1.rule_external.aget(request) + # 发起请求 + response: GetRuleExternalResponse = await client.acs.v1.rule_external.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.rule_external.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.rule_external.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/get_user_face_sample.py b/samples/api/acs/v1/get_user_face_sample.py index 80dc72f4e..1422dadef 100644 --- a/samples/api/acs/v1/get_user_face_sample.py +++ b/samples/api/acs/v1/get_user_face_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserFaceRequest = GetUserFaceRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .is_cropped(True) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetUserFaceRequest = GetUserFaceRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .is_cropped(True) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetUserFaceResponse = client.acs.v1.user_face.get(request) + # 发起请求 + response: GetUserFaceResponse = client.acs.v1.user_face.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user_face.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user_face.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserFaceRequest = GetUserFaceRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .is_cropped(True) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetUserFaceRequest = GetUserFaceRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .is_cropped(True) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetUserFaceResponse = await client.acs.v1.user_face.aget(request) + # 发起请求 + response: GetUserFaceResponse = await client.acs.v1.user_face.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user_face.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user_face.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/get_user_sample.py b/samples/api/acs/v1/get_user_sample.py index 21e4903fe..3d6357e6c 100644 --- a/samples/api/acs/v1/get_user_sample.py +++ b/samples/api/acs/v1/get_user_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserRequest = GetUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetUserRequest = GetUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetUserResponse = client.acs.v1.user.get(request) + # 发起请求 + response: GetUserResponse = client.acs.v1.user.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserRequest = GetUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetUserRequest = GetUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetUserResponse = await client.acs.v1.user.aget(request) + # 发起请求 + response: GetUserResponse = await client.acs.v1.user.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/list_access_record_sample.py b/samples/api/acs/v1/list_access_record_sample.py index f60c09a21..b2da3f376 100644 --- a/samples/api/acs/v1/list_access_record_sample.py +++ b/samples/api/acs/v1/list_access_record_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAccessRecordRequest = ListAccessRecordRequest.builder() \ - .page_size(100) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .from_(1624520521) \ - .to(1624520521) \ - .device_id("7091146989218002577") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAccessRecordRequest = ListAccessRecordRequest.builder() \ + .page_size(100) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .from_(1624520521) \ + .to(1624520521) \ + .device_id("7091146989218002577") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAccessRecordResponse = client.acs.v1.access_record.list(request) + # 发起请求 + response: ListAccessRecordResponse = client.acs.v1.access_record.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.access_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.access_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAccessRecordRequest = ListAccessRecordRequest.builder() \ - .page_size(100) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .from_(1624520521) \ - .to(1624520521) \ - .device_id("7091146989218002577") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAccessRecordRequest = ListAccessRecordRequest.builder() \ + .page_size(100) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .from_(1624520521) \ + .to(1624520521) \ + .device_id("7091146989218002577") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAccessRecordResponse = await client.acs.v1.access_record.alist(request) + # 发起请求 + response: ListAccessRecordResponse = await client.acs.v1.access_record.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.access_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.access_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/list_device_sample.py b/samples/api/acs/v1/list_device_sample.py index e175b2eb0..a1959fa40 100644 --- a/samples/api/acs/v1/list_device_sample.py +++ b/samples/api/acs/v1/list_device_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDeviceRequest = ListDeviceRequest.builder() \ - .build() + # 构造请求对象 + request: ListDeviceRequest = ListDeviceRequest.builder() \ + .build() - # 发起请求 - response: ListDeviceResponse = client.acs.v1.device.list(request) + # 发起请求 + response: ListDeviceResponse = client.acs.v1.device.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.device.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.device.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDeviceRequest = ListDeviceRequest.builder() \ - .build() + # 构造请求对象 + request: ListDeviceRequest = ListDeviceRequest.builder() \ + .build() - # 发起请求 - response: ListDeviceResponse = await client.acs.v1.device.alist(request) + # 发起请求 + response: ListDeviceResponse = await client.acs.v1.device.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.device.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.device.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/list_user_sample.py b/samples/api/acs/v1/list_user_sample.py index 6b3b79ade..7c822f90b 100644 --- a/samples/api/acs/v1/list_user_sample.py +++ b/samples/api/acs/v1/list_user_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserRequest = ListUserRequest.builder() \ - .page_size(10) \ - .page_token("10") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListUserRequest = ListUserRequest.builder() \ + .page_size(10) \ + .page_token("10") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListUserResponse = client.acs.v1.user.list(request) + # 发起请求 + response: ListUserResponse = client.acs.v1.user.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserRequest = ListUserRequest.builder() \ - .page_size(10) \ - .page_token("10") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListUserRequest = ListUserRequest.builder() \ + .page_size(10) \ + .page_token("10") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListUserResponse = await client.acs.v1.user.alist(request) + # 发起请求 + response: ListUserResponse = await client.acs.v1.user.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/patch_user_sample.py b/samples/api/acs/v1/patch_user_sample.py index 64eeef950..c2ac6eb3d 100644 --- a/samples/api/acs/v1/patch_user_sample.py +++ b/samples/api/acs/v1/patch_user_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUserRequest = PatchUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .request_body(User.builder() - .feature(Feature.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchUserRequest = PatchUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(User.builder() + .feature(Feature.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchUserResponse = client.acs.v1.user.patch(request) + # 发起请求 + response: PatchUserResponse = client.acs.v1.user.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUserRequest = PatchUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .request_body(User.builder() - .feature(Feature.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchUserRequest = PatchUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(User.builder() + .feature(Feature.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchUserResponse = await client.acs.v1.user.apatch(request) + # 发起请求 + response: PatchUserResponse = await client.acs.v1.user.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/acs/v1/update_user_face_sample.py b/samples/api/acs/v1/update_user_face_sample.py index 8a9053c19..026d0c84e 100644 --- a/samples/api/acs/v1/update_user_face_sample.py +++ b/samples/api/acs/v1/update_user_face_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UpdateUserFaceRequest = UpdateUserFaceRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .request_body(File.builder() - .files(file) - .file_type("jpg") - .file_name("efeqz12f.jpg") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UpdateUserFaceRequest = UpdateUserFaceRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(File.builder() + .files(file) + .file_type("jpg") + .file_name("efeqz12f.jpg") + .build()) \ + .build() - # 发起请求 - response: UpdateUserFaceResponse = client.acs.v1.user_face.update(request) + # 发起请求 + response: UpdateUserFaceResponse = client.acs.v1.user_face.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user_face.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user_face.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UpdateUserFaceRequest = UpdateUserFaceRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("user_id") \ - .request_body(File.builder() - .files(file) - .file_type("jpg") - .file_name("efeqz12f.jpg") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UpdateUserFaceRequest = UpdateUserFaceRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(File.builder() + .files(file) + .file_type("jpg") + .file_name("efeqz12f.jpg") + .build()) \ + .build() - # 发起请求 - response: UpdateUserFaceResponse = await client.acs.v1.user_face.aupdate(request) + # 发起请求 + response: UpdateUserFaceResponse = await client.acs.v1.user_face.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.acs.v1.user_face.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.acs.v1.user_face.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/create_badge_grant_sample.py b/samples/api/admin/v1/create_badge_grant_sample.py index d65507fcc..1f2b5ac55 100644 --- a/samples/api/admin/v1/create_badge_grant_sample.py +++ b/samples/api/admin/v1/create_badge_grant_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBadgeGrantRequest = CreateBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Grant.builder() - .name("激励勋章的授予名单") - .grant_type(0) - .time_zone("Asia/Shanghai") - .rule_detail(RuleDetail.builder().build()) - .is_grant_all(False) - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateBadgeGrantRequest = CreateBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Grant.builder() + .name("激励勋章的授予名单") + .grant_type(0) + .time_zone("Asia/Shanghai") + .rule_detail(RuleDetail.builder().build()) + .is_grant_all(False) + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeGrantResponse = client.admin.v1.badge_grant.create(request) + # 发起请求 + response: CreateBadgeGrantResponse = client.admin.v1.badge_grant.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBadgeGrantRequest = CreateBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Grant.builder() - .name("激励勋章的授予名单") - .grant_type(0) - .time_zone("Asia/Shanghai") - .rule_detail(RuleDetail.builder().build()) - .is_grant_all(False) - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateBadgeGrantRequest = CreateBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Grant.builder() + .name("激励勋章的授予名单") + .grant_type(0) + .time_zone("Asia/Shanghai") + .rule_detail(RuleDetail.builder().build()) + .is_grant_all(False) + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeGrantResponse = await client.admin.v1.badge_grant.acreate(request) + # 发起请求 + response: CreateBadgeGrantResponse = await client.admin.v1.badge_grant.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/create_badge_image_sample.py b/samples/api/admin/v1/create_badge_image_sample.py index 47ab117d8..6152873d0 100644 --- a/samples/api/admin/v1/create_badge_image_sample.py +++ b/samples/api/admin/v1/create_badge_image_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateBadgeImageRequest = CreateBadgeImageRequest.builder() \ - .request_body(CreateBadgeImageRequestBody.builder() - .image_file(file) - .image_type(1) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateBadgeImageRequest = CreateBadgeImageRequest.builder() \ + .request_body(CreateBadgeImageRequestBody.builder() + .image_file(file) + .image_type(1) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeImageResponse = client.admin.v1.badge_image.create(request) + # 发起请求 + response: CreateBadgeImageResponse = client.admin.v1.badge_image.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateBadgeImageRequest = CreateBadgeImageRequest.builder() \ - .request_body(CreateBadgeImageRequestBody.builder() - .image_file(file) - .image_type(1) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateBadgeImageRequest = CreateBadgeImageRequest.builder() \ + .request_body(CreateBadgeImageRequestBody.builder() + .image_file(file) + .image_type(1) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeImageResponse = await client.admin.v1.badge_image.acreate(request) + # 发起请求 + response: CreateBadgeImageResponse = await client.admin.v1.badge_image.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/create_badge_sample.py b/samples/api/admin/v1/create_badge_sample.py index 09cf9dbaf..daec6f0a0 100644 --- a/samples/api/admin/v1/create_badge_sample.py +++ b/samples/api/admin/v1/create_badge_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBadgeRequest = CreateBadgeRequest.builder() \ - .request_body(Badge.builder() - .name("激励勋章") - .explanation("这枚勋章为了激励员工颁发。") - .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") - .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") - .i18n_name(I18n.builder().build()) - .i18n_explanation(I18n.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateBadgeRequest = CreateBadgeRequest.builder() \ + .request_body(Badge.builder() + .name("激励勋章") + .explanation("这枚勋章为了激励员工颁发。") + .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") + .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") + .i18n_name(I18n.builder().build()) + .i18n_explanation(I18n.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeResponse = client.admin.v1.badge.create(request) + # 发起请求 + response: CreateBadgeResponse = client.admin.v1.badge.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBadgeRequest = CreateBadgeRequest.builder() \ - .request_body(Badge.builder() - .name("激励勋章") - .explanation("这枚勋章为了激励员工颁发。") - .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") - .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") - .i18n_name(I18n.builder().build()) - .i18n_explanation(I18n.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateBadgeRequest = CreateBadgeRequest.builder() \ + .request_body(Badge.builder() + .name("激励勋章") + .explanation("这枚勋章为了激励员工颁发。") + .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") + .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") + .i18n_name(I18n.builder().build()) + .i18n_explanation(I18n.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateBadgeResponse = await client.admin.v1.badge.acreate(request) + # 发起请求 + response: CreateBadgeResponse = await client.admin.v1.badge.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/delete_badge_grant_sample.py b/samples/api/admin/v1/delete_badge_grant_sample.py index fda2e74d5..81ae11049 100644 --- a/samples/api/admin/v1/delete_badge_grant_sample.py +++ b/samples/api/admin/v1/delete_badge_grant_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteBadgeGrantRequest = DeleteBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .build() + # 构造请求对象 + request: DeleteBadgeGrantRequest = DeleteBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .build() - # 发起请求 - response: DeleteBadgeGrantResponse = client.admin.v1.badge_grant.delete(request) + # 发起请求 + response: DeleteBadgeGrantResponse = client.admin.v1.badge_grant.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteBadgeGrantRequest = DeleteBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .build() + # 构造请求对象 + request: DeleteBadgeGrantRequest = DeleteBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .build() - # 发起请求 - response: DeleteBadgeGrantResponse = await client.admin.v1.badge_grant.adelete(request) + # 发起请求 + response: DeleteBadgeGrantResponse = await client.admin.v1.badge_grant.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/get_badge_grant_sample.py b/samples/api/admin/v1/get_badge_grant_sample.py index d1eca3b11..47cc8fb1c 100644 --- a/samples/api/admin/v1/get_badge_grant_sample.py +++ b/samples/api/admin/v1/get_badge_grant_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBadgeGrantRequest = GetBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetBadgeGrantRequest = GetBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetBadgeGrantResponse = client.admin.v1.badge_grant.get(request) + # 发起请求 + response: GetBadgeGrantResponse = client.admin.v1.badge_grant.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBadgeGrantRequest = GetBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetBadgeGrantRequest = GetBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetBadgeGrantResponse = await client.admin.v1.badge_grant.aget(request) + # 发起请求 + response: GetBadgeGrantResponse = await client.admin.v1.badge_grant.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/get_badge_sample.py b/samples/api/admin/v1/get_badge_sample.py index eff9634a4..f98b038f2 100644 --- a/samples/api/admin/v1/get_badge_sample.py +++ b/samples/api/admin/v1/get_badge_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBadgeRequest = GetBadgeRequest.builder() \ - .badge_id("m_DjMzaK") \ - .build() + # 构造请求对象 + request: GetBadgeRequest = GetBadgeRequest.builder() \ + .badge_id("m_DjMzaK") \ + .build() - # 发起请求 - response: GetBadgeResponse = client.admin.v1.badge.get(request) + # 发起请求 + response: GetBadgeResponse = client.admin.v1.badge.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBadgeRequest = GetBadgeRequest.builder() \ - .badge_id("m_DjMzaK") \ - .build() + # 构造请求对象 + request: GetBadgeRequest = GetBadgeRequest.builder() \ + .badge_id("m_DjMzaK") \ + .build() - # 发起请求 - response: GetBadgeResponse = await client.admin.v1.badge.aget(request) + # 发起请求 + response: GetBadgeResponse = await client.admin.v1.badge.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/list_admin_dept_stat_sample.py b/samples/api/admin/v1/list_admin_dept_stat_sample.py index 8bdac3493..eaa88cb02 100644 --- a/samples/api/admin/v1/list_admin_dept_stat_sample.py +++ b/samples/api/admin/v1/list_admin_dept_stat_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAdminDeptStatRequest = ListAdminDeptStatRequest.builder() \ - .department_id_type("open_department_id") \ - .start_date("2020-02-15") \ - .end_date("2020-02-15") \ - .department_id("od-382e2793cfc9471f892e8a672987654c") \ - .contains_child_dept(False) \ - .page_size(10) \ - .page_token("2") \ - .target_geo("cn") \ - .build() + # 构造请求对象 + request: ListAdminDeptStatRequest = ListAdminDeptStatRequest.builder() \ + .department_id_type("open_department_id") \ + .start_date("2020-02-15") \ + .end_date("2020-02-15") \ + .department_id("od-382e2793cfc9471f892e8a672987654c") \ + .contains_child_dept(False) \ + .page_size(10) \ + .page_token("2") \ + .target_geo("cn") \ + .build() - # 发起请求 - response: ListAdminDeptStatResponse = client.admin.v1.admin_dept_stat.list(request) + # 发起请求 + response: ListAdminDeptStatResponse = client.admin.v1.admin_dept_stat.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.admin_dept_stat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.admin_dept_stat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAdminDeptStatRequest = ListAdminDeptStatRequest.builder() \ - .department_id_type("open_department_id") \ - .start_date("2020-02-15") \ - .end_date("2020-02-15") \ - .department_id("od-382e2793cfc9471f892e8a672987654c") \ - .contains_child_dept(False) \ - .page_size(10) \ - .page_token("2") \ - .target_geo("cn") \ - .build() + # 构造请求对象 + request: ListAdminDeptStatRequest = ListAdminDeptStatRequest.builder() \ + .department_id_type("open_department_id") \ + .start_date("2020-02-15") \ + .end_date("2020-02-15") \ + .department_id("od-382e2793cfc9471f892e8a672987654c") \ + .contains_child_dept(False) \ + .page_size(10) \ + .page_token("2") \ + .target_geo("cn") \ + .build() - # 发起请求 - response: ListAdminDeptStatResponse = await client.admin.v1.admin_dept_stat.alist(request) + # 发起请求 + response: ListAdminDeptStatResponse = await client.admin.v1.admin_dept_stat.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.admin_dept_stat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.admin_dept_stat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/list_admin_user_stat_sample.py b/samples/api/admin/v1/list_admin_user_stat_sample.py index b1031d749..675fcfed3 100644 --- a/samples/api/admin/v1/list_admin_user_stat_sample.py +++ b/samples/api/admin/v1/list_admin_user_stat_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAdminUserStatRequest = ListAdminUserStatRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .start_date("2020-02-15") \ - .end_date("2020-02-15") \ - .department_id("od-382e2793cfc9471f892e8a672987654c") \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .page_size(10) \ - .page_token("2") \ - .target_geo("cn") \ - .build() + # 构造请求对象 + request: ListAdminUserStatRequest = ListAdminUserStatRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .start_date("2020-02-15") \ + .end_date("2020-02-15") \ + .department_id("od-382e2793cfc9471f892e8a672987654c") \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .page_size(10) \ + .page_token("2") \ + .target_geo("cn") \ + .build() - # 发起请求 - response: ListAdminUserStatResponse = client.admin.v1.admin_user_stat.list(request) + # 发起请求 + response: ListAdminUserStatResponse = client.admin.v1.admin_user_stat.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.admin_user_stat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.admin_user_stat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAdminUserStatRequest = ListAdminUserStatRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .start_date("2020-02-15") \ - .end_date("2020-02-15") \ - .department_id("od-382e2793cfc9471f892e8a672987654c") \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .page_size(10) \ - .page_token("2") \ - .target_geo("cn") \ - .build() + # 构造请求对象 + request: ListAdminUserStatRequest = ListAdminUserStatRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .start_date("2020-02-15") \ + .end_date("2020-02-15") \ + .department_id("od-382e2793cfc9471f892e8a672987654c") \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .page_size(10) \ + .page_token("2") \ + .target_geo("cn") \ + .build() - # 发起请求 - response: ListAdminUserStatResponse = await client.admin.v1.admin_user_stat.alist(request) + # 发起请求 + response: ListAdminUserStatResponse = await client.admin.v1.admin_user_stat.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.admin_user_stat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.admin_user_stat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/list_audit_info_sample.py b/samples/api/admin/v1/list_audit_info_sample.py index e1386123b..b7fe517e2 100644 --- a/samples/api/admin/v1/list_audit_info_sample.py +++ b/samples/api/admin/v1/list_audit_info_sample.py @@ -5,84 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAuditInfoRequest = ListAuditInfoRequest.builder() \ - .user_id_type("user_id") \ - .latest(1668700799) \ - .oldest(1668528000) \ - .event_name("space_create_doc") \ - .operator_type("user") \ - .operator_value("55ed16fe") \ - .event_module(1) \ - .page_token( - "LC39/f1%2B/Sz9Uv39Gf39/ew/cd5WY0gfGYFdixOW9cVk4bC79ituO/gx0qpPn1bYf92nz/kI0nNJOG3wCwDJKoNU%2BtyaXbpI8pV/9UNDMZT0BNeyanFH17Wv711Qh9anR3l2GjQfc2fUqXtxg1YPp63XyhYY4iRMv54ySRG7r%2BI89iS3zAoPzFuuU1MUJKsf") \ - .page_size(20) \ - .user_type(0) \ - .object_type(1) \ - .object_value("55ed16fe") \ - .ext_filter_object_by_ccm_token("55ed16fe") \ - .build() + # 构造请求对象 + request: ListAuditInfoRequest = ListAuditInfoRequest.builder() \ + .user_id_type("user_id") \ + .latest(1668700799) \ + .oldest(1668528000) \ + .event_name("space_create_doc") \ + .operator_type("user") \ + .operator_value("55ed16fe") \ + .event_module(1) \ + .page_token("LC39/f1%2B/Sz9Uv39Gf39/ew/cd5WY0gfGYFdixOW9cVk4bC79ituO/gx0qpPn1bYf92nz/kI0nNJOG3wCwDJKoNU%2BtyaXbpI8pV/9UNDMZT0BNeyanFH17Wv711Qh9anR3l2GjQfc2fUqXtxg1YPp63XyhYY4iRMv54ySRG7r%2BI89iS3zAoPzFuuU1MUJKsf") \ + .page_size(20) \ + .user_type(0) \ + .object_type(1) \ + .object_value("55ed16fe") \ + .ext_filter_object_by_ccm_token("55ed16fe") \ + .build() - # 发起请求 - response: ListAuditInfoResponse = client.admin.v1.audit_info.list(request) + # 发起请求 + response: ListAuditInfoResponse = client.admin.v1.audit_info.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.audit_info.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.audit_info.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAuditInfoRequest = ListAuditInfoRequest.builder() \ - .user_id_type("user_id") \ - .latest(1668700799) \ - .oldest(1668528000) \ - .event_name("space_create_doc") \ - .operator_type("user") \ - .operator_value("55ed16fe") \ - .event_module(1) \ - .page_token( - "LC39/f1%2B/Sz9Uv39Gf39/ew/cd5WY0gfGYFdixOW9cVk4bC79ituO/gx0qpPn1bYf92nz/kI0nNJOG3wCwDJKoNU%2BtyaXbpI8pV/9UNDMZT0BNeyanFH17Wv711Qh9anR3l2GjQfc2fUqXtxg1YPp63XyhYY4iRMv54ySRG7r%2BI89iS3zAoPzFuuU1MUJKsf") \ - .page_size(20) \ - .user_type(0) \ - .object_type(1) \ - .object_value("55ed16fe") \ - .ext_filter_object_by_ccm_token("55ed16fe") \ - .build() + # 构造请求对象 + request: ListAuditInfoRequest = ListAuditInfoRequest.builder() \ + .user_id_type("user_id") \ + .latest(1668700799) \ + .oldest(1668528000) \ + .event_name("space_create_doc") \ + .operator_type("user") \ + .operator_value("55ed16fe") \ + .event_module(1) \ + .page_token("LC39/f1%2B/Sz9Uv39Gf39/ew/cd5WY0gfGYFdixOW9cVk4bC79ituO/gx0qpPn1bYf92nz/kI0nNJOG3wCwDJKoNU%2BtyaXbpI8pV/9UNDMZT0BNeyanFH17Wv711Qh9anR3l2GjQfc2fUqXtxg1YPp63XyhYY4iRMv54ySRG7r%2BI89iS3zAoPzFuuU1MUJKsf") \ + .page_size(20) \ + .user_type(0) \ + .object_type(1) \ + .object_value("55ed16fe") \ + .ext_filter_object_by_ccm_token("55ed16fe") \ + .build() - # 发起请求 - response: ListAuditInfoResponse = await client.admin.v1.audit_info.alist(request) + # 发起请求 + response: ListAuditInfoResponse = await client.admin.v1.audit_info.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.audit_info.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.audit_info.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/list_badge_grant_sample.py b/samples/api/admin/v1/list_badge_grant_sample.py index 0461d7291..5ed898c0d 100644 --- a/samples/api/admin/v1/list_badge_grant_sample.py +++ b/samples/api/admin/v1/list_badge_grant_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBadgeGrantRequest = ListBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .page_size(10) \ - .page_token("om5fn1") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .name("激励勋章的授予名单") \ - .build() + # 构造请求对象 + request: ListBadgeGrantRequest = ListBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .page_size(10) \ + .page_token("om5fn1") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .name("激励勋章的授予名单") \ + .build() - # 发起请求 - response: ListBadgeGrantResponse = client.admin.v1.badge_grant.list(request) + # 发起请求 + response: ListBadgeGrantResponse = client.admin.v1.badge_grant.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBadgeGrantRequest = ListBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .page_size(10) \ - .page_token("om5fn1") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .name("激励勋章的授予名单") \ - .build() + # 构造请求对象 + request: ListBadgeGrantRequest = ListBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .page_size(10) \ + .page_token("om5fn1") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .name("激励勋章的授予名单") \ + .build() - # 发起请求 - response: ListBadgeGrantResponse = await client.admin.v1.badge_grant.alist(request) + # 发起请求 + response: ListBadgeGrantResponse = await client.admin.v1.badge_grant.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/list_badge_sample.py b/samples/api/admin/v1/list_badge_sample.py index 5c612317b..085259d31 100644 --- a/samples/api/admin/v1/list_badge_sample.py +++ b/samples/api/admin/v1/list_badge_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBadgeRequest = ListBadgeRequest.builder() \ - .page_size(10) \ - .page_token("b1fmUz") \ - .name("激励勋章") \ - .build() + # 构造请求对象 + request: ListBadgeRequest = ListBadgeRequest.builder() \ + .page_size(10) \ + .page_token("b1fmUz") \ + .name("激励勋章") \ + .build() - # 发起请求 - response: ListBadgeResponse = client.admin.v1.badge.list(request) + # 发起请求 + response: ListBadgeResponse = client.admin.v1.badge.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBadgeRequest = ListBadgeRequest.builder() \ - .page_size(10) \ - .page_token("b1fmUz") \ - .name("激励勋章") \ - .build() + # 构造请求对象 + request: ListBadgeRequest = ListBadgeRequest.builder() \ + .page_size(10) \ + .page_token("b1fmUz") \ + .name("激励勋章") \ + .build() - # 发起请求 - response: ListBadgeResponse = await client.admin.v1.badge.alist(request) + # 发起请求 + response: ListBadgeResponse = await client.admin.v1.badge.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/reset_password_sample.py b/samples/api/admin/v1/reset_password_sample.py index 3e8724df0..763c7fa23 100644 --- a/samples/api/admin/v1/reset_password_sample.py +++ b/samples/api/admin/v1/reset_password_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResetPasswordRequest = ResetPasswordRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ResetPasswordRequestBody.builder() - .password(Password.builder().build()) - .user_id("abc123") - .build()) \ - .build() + # 构造请求对象 + request: ResetPasswordRequest = ResetPasswordRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ResetPasswordRequestBody.builder() + .password(Password.builder().build()) + .user_id("abc123") + .build()) \ + .build() - # 发起请求 - response: ResetPasswordResponse = client.admin.v1.password.reset(request) + # 发起请求 + response: ResetPasswordResponse = client.admin.v1.password.reset(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.password.reset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.password.reset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResetPasswordRequest = ResetPasswordRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ResetPasswordRequestBody.builder() - .password(Password.builder().build()) - .user_id("abc123") - .build()) \ - .build() + # 构造请求对象 + request: ResetPasswordRequest = ResetPasswordRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ResetPasswordRequestBody.builder() + .password(Password.builder().build()) + .user_id("abc123") + .build()) \ + .build() - # 发起请求 - response: ResetPasswordResponse = await client.admin.v1.password.areset(request) + # 发起请求 + response: ResetPasswordResponse = await client.admin.v1.password.areset(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.password.areset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.password.areset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/update_badge_grant_sample.py b/samples/api/admin/v1/update_badge_grant_sample.py index 3b057ae02..3698c60ec 100644 --- a/samples/api/admin/v1/update_badge_grant_sample.py +++ b/samples/api/admin/v1/update_badge_grant_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBadgeGrantRequest = UpdateBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Grant.builder() - .name("激励勋章的授予名单") - .grant_type(0) - .time_zone("Asia/Shanghai") - .rule_detail(RuleDetail.builder().build()) - .is_grant_all(False) - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBadgeGrantRequest = UpdateBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Grant.builder() + .name("激励勋章的授予名单") + .grant_type(0) + .time_zone("Asia/Shanghai") + .rule_detail(RuleDetail.builder().build()) + .is_grant_all(False) + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: UpdateBadgeGrantResponse = client.admin.v1.badge_grant.update(request) + # 发起请求 + response: UpdateBadgeGrantResponse = client.admin.v1.badge_grant.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBadgeGrantRequest = UpdateBadgeGrantRequest.builder() \ - .badge_id("m_DjMzaK") \ - .grant_id("g_uS4yux") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Grant.builder() - .name("激励勋章的授予名单") - .grant_type(0) - .time_zone("Asia/Shanghai") - .rule_detail(RuleDetail.builder().build()) - .is_grant_all(False) - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBadgeGrantRequest = UpdateBadgeGrantRequest.builder() \ + .badge_id("m_DjMzaK") \ + .grant_id("g_uS4yux") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Grant.builder() + .name("激励勋章的授予名单") + .grant_type(0) + .time_zone("Asia/Shanghai") + .rule_detail(RuleDetail.builder().build()) + .is_grant_all(False) + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: UpdateBadgeGrantResponse = await client.admin.v1.badge_grant.aupdate(request) + # 发起请求 + response: UpdateBadgeGrantResponse = await client.admin.v1.badge_grant.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge_grant.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge_grant.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/admin/v1/update_badge_sample.py b/samples/api/admin/v1/update_badge_sample.py index 562af01ec..032cd2aa8 100644 --- a/samples/api/admin/v1/update_badge_sample.py +++ b/samples/api/admin/v1/update_badge_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBadgeRequest = UpdateBadgeRequest.builder() \ - .badge_id("m_MzfKDM") \ - .request_body(Badge.builder() - .name("激励勋章") - .explanation("这枚勋章为了激励员工颁发。") - .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") - .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") - .i18n_name(I18n.builder().build()) - .i18n_explanation(I18n.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBadgeRequest = UpdateBadgeRequest.builder() \ + .badge_id("m_MzfKDM") \ + .request_body(Badge.builder() + .name("激励勋章") + .explanation("这枚勋章为了激励员工颁发。") + .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") + .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") + .i18n_name(I18n.builder().build()) + .i18n_explanation(I18n.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateBadgeResponse = client.admin.v1.badge.update(request) + # 发起请求 + response: UpdateBadgeResponse = client.admin.v1.badge.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBadgeRequest = UpdateBadgeRequest.builder() \ - .badge_id("m_MzfKDM") \ - .request_body(Badge.builder() - .name("激励勋章") - .explanation("这枚勋章为了激励员工颁发。") - .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") - .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") - .i18n_name(I18n.builder().build()) - .i18n_explanation(I18n.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBadgeRequest = UpdateBadgeRequest.builder() \ + .badge_id("m_MzfKDM") \ + .request_body(Badge.builder() + .name("激励勋章") + .explanation("这枚勋章为了激励员工颁发。") + .detail_image("75a1949f-d9df-4b46-bc88-dacc51e88f3j") + .show_image("03daa74a-159f-49e9-963e-b6c4d76103fj") + .i18n_name(I18n.builder().build()) + .i18n_explanation(I18n.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateBadgeResponse = await client.admin.v1.badge.aupdate(request) + # 发起请求 + response: UpdateBadgeResponse = await client.admin.v1.badge.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.admin.v1.badge.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.admin.v1.badge.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/cancel_aily_session_run_sample.py b/samples/api/aily/v1/cancel_aily_session_run_sample.py index c52f4f83b..ac888b1f9 100644 --- a/samples/api/aily/v1/cancel_aily_session_run_sample.py +++ b/samples/api/aily/v1/cancel_aily_session_run_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelAilySessionRunRequest = CancelAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .run_id("run_4dfrxvctjqzzj") \ - .build() + # 构造请求对象 + request: CancelAilySessionRunRequest = CancelAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .run_id("run_4dfrxvctjqzzj") \ + .build() - # 发起请求 - response: CancelAilySessionRunResponse = client.aily.v1.aily_session_run.cancel(request) + # 发起请求 + response: CancelAilySessionRunResponse = client.aily.v1.aily_session_run.cancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelAilySessionRunRequest = CancelAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .run_id("run_4dfrxvctjqzzj") \ - .build() + # 构造请求对象 + request: CancelAilySessionRunRequest = CancelAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .run_id("run_4dfrxvctjqzzj") \ + .build() - # 发起请求 - response: CancelAilySessionRunResponse = await client.aily.v1.aily_session_run.acancel(request) + # 发起请求 + response: CancelAilySessionRunResponse = await client.aily.v1.aily_session_run.acancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/create_aily_session_aily_message_sample.py b/samples/api/aily/v1/create_aily_session_aily_message_sample.py index bbd45425d..7d54abda3 100644 --- a/samples/api/aily/v1/create_aily_session_aily_message_sample.py +++ b/samples/api/aily/v1/create_aily_session_aily_message_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionAilyMessageRequest = CreateAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(CreateAilySessionAilyMessageRequestBody.builder() - .idempotent_id("idempotent_id_1") - .content_type("MDX") - .content("你好") - .file_ids([]) - .quote_message_id("message_4de9bpg70qskh") - .mentions([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionAilyMessageRequest = CreateAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(CreateAilySessionAilyMessageRequestBody.builder() + .idempotent_id("idempotent_id_1") + .content_type("MDX") + .content("你好") + .file_ids([]) + .quote_message_id("message_4de9bpg70qskh") + .mentions([]) + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.create(request) + # 发起请求 + response: CreateAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionAilyMessageRequest = CreateAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(CreateAilySessionAilyMessageRequestBody.builder() - .idempotent_id("idempotent_id_1") - .content_type("MDX") - .content("你好") - .file_ids([]) - .quote_message_id("message_4de9bpg70qskh") - .mentions([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionAilyMessageRequest = CreateAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(CreateAilySessionAilyMessageRequestBody.builder() + .idempotent_id("idempotent_id_1") + .content_type("MDX") + .content("你好") + .file_ids([]) + .quote_message_id("message_4de9bpg70qskh") + .mentions([]) + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.acreate(request) + # 发起请求 + response: CreateAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/create_aily_session_run_sample.py b/samples/api/aily/v1/create_aily_session_run_sample.py index 13e77dda2..21fb3484e 100644 --- a/samples/api/aily/v1/create_aily_session_run_sample.py +++ b/samples/api/aily/v1/create_aily_session_run_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionRunRequest = CreateAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(CreateAilySessionRunRequestBody.builder() - .app_id("spring_xxx__c") - .skill_id("skill_6cc6166178ca") - .skill_input("") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionRunRequest = CreateAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(CreateAilySessionRunRequestBody.builder() + .app_id("spring_xxx__c") + .skill_id("skill_6cc6166178ca") + .skill_input("") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionRunResponse = client.aily.v1.aily_session_run.create(request) + # 发起请求 + response: CreateAilySessionRunResponse = client.aily.v1.aily_session_run.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionRunRequest = CreateAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(CreateAilySessionRunRequestBody.builder() - .app_id("spring_xxx__c") - .skill_id("skill_6cc6166178ca") - .skill_input("") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionRunRequest = CreateAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(CreateAilySessionRunRequestBody.builder() + .app_id("spring_xxx__c") + .skill_id("skill_6cc6166178ca") + .skill_input("") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionRunResponse = await client.aily.v1.aily_session_run.acreate(request) + # 发起请求 + response: CreateAilySessionRunResponse = await client.aily.v1.aily_session_run.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/create_aily_session_sample.py b/samples/api/aily/v1/create_aily_session_sample.py index 3c6acc281..6a30f87e5 100644 --- a/samples/api/aily/v1/create_aily_session_sample.py +++ b/samples/api/aily/v1/create_aily_session_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionRequest = CreateAilySessionRequest.builder() \ - .request_body(CreateAilySessionRequestBody.builder() - .channel_context("{}") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionRequest = CreateAilySessionRequest.builder() \ + .request_body(CreateAilySessionRequestBody.builder() + .channel_context("{}") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionResponse = client.aily.v1.aily_session.create(request) + # 发起请求 + response: CreateAilySessionResponse = client.aily.v1.aily_session.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAilySessionRequest = CreateAilySessionRequest.builder() \ - .request_body(CreateAilySessionRequestBody.builder() - .channel_context("{}") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateAilySessionRequest = CreateAilySessionRequest.builder() \ + .request_body(CreateAilySessionRequestBody.builder() + .channel_context("{}") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: CreateAilySessionResponse = await client.aily.v1.aily_session.acreate(request) + # 发起请求 + response: CreateAilySessionResponse = await client.aily.v1.aily_session.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/delete_aily_session_sample.py b/samples/api/aily/v1/delete_aily_session_sample.py index 9f6704ca6..28bd22c0e 100644 --- a/samples/api/aily/v1/delete_aily_session_sample.py +++ b/samples/api/aily/v1/delete_aily_session_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAilySessionRequest = DeleteAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .build() + # 构造请求对象 + request: DeleteAilySessionRequest = DeleteAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .build() - # 发起请求 - response: DeleteAilySessionResponse = client.aily.v1.aily_session.delete(request) + # 发起请求 + response: DeleteAilySessionResponse = client.aily.v1.aily_session.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAilySessionRequest = DeleteAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .build() + # 构造请求对象 + request: DeleteAilySessionRequest = DeleteAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .build() - # 发起请求 - response: DeleteAilySessionResponse = await client.aily.v1.aily_session.adelete(request) + # 发起请求 + response: DeleteAilySessionResponse = await client.aily.v1.aily_session.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/get_aily_session_aily_message_sample.py b/samples/api/aily/v1/get_aily_session_aily_message_sample.py index 3c53aa88f..23c23a99f 100644 --- a/samples/api/aily/v1/get_aily_session_aily_message_sample.py +++ b/samples/api/aily/v1/get_aily_session_aily_message_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionAilyMessageRequest = GetAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .aily_message_id("message_4df45f2xknvcc") \ - .build() + # 构造请求对象 + request: GetAilySessionAilyMessageRequest = GetAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .aily_message_id("message_4df45f2xknvcc") \ + .build() - # 发起请求 - response: GetAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.get(request) + # 发起请求 + response: GetAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionAilyMessageRequest = GetAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .aily_message_id("message_4df45f2xknvcc") \ - .build() + # 构造请求对象 + request: GetAilySessionAilyMessageRequest = GetAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .aily_message_id("message_4df45f2xknvcc") \ + .build() - # 发起请求 - response: GetAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.aget(request) + # 发起请求 + response: GetAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/get_aily_session_run_sample.py b/samples/api/aily/v1/get_aily_session_run_sample.py index a1cbc5041..b42c5ea9f 100644 --- a/samples/api/aily/v1/get_aily_session_run_sample.py +++ b/samples/api/aily/v1/get_aily_session_run_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionRunRequest = GetAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .run_id("run_4dfrxvctjqzzj") \ - .build() + # 构造请求对象 + request: GetAilySessionRunRequest = GetAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .run_id("run_4dfrxvctjqzzj") \ + .build() - # 发起请求 - response: GetAilySessionRunResponse = client.aily.v1.aily_session_run.get(request) + # 发起请求 + response: GetAilySessionRunResponse = client.aily.v1.aily_session_run.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionRunRequest = GetAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .run_id("run_4dfrxvctjqzzj") \ - .build() + # 构造请求对象 + request: GetAilySessionRunRequest = GetAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .run_id("run_4dfrxvctjqzzj") \ + .build() - # 发起请求 - response: GetAilySessionRunResponse = await client.aily.v1.aily_session_run.aget(request) + # 发起请求 + response: GetAilySessionRunResponse = await client.aily.v1.aily_session_run.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/get_aily_session_sample.py b/samples/api/aily/v1/get_aily_session_sample.py index d9bd49722..c3f6a14a6 100644 --- a/samples/api/aily/v1/get_aily_session_sample.py +++ b/samples/api/aily/v1/get_aily_session_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionRequest = GetAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .build() + # 构造请求对象 + request: GetAilySessionRequest = GetAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .build() - # 发起请求 - response: GetAilySessionResponse = client.aily.v1.aily_session.get(request) + # 发起请求 + response: GetAilySessionResponse = client.aily.v1.aily_session.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAilySessionRequest = GetAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .build() + # 构造请求对象 + request: GetAilySessionRequest = GetAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .build() - # 发起请求 - response: GetAilySessionResponse = await client.aily.v1.aily_session.aget(request) + # 发起请求 + response: GetAilySessionResponse = await client.aily.v1.aily_session.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/list_aily_session_aily_message_sample.py b/samples/api/aily/v1/list_aily_session_aily_message_sample.py index c6be9a633..e79540d29 100644 --- a/samples/api/aily/v1/list_aily_session_aily_message_sample.py +++ b/samples/api/aily/v1/list_aily_session_aily_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAilySessionAilyMessageRequest = ListAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .page_size(int) \ - .page_token("str") \ - .run_id("run_4dfrxvctjqzzj") \ - .with_partial_message(False) \ - .build() + # 构造请求对象 + request: ListAilySessionAilyMessageRequest = ListAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .page_size(int) \ + .page_token("str") \ + .run_id("run_4dfrxvctjqzzj") \ + .with_partial_message(False) \ + .build() - # 发起请求 - response: ListAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.list(request) + # 发起请求 + response: ListAilySessionAilyMessageResponse = client.aily.v1.aily_session_aily_message.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAilySessionAilyMessageRequest = ListAilySessionAilyMessageRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .page_size(int) \ - .page_token("str") \ - .run_id("run_4dfrxvctjqzzj") \ - .with_partial_message(False) \ - .build() + # 构造请求对象 + request: ListAilySessionAilyMessageRequest = ListAilySessionAilyMessageRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .page_size(int) \ + .page_token("str") \ + .run_id("run_4dfrxvctjqzzj") \ + .with_partial_message(False) \ + .build() - # 发起请求 - response: ListAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.alist(request) + # 发起请求 + response: ListAilySessionAilyMessageResponse = await client.aily.v1.aily_session_aily_message.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_aily_message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_aily_message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/list_aily_session_run_sample.py b/samples/api/aily/v1/list_aily_session_run_sample.py index 0cf73c547..f466b8137 100644 --- a/samples/api/aily/v1/list_aily_session_run_sample.py +++ b/samples/api/aily/v1/list_aily_session_run_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAilySessionRunRequest = ListAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListAilySessionRunRequest = ListAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListAilySessionRunResponse = client.aily.v1.aily_session_run.list(request) + # 发起请求 + response: ListAilySessionRunResponse = client.aily.v1.aily_session_run.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAilySessionRunRequest = ListAilySessionRunRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListAilySessionRunRequest = ListAilySessionRunRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListAilySessionRunResponse = await client.aily.v1.aily_session_run.alist(request) + # 发起请求 + response: ListAilySessionRunResponse = await client.aily.v1.aily_session_run.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session_run.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session_run.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/aily/v1/update_aily_session_sample.py b/samples/api/aily/v1/update_aily_session_sample.py index 30c188915..e60077e2f 100644 --- a/samples/api/aily/v1/update_aily_session_sample.py +++ b/samples/api/aily/v1/update_aily_session_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAilySessionRequest = UpdateAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(UpdateAilySessionRequestBody.builder() - .channel_context("{}") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: UpdateAilySessionRequest = UpdateAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(UpdateAilySessionRequestBody.builder() + .channel_context("{}") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: UpdateAilySessionResponse = client.aily.v1.aily_session.update(request) + # 发起请求 + response: UpdateAilySessionResponse = client.aily.v1.aily_session.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAilySessionRequest = UpdateAilySessionRequest.builder() \ - .aily_session_id("session_4dfunz7sp1g8m") \ - .request_body(UpdateAilySessionRequestBody.builder() - .channel_context("{}") - .metadata("{}") - .build()) \ - .build() + # 构造请求对象 + request: UpdateAilySessionRequest = UpdateAilySessionRequest.builder() \ + .aily_session_id("session_4dfunz7sp1g8m") \ + .request_body(UpdateAilySessionRequestBody.builder() + .channel_context("{}") + .metadata("{}") + .build()) \ + .build() - # 发起请求 - response: UpdateAilySessionResponse = await client.aily.v1.aily_session.aupdate(request) + # 发起请求 + response: UpdateAilySessionResponse = await client.aily.v1.aily_session.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.aily.v1.aily_session.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.aily.v1.aily_session.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/check_white_black_list_application_visibility_sample.py b/samples/api/application/v6/check_white_black_list_application_visibility_sample.py index dab68f774..b83fd3f17 100644 --- a/samples/api/application/v6/check_white_black_list_application_visibility_sample.py +++ b/samples/api/application/v6/check_white_black_list_application_visibility_sample.py @@ -5,74 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CheckWhiteBlackListApplicationVisibilityRequest = CheckWhiteBlackListApplicationVisibilityRequest.builder() \ - .app_id("cli_a3a3d00b40b8d01b") \ - .user_id_type("open_id") \ - .department_id_type("department_id") \ - .request_body(CheckWhiteBlackListApplicationVisibilityRequestBody.builder() - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CheckWhiteBlackListApplicationVisibilityRequest = CheckWhiteBlackListApplicationVisibilityRequest.builder() \ + .app_id("cli_a3a3d00b40b8d01b") \ + .user_id_type("open_id") \ + .department_id_type("department_id") \ + .request_body(CheckWhiteBlackListApplicationVisibilityRequestBody.builder() + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: CheckWhiteBlackListApplicationVisibilityResponse = client.application.v6.application_visibility.check_white_black_list( - request) + # 发起请求 + response: CheckWhiteBlackListApplicationVisibilityResponse = client.application.v6.application_visibility.check_white_black_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_visibility.check_white_black_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_visibility.check_white_black_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CheckWhiteBlackListApplicationVisibilityRequest = CheckWhiteBlackListApplicationVisibilityRequest.builder() \ - .app_id("cli_a3a3d00b40b8d01b") \ - .user_id_type("open_id") \ - .department_id_type("department_id") \ - .request_body(CheckWhiteBlackListApplicationVisibilityRequestBody.builder() - .user_ids([]) - .department_ids([]) - .group_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CheckWhiteBlackListApplicationVisibilityRequest = CheckWhiteBlackListApplicationVisibilityRequest.builder() \ + .app_id("cli_a3a3d00b40b8d01b") \ + .user_id_type("open_id") \ + .department_id_type("department_id") \ + .request_body(CheckWhiteBlackListApplicationVisibilityRequestBody.builder() + .user_ids([]) + .department_ids([]) + .group_ids([]) + .build()) \ + .build() - # 发起请求 - response: CheckWhiteBlackListApplicationVisibilityResponse = await client.application.v6.application_visibility.acheck_white_black_list( - request) + # 发起请求 + response: CheckWhiteBlackListApplicationVisibilityResponse = await client.application.v6.application_visibility.acheck_white_black_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_visibility.acheck_white_black_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_visibility.acheck_white_black_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/contacts_range_configuration_application_sample.py b/samples/api/application/v6/contacts_range_configuration_application_sample.py index 07a9da338..1fce212c2 100644 --- a/samples/api/application/v6/contacts_range_configuration_application_sample.py +++ b/samples/api/application/v6/contacts_range_configuration_application_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ContactsRangeConfigurationApplicationRequest = ContactsRangeConfigurationApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .page_size(50) \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ContactsRangeConfigurationApplicationRequest = ContactsRangeConfigurationApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .page_size(50) \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ContactsRangeConfigurationApplicationResponse = client.application.v6.application.contacts_range_configuration( - request) + # 发起请求 + response: ContactsRangeConfigurationApplicationResponse = client.application.v6.application.contacts_range_configuration(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.contacts_range_configuration failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.contacts_range_configuration failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ContactsRangeConfigurationApplicationRequest = ContactsRangeConfigurationApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .page_size(50) \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ContactsRangeConfigurationApplicationRequest = ContactsRangeConfigurationApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .page_size(50) \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ContactsRangeConfigurationApplicationResponse = await client.application.v6.application.acontacts_range_configuration( - request) + # 发起请求 + response: ContactsRangeConfigurationApplicationResponse = await client.application.v6.application.acontacts_range_configuration(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.acontacts_range_configuration failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.acontacts_range_configuration failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/contacts_range_suggest_application_app_version_sample.py b/samples/api/application/v6/contacts_range_suggest_application_app_version_sample.py index d86f54917..19640e583 100644 --- a/samples/api/application/v6/contacts_range_suggest_application_app_version_sample.py +++ b/samples/api/application/v6/contacts_range_suggest_application_app_version_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ContactsRangeSuggestApplicationAppVersionRequest = ContactsRangeSuggestApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ContactsRangeSuggestApplicationAppVersionRequest = ContactsRangeSuggestApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ContactsRangeSuggestApplicationAppVersionResponse = client.application.v6.application_app_version.contacts_range_suggest( - request) + # 发起请求 + response: ContactsRangeSuggestApplicationAppVersionResponse = client.application.v6.application_app_version.contacts_range_suggest(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.contacts_range_suggest failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.contacts_range_suggest failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ContactsRangeSuggestApplicationAppVersionRequest = ContactsRangeSuggestApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ContactsRangeSuggestApplicationAppVersionRequest = ContactsRangeSuggestApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ContactsRangeSuggestApplicationAppVersionResponse = await client.application.v6.application_app_version.acontacts_range_suggest( - request) + # 发起请求 + response: ContactsRangeSuggestApplicationAppVersionResponse = await client.application.v6.application_app_version.acontacts_range_suggest(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.acontacts_range_suggest failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.acontacts_range_suggest failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/department_overview_application_app_usage_sample.py b/samples/api/application/v6/department_overview_application_app_usage_sample.py index 795e6b0c1..49a9c41f4 100644 --- a/samples/api/application/v6/department_overview_application_app_usage_sample.py +++ b/samples/api/application/v6/department_overview_application_app_usage_sample.py @@ -5,78 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DepartmentOverviewApplicationAppUsageRequest = DepartmentOverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(DepartmentOverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .recursion(0) - .page_size(10) - .page_token("new-1a8f509162ca3c95405838d05ccded09") - .build()) \ - .build() + # 构造请求对象 + request: DepartmentOverviewApplicationAppUsageRequest = DepartmentOverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(DepartmentOverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .recursion(0) + .page_size(10) + .page_token("new-1a8f509162ca3c95405838d05ccded09") + .build()) \ + .build() - # 发起请求 - response: DepartmentOverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.department_overview( - request) + # 发起请求 + response: DepartmentOverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.department_overview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.department_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.department_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DepartmentOverviewApplicationAppUsageRequest = DepartmentOverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(DepartmentOverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .recursion(0) - .page_size(10) - .page_token("new-1a8f509162ca3c95405838d05ccded09") - .build()) \ - .build() + # 构造请求对象 + request: DepartmentOverviewApplicationAppUsageRequest = DepartmentOverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(DepartmentOverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .recursion(0) + .page_size(10) + .page_token("new-1a8f509162ca3c95405838d05ccded09") + .build()) \ + .build() - # 发起请求 - response: DepartmentOverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.adepartment_overview( - request) + # 发起请求 + response: DepartmentOverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.adepartment_overview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.adepartment_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.adepartment_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/get_application_app_version_sample.py b/samples/api/application/v6/get_application_app_version_sample.py index 821708022..21da2653f 100644 --- a/samples/api/application/v6/get_application_app_version_sample.py +++ b/samples/api/application/v6/get_application_app_version_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationAppVersionRequest = GetApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .lang("zh_cn") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApplicationAppVersionRequest = GetApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .lang("zh_cn") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApplicationAppVersionResponse = client.application.v6.application_app_version.get(request) + # 发起请求 + response: GetApplicationAppVersionResponse = client.application.v6.application_app_version.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationAppVersionRequest = GetApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .lang("zh_cn") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApplicationAppVersionRequest = GetApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .lang("zh_cn") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApplicationAppVersionResponse = await client.application.v6.application_app_version.aget(request) + # 发起请求 + response: GetApplicationAppVersionResponse = await client.application.v6.application_app_version.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/get_application_sample.py b/samples/api/application/v6/get_application_sample.py index 3d5119749..11ae9f68c 100644 --- a/samples/api/application/v6/get_application_sample.py +++ b/samples/api/application/v6/get_application_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationRequest = GetApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApplicationRequest = GetApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApplicationResponse = client.application.v6.application.get(request) + # 发起请求 + response: GetApplicationResponse = client.application.v6.application.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationRequest = GetApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApplicationRequest = GetApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApplicationResponse = await client.application.v6.application.aget(request) + # 发起请求 + response: GetApplicationResponse = await client.application.v6.application.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/list_app_recommend_rule_sample.py b/samples/api/application/v6/list_app_recommend_rule_sample.py index 540c60127..d0d89e63f 100644 --- a/samples/api/application/v6/list_app_recommend_rule_sample.py +++ b/samples/api/application/v6/list_app_recommend_rule_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRecommendRuleRequest = ListAppRecommendRuleRequest.builder() \ - .page_size(10) \ - .page_token("new-e11ee058b4a8ed2881da11ac7e37c4fc") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAppRecommendRuleRequest = ListAppRecommendRuleRequest.builder() \ + .page_size(10) \ + .page_token("new-e11ee058b4a8ed2881da11ac7e37c4fc") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAppRecommendRuleResponse = client.application.v6.app_recommend_rule.list(request) + # 发起请求 + response: ListAppRecommendRuleResponse = client.application.v6.app_recommend_rule.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.app_recommend_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.app_recommend_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRecommendRuleRequest = ListAppRecommendRuleRequest.builder() \ - .page_size(10) \ - .page_token("new-e11ee058b4a8ed2881da11ac7e37c4fc") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAppRecommendRuleRequest = ListAppRecommendRuleRequest.builder() \ + .page_size(10) \ + .page_token("new-e11ee058b4a8ed2881da11ac7e37c4fc") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAppRecommendRuleResponse = await client.application.v6.app_recommend_rule.alist(request) + # 发起请求 + response: ListAppRecommendRuleResponse = await client.application.v6.app_recommend_rule.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.app_recommend_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.app_recommend_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/list_application_app_version_sample.py b/samples/api/application/v6/list_application_app_version_sample.py index c8f131c4c..2ef4ee172 100644 --- a/samples/api/application/v6/list_application_app_version_sample.py +++ b/samples/api/application/v6/list_application_app_version_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationAppVersionRequest = ListApplicationAppVersionRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .page_size(20) \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .order(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListApplicationAppVersionRequest = ListApplicationAppVersionRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .page_size(20) \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .order(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListApplicationAppVersionResponse = client.application.v6.application_app_version.list(request) + # 发起请求 + response: ListApplicationAppVersionResponse = client.application.v6.application_app_version.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationAppVersionRequest = ListApplicationAppVersionRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .page_size(20) \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .order(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListApplicationAppVersionRequest = ListApplicationAppVersionRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .page_size(20) \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .order(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListApplicationAppVersionResponse = await client.application.v6.application_app_version.alist(request) + # 发起请求 + response: ListApplicationAppVersionResponse = await client.application.v6.application_app_version.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/list_application_feedback_sample.py b/samples/api/application/v6/list_application_feedback_sample.py index 0be9991e9..0a8fd4ed7 100644 --- a/samples/api/application/v6/list_application_feedback_sample.py +++ b/samples/api/application/v6/list_application_feedback_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationFeedbackRequest = ListApplicationFeedbackRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .from_date("2022-01-30") \ - .to_date("2022-01-30") \ - .feedback_type(1) \ - .status(0) \ - .user_id_type("open_id") \ - .page_token("") \ - .page_size(100) \ - .build() + # 构造请求对象 + request: ListApplicationFeedbackRequest = ListApplicationFeedbackRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .from_date("2022-01-30") \ + .to_date("2022-01-30") \ + .feedback_type(1) \ + .status(0) \ + .user_id_type("open_id") \ + .page_token("") \ + .page_size(100) \ + .build() - # 发起请求 - response: ListApplicationFeedbackResponse = client.application.v6.application_feedback.list(request) + # 发起请求 + response: ListApplicationFeedbackResponse = client.application.v6.application_feedback.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_feedback.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_feedback.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationFeedbackRequest = ListApplicationFeedbackRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .from_date("2022-01-30") \ - .to_date("2022-01-30") \ - .feedback_type(1) \ - .status(0) \ - .user_id_type("open_id") \ - .page_token("") \ - .page_size(100) \ - .build() + # 构造请求对象 + request: ListApplicationFeedbackRequest = ListApplicationFeedbackRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .from_date("2022-01-30") \ + .to_date("2022-01-30") \ + .feedback_type(1) \ + .status(0) \ + .user_id_type("open_id") \ + .page_token("") \ + .page_size(100) \ + .build() - # 发起请求 - response: ListApplicationFeedbackResponse = await client.application.v6.application_feedback.alist(request) + # 发起请求 + response: ListApplicationFeedbackResponse = await client.application.v6.application_feedback.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_feedback.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_feedback.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/message_push_overview_application_app_usage_sample.py b/samples/api/application/v6/message_push_overview_application_app_usage_sample.py index d90158fac..5a95b5abe 100644 --- a/samples/api/application/v6/message_push_overview_application_app_usage_sample.py +++ b/samples/api/application/v6/message_push_overview_application_app_usage_sample.py @@ -5,72 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MessagePushOverviewApplicationAppUsageRequest = MessagePushOverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(MessagePushOverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .build()) \ - .build() + # 构造请求对象 + request: MessagePushOverviewApplicationAppUsageRequest = MessagePushOverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(MessagePushOverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .build()) \ + .build() - # 发起请求 - response: MessagePushOverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.message_push_overview( - request) + # 发起请求 + response: MessagePushOverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.message_push_overview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.message_push_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.message_push_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MessagePushOverviewApplicationAppUsageRequest = MessagePushOverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(MessagePushOverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .build()) \ - .build() + # 构造请求对象 + request: MessagePushOverviewApplicationAppUsageRequest = MessagePushOverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(MessagePushOverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .build()) \ + .build() - # 发起请求 - response: MessagePushOverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.amessage_push_overview( - request) + # 发起请求 + response: MessagePushOverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.amessage_push_overview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.amessage_push_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.amessage_push_overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/overview_application_app_usage_sample.py b/samples/api/application/v6/overview_application_app_usage_sample.py index 61544b235..76d641e91 100644 --- a/samples/api/application/v6/overview_application_app_usage_sample.py +++ b/samples/api/application/v6/overview_application_app_usage_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OverviewApplicationAppUsageRequest = OverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(OverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .ability("app") - .build()) \ - .build() + # 构造请求对象 + request: OverviewApplicationAppUsageRequest = OverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(OverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .ability("app") + .build()) \ + .build() - # 发起请求 - response: OverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.overview(request) + # 发起请求 + response: OverviewApplicationAppUsageResponse = client.application.v6.application_app_usage.overview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.overview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OverviewApplicationAppUsageRequest = OverviewApplicationAppUsageRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .department_id_type("open_department_id") \ - .request_body(OverviewApplicationAppUsageRequestBody.builder() - .date("2021-07-08") - .cycle_type(1) - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .ability("app") - .build()) \ - .build() + # 构造请求对象 + request: OverviewApplicationAppUsageRequest = OverviewApplicationAppUsageRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .department_id_type("open_department_id") \ + .request_body(OverviewApplicationAppUsageRequestBody.builder() + .date("2021-07-08") + .cycle_type(1) + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .ability("app") + .build()) \ + .build() - # 发起请求 - response: OverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.aoverview(request) + # 发起请求 + response: OverviewApplicationAppUsageResponse = await client.application.v6.application_app_usage.aoverview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_usage.aoverview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_usage.aoverview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/patch_application_app_version_sample.py b/samples/api/application/v6/patch_application_app_version_sample.py index 8a96f859c..c1268a468 100644 --- a/samples/api/application/v6/patch_application_app_version_sample.py +++ b/samples/api/application/v6/patch_application_app_version_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationAppVersionRequest = PatchApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .user_id_type("user_id") \ - .operator_id("ou_4065981088f8ef67a504ba8bd6b24d85") \ - .reject_reason("拒绝理由") \ - .request_body(ApplicationAppVersion.builder() - .status(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationAppVersionRequest = PatchApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .user_id_type("user_id") \ + .operator_id("ou_4065981088f8ef67a504ba8bd6b24d85") \ + .reject_reason("拒绝理由") \ + .request_body(ApplicationAppVersion.builder() + .status(1) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationAppVersionResponse = client.application.v6.application_app_version.patch(request) + # 发起请求 + response: PatchApplicationAppVersionResponse = client.application.v6.application_app_version.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationAppVersionRequest = PatchApplicationAppVersionRequest.builder() \ - .app_id("cli_9f3ca975326b501b") \ - .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ - .user_id_type("user_id") \ - .operator_id("ou_4065981088f8ef67a504ba8bd6b24d85") \ - .reject_reason("拒绝理由") \ - .request_body(ApplicationAppVersion.builder() - .status(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationAppVersionRequest = PatchApplicationAppVersionRequest.builder() \ + .app_id("cli_9f3ca975326b501b") \ + .version_id("oav_d317f090b7258ad0372aa53963cda70d") \ + .user_id_type("user_id") \ + .operator_id("ou_4065981088f8ef67a504ba8bd6b24d85") \ + .reject_reason("拒绝理由") \ + .request_body(ApplicationAppVersion.builder() + .status(1) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationAppVersionResponse = await client.application.v6.application_app_version.apatch(request) + # 发起请求 + response: PatchApplicationAppVersionResponse = await client.application.v6.application_app_version.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_app_version.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_app_version.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/patch_application_contacts_range_sample.py b/samples/api/application/v6/patch_application_contacts_range_sample.py index 0c78af6ba..00967637d 100644 --- a/samples/api/application/v6/patch_application_contacts_range_sample.py +++ b/samples/api/application/v6/patch_application_contacts_range_sample.py @@ -5,73 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationContactsRangeRequest = PatchApplicationContactsRangeRequest.builder() \ - .app_id("cli_dsfjksdfee1") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(PatchApplicationContactsRangeRequestBody.builder() - .contacts_range_type("some") - .add_visible_list(AppContactsRangeIdList.builder().build()) - .del_visible_list(AppContactsRangeIdList.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationContactsRangeRequest = PatchApplicationContactsRangeRequest.builder() \ + .app_id("cli_dsfjksdfee1") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(PatchApplicationContactsRangeRequestBody.builder() + .contacts_range_type("some") + .add_visible_list(AppContactsRangeIdList.builder().build()) + .del_visible_list(AppContactsRangeIdList.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationContactsRangeResponse = client.application.v6.application_contacts_range.patch(request) + # 发起请求 + response: PatchApplicationContactsRangeResponse = client.application.v6.application_contacts_range.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_contacts_range.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_contacts_range.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationContactsRangeRequest = PatchApplicationContactsRangeRequest.builder() \ - .app_id("cli_dsfjksdfee1") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(PatchApplicationContactsRangeRequestBody.builder() - .contacts_range_type("some") - .add_visible_list(AppContactsRangeIdList.builder().build()) - .del_visible_list(AppContactsRangeIdList.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationContactsRangeRequest = PatchApplicationContactsRangeRequest.builder() \ + .app_id("cli_dsfjksdfee1") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(PatchApplicationContactsRangeRequestBody.builder() + .contacts_range_type("some") + .add_visible_list(AppContactsRangeIdList.builder().build()) + .del_visible_list(AppContactsRangeIdList.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationContactsRangeResponse = await client.application.v6.application_contacts_range.apatch( - request) + # 发起请求 + response: PatchApplicationContactsRangeResponse = await client.application.v6.application_contacts_range.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_contacts_range.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_contacts_range.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/patch_application_feedback_sample.py b/samples/api/application/v6/patch_application_feedback_sample.py index 6f44d2db2..199396788 100644 --- a/samples/api/application/v6/patch_application_feedback_sample.py +++ b/samples/api/application/v6/patch_application_feedback_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationFeedbackRequest = PatchApplicationFeedbackRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .feedback_id("7057888018203574291") \ - .user_id_type("open_id") \ - .status(1) \ - .operator_id("ou_9565b69967831233761cc2f11b4c089f") \ - .build() + # 构造请求对象 + request: PatchApplicationFeedbackRequest = PatchApplicationFeedbackRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .feedback_id("7057888018203574291") \ + .user_id_type("open_id") \ + .status(1) \ + .operator_id("ou_9565b69967831233761cc2f11b4c089f") \ + .build() - # 发起请求 - response: PatchApplicationFeedbackResponse = client.application.v6.application_feedback.patch(request) + # 发起请求 + response: PatchApplicationFeedbackResponse = client.application.v6.application_feedback.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_feedback.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_feedback.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationFeedbackRequest = PatchApplicationFeedbackRequest.builder() \ - .app_id("cli_9f115af860f7901b") \ - .feedback_id("7057888018203574291") \ - .user_id_type("open_id") \ - .status(1) \ - .operator_id("ou_9565b69967831233761cc2f11b4c089f") \ - .build() + # 构造请求对象 + request: PatchApplicationFeedbackRequest = PatchApplicationFeedbackRequest.builder() \ + .app_id("cli_9f115af860f7901b") \ + .feedback_id("7057888018203574291") \ + .user_id_type("open_id") \ + .status(1) \ + .operator_id("ou_9565b69967831233761cc2f11b4c089f") \ + .build() - # 发起请求 - response: PatchApplicationFeedbackResponse = await client.application.v6.application_feedback.apatch(request) + # 发起请求 + response: PatchApplicationFeedbackResponse = await client.application.v6.application_feedback.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_feedback.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_feedback.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/patch_application_sample.py b/samples/api/application/v6/patch_application_sample.py index 093b519cf..1ba74794b 100644 --- a/samples/api/application/v6/patch_application_sample.py +++ b/samples/api/application/v6/patch_application_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationRequest = PatchApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .request_body(Application.builder() - .common_categories([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationRequest = PatchApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .request_body(Application.builder() + .common_categories([]) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationResponse = client.application.v6.application.patch(request) + # 发起请求 + response: PatchApplicationResponse = client.application.v6.application.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationRequest = PatchApplicationRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .lang("zh_cn") \ - .request_body(Application.builder() - .common_categories([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationRequest = PatchApplicationRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .lang("zh_cn") \ + .request_body(Application.builder() + .common_categories([]) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationResponse = await client.application.v6.application.apatch(request) + # 发起请求 + response: PatchApplicationResponse = await client.application.v6.application.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/patch_application_visibility_sample.py b/samples/api/application/v6/patch_application_visibility_sample.py index afa508def..262ad0e45 100644 --- a/samples/api/application/v6/patch_application_visibility_sample.py +++ b/samples/api/application/v6/patch_application_visibility_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationVisibilityRequest = PatchApplicationVisibilityRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .department_id_type("open_department_id") \ - .user_id_type("open_id") \ - .request_body(PatchApplicationVisibilityRequestBody.builder() - .add_visible_list(AppVisibilityIdList.builder().build()) - .del_visible_list(AppVisibilityIdList.builder().build()) - .add_invisible_list(AppVisibilityIdList.builder().build()) - .del_invisible_list(AppVisibilityIdList.builder().build()) - .is_visible_to_all(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationVisibilityRequest = PatchApplicationVisibilityRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .department_id_type("open_department_id") \ + .user_id_type("open_id") \ + .request_body(PatchApplicationVisibilityRequestBody.builder() + .add_visible_list(AppVisibilityIdList.builder().build()) + .del_visible_list(AppVisibilityIdList.builder().build()) + .add_invisible_list(AppVisibilityIdList.builder().build()) + .del_invisible_list(AppVisibilityIdList.builder().build()) + .is_visible_to_all(False) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationVisibilityResponse = client.application.v6.application_visibility.patch(request) + # 发起请求 + response: PatchApplicationVisibilityResponse = client.application.v6.application_visibility.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_visibility.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_visibility.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchApplicationVisibilityRequest = PatchApplicationVisibilityRequest.builder() \ - .app_id("cli_9b445f5258795107") \ - .department_id_type("open_department_id") \ - .user_id_type("open_id") \ - .request_body(PatchApplicationVisibilityRequestBody.builder() - .add_visible_list(AppVisibilityIdList.builder().build()) - .del_visible_list(AppVisibilityIdList.builder().build()) - .add_invisible_list(AppVisibilityIdList.builder().build()) - .del_invisible_list(AppVisibilityIdList.builder().build()) - .is_visible_to_all(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchApplicationVisibilityRequest = PatchApplicationVisibilityRequest.builder() \ + .app_id("cli_9b445f5258795107") \ + .department_id_type("open_department_id") \ + .user_id_type("open_id") \ + .request_body(PatchApplicationVisibilityRequestBody.builder() + .add_visible_list(AppVisibilityIdList.builder().build()) + .del_visible_list(AppVisibilityIdList.builder().build()) + .add_invisible_list(AppVisibilityIdList.builder().build()) + .del_invisible_list(AppVisibilityIdList.builder().build()) + .is_visible_to_all(False) + .build()) \ + .build() - # 发起请求 - response: PatchApplicationVisibilityResponse = await client.application.v6.application_visibility.apatch(request) + # 发起请求 + response: PatchApplicationVisibilityResponse = await client.application.v6.application_visibility.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_visibility.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_visibility.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/set_app_badge_sample.py b/samples/api/application/v6/set_app_badge_sample.py index ad29954d2..557af3d00 100644 --- a/samples/api/application/v6/set_app_badge_sample.py +++ b/samples/api/application/v6/set_app_badge_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetAppBadgeRequest = SetAppBadgeRequest.builder() \ - .user_id_type("user_id") \ - .request_body(AppBadge.builder() - .user_id("int") - .version("int") - .extra("str") - .pc(ClientBadgeNum.builder().build()) - .mobile(ClientBadgeNum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetAppBadgeRequest = SetAppBadgeRequest.builder() \ + .user_id_type("user_id") \ + .request_body(AppBadge.builder() + .user_id("int") + .version("int") + .extra("str") + .pc(ClientBadgeNum.builder().build()) + .mobile(ClientBadgeNum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetAppBadgeResponse = client.application.v6.app_badge.set(request) + # 发起请求 + response: SetAppBadgeResponse = client.application.v6.app_badge.set(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.app_badge.set failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.app_badge.set failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetAppBadgeRequest = SetAppBadgeRequest.builder() \ - .user_id_type("user_id") \ - .request_body(AppBadge.builder() - .user_id("int") - .version("int") - .extra("str") - .pc(ClientBadgeNum.builder().build()) - .mobile(ClientBadgeNum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetAppBadgeRequest = SetAppBadgeRequest.builder() \ + .user_id_type("user_id") \ + .request_body(AppBadge.builder() + .user_id("int") + .version("int") + .extra("str") + .pc(ClientBadgeNum.builder().build()) + .mobile(ClientBadgeNum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetAppBadgeResponse = await client.application.v6.app_badge.aset(request) + # 发起请求 + response: SetAppBadgeResponse = await client.application.v6.app_badge.aset(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.app_badge.aset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.app_badge.aset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/underauditlist_application_sample.py b/samples/api/application/v6/underauditlist_application_sample.py index 879302830..951f015e2 100644 --- a/samples/api/application/v6/underauditlist_application_sample.py +++ b/samples/api/application/v6/underauditlist_application_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnderauditlistApplicationRequest = UnderauditlistApplicationRequest.builder() \ - .lang("zh_cn") \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .page_size(20) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: UnderauditlistApplicationRequest = UnderauditlistApplicationRequest.builder() \ + .lang("zh_cn") \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .page_size(20) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: UnderauditlistApplicationResponse = client.application.v6.application.underauditlist(request) + # 发起请求 + response: UnderauditlistApplicationResponse = client.application.v6.application.underauditlist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.underauditlist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.underauditlist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnderauditlistApplicationRequest = UnderauditlistApplicationRequest.builder() \ - .lang("zh_cn") \ - .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ - .page_size(20) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: UnderauditlistApplicationRequest = UnderauditlistApplicationRequest.builder() \ + .lang("zh_cn") \ + .page_token("new-e3c5a0627cdf0c2e057da7257b90376a") \ + .page_size(20) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: UnderauditlistApplicationResponse = await client.application.v6.application.aunderauditlist(request) + # 发起请求 + response: UnderauditlistApplicationResponse = await client.application.v6.application.aunderauditlist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application.aunderauditlist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application.aunderauditlist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/application/v6/update_application_management_sample.py b/samples/api/application/v6/update_application_management_sample.py index 726211d6f..1a1cb6ed2 100644 --- a/samples/api/application/v6/update_application_management_sample.py +++ b/samples/api/application/v6/update_application_management_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateApplicationManagementRequest = UpdateApplicationManagementRequest.builder() \ - .app_id("cli_a4517c8461f8100a") \ - .request_body(UpdateApplicationManagementRequestBody.builder() - .enable(True) - .build()) \ - .build() + # 构造请求对象 + request: UpdateApplicationManagementRequest = UpdateApplicationManagementRequest.builder() \ + .app_id("cli_a4517c8461f8100a") \ + .request_body(UpdateApplicationManagementRequestBody.builder() + .enable(True) + .build()) \ + .build() - # 发起请求 - response: UpdateApplicationManagementResponse = client.application.v6.application_management.update(request) + # 发起请求 + response: UpdateApplicationManagementResponse = client.application.v6.application_management.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_management.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_management.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateApplicationManagementRequest = UpdateApplicationManagementRequest.builder() \ - .app_id("cli_a4517c8461f8100a") \ - .request_body(UpdateApplicationManagementRequestBody.builder() - .enable(True) - .build()) \ - .build() + # 构造请求对象 + request: UpdateApplicationManagementRequest = UpdateApplicationManagementRequest.builder() \ + .app_id("cli_a4517c8461f8100a") \ + .request_body(UpdateApplicationManagementRequestBody.builder() + .enable(True) + .build()) \ + .build() - # 发起请求 - response: UpdateApplicationManagementResponse = await client.application.v6.application_management.aupdate(request) + # 发起请求 + response: UpdateApplicationManagementResponse = await client.application.v6.application_management.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.application.v6.application_management.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.application_management.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/add_sign_instance_sample.py b/samples/api/approval/v4/add_sign_instance_sample.py index e6b113ab7..8cf7cf6a8 100644 --- a/samples/api/approval/v4/add_sign_instance_sample.py +++ b/samples/api/approval/v4/add_sign_instance_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddSignInstanceRequest = AddSignInstanceRequest.builder() \ - .request_body(AddSignInstanceRequestBody.builder() - .user_id("b16g66e3") - .approval_code("3B68E280-CF10-4198-B4CD-2E3BB97981D8") - .instance_code("289330DE-FBF1-4A47-91F9-9EFCCF11BCAE") - .task_id("6955096766400167956") - .comment("addSignComment") - .add_sign_user_ids([]) - .add_sign_type(3) - .approval_method(1) - .build()) \ - .build() + # 构造请求对象 + request: AddSignInstanceRequest = AddSignInstanceRequest.builder() \ + .request_body(AddSignInstanceRequestBody.builder() + .user_id("b16g66e3") + .approval_code("3B68E280-CF10-4198-B4CD-2E3BB97981D8") + .instance_code("289330DE-FBF1-4A47-91F9-9EFCCF11BCAE") + .task_id("6955096766400167956") + .comment("addSignComment") + .add_sign_user_ids([]) + .add_sign_type(3) + .approval_method(1) + .build()) \ + .build() - # 发起请求 - response: AddSignInstanceResponse = client.approval.v4.instance.add_sign(request) + # 发起请求 + response: AddSignInstanceResponse = client.approval.v4.instance.add_sign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.add_sign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.add_sign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddSignInstanceRequest = AddSignInstanceRequest.builder() \ - .request_body(AddSignInstanceRequestBody.builder() - .user_id("b16g66e3") - .approval_code("3B68E280-CF10-4198-B4CD-2E3BB97981D8") - .instance_code("289330DE-FBF1-4A47-91F9-9EFCCF11BCAE") - .task_id("6955096766400167956") - .comment("addSignComment") - .add_sign_user_ids([]) - .add_sign_type(3) - .approval_method(1) - .build()) \ - .build() + # 构造请求对象 + request: AddSignInstanceRequest = AddSignInstanceRequest.builder() \ + .request_body(AddSignInstanceRequestBody.builder() + .user_id("b16g66e3") + .approval_code("3B68E280-CF10-4198-B4CD-2E3BB97981D8") + .instance_code("289330DE-FBF1-4A47-91F9-9EFCCF11BCAE") + .task_id("6955096766400167956") + .comment("addSignComment") + .add_sign_user_ids([]) + .add_sign_type(3) + .approval_method(1) + .build()) \ + .build() - # 发起请求 - response: AddSignInstanceResponse = await client.approval.v4.instance.aadd_sign(request) + # 发起请求 + response: AddSignInstanceResponse = await client.approval.v4.instance.aadd_sign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.aadd_sign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.aadd_sign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/approve_task_sample.py b/samples/api/approval/v4/approve_task_sample.py index 1c6a6cf3c..532387255 100644 --- a/samples/api/approval/v4/approve_task_sample.py +++ b/samples/api/approval/v4/approve_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ApproveTaskRequest = ApproveTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskApprove.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: ApproveTaskRequest = ApproveTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskApprove.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: ApproveTaskResponse = client.approval.v4.task.approve(request) + # 发起请求 + response: ApproveTaskResponse = client.approval.v4.task.approve(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ApproveTaskRequest = ApproveTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskApprove.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: ApproveTaskRequest = ApproveTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskApprove.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: ApproveTaskResponse = await client.approval.v4.task.aapprove(request) + # 发起请求 + response: ApproveTaskResponse = await client.approval.v4.task.aapprove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.aapprove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.aapprove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/cancel_instance_sample.py b/samples/api/approval/v4/cancel_instance_sample.py index cb5f9bd83..b07c3a6d2 100644 --- a/samples/api/approval/v4/cancel_instance_sample.py +++ b/samples/api/approval/v4/cancel_instance_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelInstanceRequest = CancelInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(InstanceCancel.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .build()) \ - .build() + # 构造请求对象 + request: CancelInstanceRequest = CancelInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(InstanceCancel.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .build()) \ + .build() - # 发起请求 - response: CancelInstanceResponse = client.approval.v4.instance.cancel(request) + # 发起请求 + response: CancelInstanceResponse = client.approval.v4.instance.cancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelInstanceRequest = CancelInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(InstanceCancel.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .build()) \ - .build() + # 构造请求对象 + request: CancelInstanceRequest = CancelInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(InstanceCancel.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .build()) \ + .build() - # 发起请求 - response: CancelInstanceResponse = await client.approval.v4.instance.acancel(request) + # 发起请求 + response: CancelInstanceResponse = await client.approval.v4.instance.acancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/cc_instance_sample.py b/samples/api/approval/v4/cc_instance_sample.py index b63bb4fd3..97e88c83a 100644 --- a/samples/api/approval/v4/cc_instance_sample.py +++ b/samples/api/approval/v4/cc_instance_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CcInstanceRequest = CcInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(InstanceCc.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .user_id("f7cb567e") - .cc_user_ids([]) - .comment("ok") - .build()) \ - .build() + # 构造请求对象 + request: CcInstanceRequest = CcInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(InstanceCc.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .user_id("f7cb567e") + .cc_user_ids([]) + .comment("ok") + .build()) \ + .build() - # 发起请求 - response: CcInstanceResponse = client.approval.v4.instance.cc(request) + # 发起请求 + response: CcInstanceResponse = client.approval.v4.instance.cc(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CcInstanceRequest = CcInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(InstanceCc.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .user_id("f7cb567e") - .cc_user_ids([]) - .comment("ok") - .build()) \ - .build() + # 构造请求对象 + request: CcInstanceRequest = CcInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(InstanceCc.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .user_id("f7cb567e") + .cc_user_ids([]) + .comment("ok") + .build()) \ + .build() - # 发起请求 - response: CcInstanceResponse = await client.approval.v4.instance.acc(request) + # 发起请求 + response: CcInstanceResponse = await client.approval.v4.instance.acc(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.acc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.acc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/check_external_instance_sample.py b/samples/api/approval/v4/check_external_instance_sample.py index 37c64e7fe..b80cbafe2 100644 --- a/samples/api/approval/v4/check_external_instance_sample.py +++ b/samples/api/approval/v4/check_external_instance_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CheckExternalInstanceRequest = CheckExternalInstanceRequest.builder() \ - .request_body(CheckExternalInstanceRequestBody.builder() - .instances([]) - .build()) \ - .build() + # 构造请求对象 + request: CheckExternalInstanceRequest = CheckExternalInstanceRequest.builder() \ + .request_body(CheckExternalInstanceRequestBody.builder() + .instances([]) + .build()) \ + .build() - # 发起请求 - response: CheckExternalInstanceResponse = client.approval.v4.external_instance.check(request) + # 发起请求 + response: CheckExternalInstanceResponse = client.approval.v4.external_instance.check(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_instance.check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_instance.check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CheckExternalInstanceRequest = CheckExternalInstanceRequest.builder() \ - .request_body(CheckExternalInstanceRequestBody.builder() - .instances([]) - .build()) \ - .build() + # 构造请求对象 + request: CheckExternalInstanceRequest = CheckExternalInstanceRequest.builder() \ + .request_body(CheckExternalInstanceRequestBody.builder() + .instances([]) + .build()) \ + .build() - # 发起请求 - response: CheckExternalInstanceResponse = await client.approval.v4.external_instance.acheck(request) + # 发起请求 + response: CheckExternalInstanceResponse = await client.approval.v4.external_instance.acheck(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_instance.acheck failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_instance.acheck failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/create_approval_sample.py b/samples/api/approval/v4/create_approval_sample.py index f93b9083e..c24783c72 100644 --- a/samples/api/approval/v4/create_approval_sample.py +++ b/samples/api/approval/v4/create_approval_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateApprovalRequest = CreateApprovalRequest.builder() \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .request_body(ApprovalCreate.builder() - .approval_name("@i18n@approval_name") - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .description("@i18n@description") - .viewers([]) - .form(ApprovalForm.builder().build()) - .node_list([]) - .settings(ApprovalSetting.builder().build()) - .config(ApprovalConfig.builder().build()) - .icon(0) - .i18n_resources([]) - .process_manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateApprovalRequest = CreateApprovalRequest.builder() \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .request_body(ApprovalCreate.builder() + .approval_name("@i18n@approval_name") + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .description("@i18n@description") + .viewers([]) + .form(ApprovalForm.builder().build()) + .node_list([]) + .settings(ApprovalSetting.builder().build()) + .config(ApprovalConfig.builder().build()) + .icon(0) + .i18n_resources([]) + .process_manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateApprovalResponse = client.approval.v4.approval.create(request) + # 发起请求 + response: CreateApprovalResponse = client.approval.v4.approval.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateApprovalRequest = CreateApprovalRequest.builder() \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .request_body(ApprovalCreate.builder() - .approval_name("@i18n@approval_name") - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .description("@i18n@description") - .viewers([]) - .form(ApprovalForm.builder().build()) - .node_list([]) - .settings(ApprovalSetting.builder().build()) - .config(ApprovalConfig.builder().build()) - .icon(0) - .i18n_resources([]) - .process_manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateApprovalRequest = CreateApprovalRequest.builder() \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .request_body(ApprovalCreate.builder() + .approval_name("@i18n@approval_name") + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .description("@i18n@description") + .viewers([]) + .form(ApprovalForm.builder().build()) + .node_list([]) + .settings(ApprovalSetting.builder().build()) + .config(ApprovalConfig.builder().build()) + .icon(0) + .i18n_resources([]) + .process_manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateApprovalResponse = await client.approval.v4.approval.acreate(request) + # 发起请求 + response: CreateApprovalResponse = await client.approval.v4.approval.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/create_external_approval_sample.py b/samples/api/approval/v4/create_external_approval_sample.py index 12dfd6722..a22889ff6 100644 --- a/samples/api/approval/v4/create_external_approval_sample.py +++ b/samples/api/approval/v4/create_external_approval_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalApprovalRequest = CreateExternalApprovalRequest.builder() \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .request_body(ExternalApproval.builder() - .approval_name("E78F1022-A166-447C-8320-E151DA90D70F") - .approval_code("permission_test") - .group_code("work_group") - .group_name("@i18n@2") - .description("@i18n@2") - .external(ApprovalCreateExternal.builder().build()) - .viewers([]) - .i18n_resources([]) - .managers([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalApprovalRequest = CreateExternalApprovalRequest.builder() \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .request_body(ExternalApproval.builder() + .approval_name("E78F1022-A166-447C-8320-E151DA90D70F") + .approval_code("permission_test") + .group_code("work_group") + .group_name("@i18n@2") + .description("@i18n@2") + .external(ApprovalCreateExternal.builder().build()) + .viewers([]) + .i18n_resources([]) + .managers([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalApprovalResponse = client.approval.v4.external_approval.create(request) + # 发起请求 + response: CreateExternalApprovalResponse = client.approval.v4.external_approval.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalApprovalRequest = CreateExternalApprovalRequest.builder() \ - .department_id_type("open_department_id") \ - .user_id_type("user_id") \ - .request_body(ExternalApproval.builder() - .approval_name("E78F1022-A166-447C-8320-E151DA90D70F") - .approval_code("permission_test") - .group_code("work_group") - .group_name("@i18n@2") - .description("@i18n@2") - .external(ApprovalCreateExternal.builder().build()) - .viewers([]) - .i18n_resources([]) - .managers([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalApprovalRequest = CreateExternalApprovalRequest.builder() \ + .department_id_type("open_department_id") \ + .user_id_type("user_id") \ + .request_body(ExternalApproval.builder() + .approval_name("E78F1022-A166-447C-8320-E151DA90D70F") + .approval_code("permission_test") + .group_code("work_group") + .group_name("@i18n@2") + .description("@i18n@2") + .external(ApprovalCreateExternal.builder().build()) + .viewers([]) + .i18n_resources([]) + .managers([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalApprovalResponse = await client.approval.v4.external_approval.acreate(request) + # 发起请求 + response: CreateExternalApprovalResponse = await client.approval.v4.external_approval.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/create_external_instance_sample.py b/samples/api/approval/v4/create_external_instance_sample.py index 11d6f9bdf..a11801e4c 100644 --- a/samples/api/approval/v4/create_external_instance_sample.py +++ b/samples/api/approval/v4/create_external_instance_sample.py @@ -5,108 +5,108 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInstanceRequest = CreateExternalInstanceRequest.builder() \ - .request_body(ExternalInstance.builder() - .approval_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .status("PENDING") - .extra("") - .instance_id("24492654") - .links(ExternalInstanceLink.builder().build()) - .title("@i18n@1") - .form([]) - .user_id("a987sf9s") - .user_name("@i18n@9") - .open_id("ou_be73cbc0ee35eb6ca54e9e7cc14998c1") - .department_id("od-8ec33278bc2") - .department_name("@i18n@10") - .start_time("1556468012678") - .end_time("1556468012678") - .update_time("1556468012678") - .display_method("BROWSER") - .update_mode("UPDATE") - .task_list([]) - .cc_list([]) - .i18n_resources([]) - .trusteeship_url_token("788981c886b1c28ac29d1e68efd60683d6d90dfce80938ee9453e2a5f3e9e306") - .trusteeship_user_id_type("user_id") - .trusteeship_urls(TrusteeshipUrls.builder().build()) - .trusteeship_cache_config(TrusteeshipInstanceCacheConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInstanceRequest = CreateExternalInstanceRequest.builder() \ + .request_body(ExternalInstance.builder() + .approval_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .status("PENDING") + .extra("") + .instance_id("24492654") + .links(ExternalInstanceLink.builder().build()) + .title("@i18n@1") + .form([]) + .user_id("a987sf9s") + .user_name("@i18n@9") + .open_id("ou_be73cbc0ee35eb6ca54e9e7cc14998c1") + .department_id("od-8ec33278bc2") + .department_name("@i18n@10") + .start_time("1556468012678") + .end_time("1556468012678") + .update_time("1556468012678") + .display_method("BROWSER") + .update_mode("UPDATE") + .task_list([]) + .cc_list([]) + .i18n_resources([]) + .trusteeship_url_token("788981c886b1c28ac29d1e68efd60683d6d90dfce80938ee9453e2a5f3e9e306") + .trusteeship_user_id_type("user_id") + .trusteeship_urls(TrusteeshipUrls.builder().build()) + .trusteeship_cache_config(TrusteeshipInstanceCacheConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateExternalInstanceResponse = client.approval.v4.external_instance.create(request) + # 发起请求 + response: CreateExternalInstanceResponse = client.approval.v4.external_instance.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_instance.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_instance.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInstanceRequest = CreateExternalInstanceRequest.builder() \ - .request_body(ExternalInstance.builder() - .approval_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .status("PENDING") - .extra("") - .instance_id("24492654") - .links(ExternalInstanceLink.builder().build()) - .title("@i18n@1") - .form([]) - .user_id("a987sf9s") - .user_name("@i18n@9") - .open_id("ou_be73cbc0ee35eb6ca54e9e7cc14998c1") - .department_id("od-8ec33278bc2") - .department_name("@i18n@10") - .start_time("1556468012678") - .end_time("1556468012678") - .update_time("1556468012678") - .display_method("BROWSER") - .update_mode("UPDATE") - .task_list([]) - .cc_list([]) - .i18n_resources([]) - .trusteeship_url_token("788981c886b1c28ac29d1e68efd60683d6d90dfce80938ee9453e2a5f3e9e306") - .trusteeship_user_id_type("user_id") - .trusteeship_urls(TrusteeshipUrls.builder().build()) - .trusteeship_cache_config(TrusteeshipInstanceCacheConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInstanceRequest = CreateExternalInstanceRequest.builder() \ + .request_body(ExternalInstance.builder() + .approval_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .status("PENDING") + .extra("") + .instance_id("24492654") + .links(ExternalInstanceLink.builder().build()) + .title("@i18n@1") + .form([]) + .user_id("a987sf9s") + .user_name("@i18n@9") + .open_id("ou_be73cbc0ee35eb6ca54e9e7cc14998c1") + .department_id("od-8ec33278bc2") + .department_name("@i18n@10") + .start_time("1556468012678") + .end_time("1556468012678") + .update_time("1556468012678") + .display_method("BROWSER") + .update_mode("UPDATE") + .task_list([]) + .cc_list([]) + .i18n_resources([]) + .trusteeship_url_token("788981c886b1c28ac29d1e68efd60683d6d90dfce80938ee9453e2a5f3e9e306") + .trusteeship_user_id_type("user_id") + .trusteeship_urls(TrusteeshipUrls.builder().build()) + .trusteeship_cache_config(TrusteeshipInstanceCacheConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateExternalInstanceResponse = await client.approval.v4.external_instance.acreate(request) + # 发起请求 + response: CreateExternalInstanceResponse = await client.approval.v4.external_instance.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_instance.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_instance.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/create_instance_comment_sample.py b/samples/api/approval/v4/create_instance_comment_sample.py index b0e413fc2..110a4b451 100644 --- a/samples/api/approval/v4/create_instance_comment_sample.py +++ b/samples/api/approval/v4/create_instance_comment_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateInstanceCommentRequest = CreateInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("e5286g26") \ - .request_body(CommentRequest.builder() - .content("") - .at_info_list([]) - .parent_comment_id("7081516627711524883") - .comment_id("7081516627711524883") - .disable_bot(False) - .extra("") - .build()) \ - .build() + # 构造请求对象 + request: CreateInstanceCommentRequest = CreateInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("e5286g26") \ + .request_body(CommentRequest.builder() + .content("") + .at_info_list([]) + .parent_comment_id("7081516627711524883") + .comment_id("7081516627711524883") + .disable_bot(False) + .extra("") + .build()) \ + .build() - # 发起请求 - response: CreateInstanceCommentResponse = client.approval.v4.instance_comment.create(request) + # 发起请求 + response: CreateInstanceCommentResponse = client.approval.v4.instance_comment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateInstanceCommentRequest = CreateInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("e5286g26") \ - .request_body(CommentRequest.builder() - .content("") - .at_info_list([]) - .parent_comment_id("7081516627711524883") - .comment_id("7081516627711524883") - .disable_bot(False) - .extra("") - .build()) \ - .build() + # 构造请求对象 + request: CreateInstanceCommentRequest = CreateInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("e5286g26") \ + .request_body(CommentRequest.builder() + .content("") + .at_info_list([]) + .parent_comment_id("7081516627711524883") + .comment_id("7081516627711524883") + .disable_bot(False) + .extra("") + .build()) \ + .build() - # 发起请求 - response: CreateInstanceCommentResponse = await client.approval.v4.instance_comment.acreate(request) + # 发起请求 + response: CreateInstanceCommentResponse = await client.approval.v4.instance_comment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/create_instance_sample.py b/samples/api/approval/v4/create_instance_sample.py index 98a2ed661..302e49119 100644 --- a/samples/api/approval/v4/create_instance_sample.py +++ b/samples/api/approval/v4/create_instance_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateInstanceRequest = CreateInstanceRequest.builder() \ - .request_body(InstanceCreate.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .user_id("f7cb567e") - .open_id("ou_123456") - .department_id("123456") - .form("") - .node_approver_user_id_list([]) - .node_approver_open_id_list([]) - .node_cc_user_id_list([]) - .node_cc_open_id_list([]) - .uuid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") - .allow_resubmit(True) - .allow_submit_again(True) - .cancel_bot_notification("0") - .forbid_revoke(False) - .i18n_resources([]) - .title("@i18n@1") - .title_display_method(0) - .node_auto_approval_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateInstanceRequest = CreateInstanceRequest.builder() \ + .request_body(InstanceCreate.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .user_id("f7cb567e") + .open_id("ou_123456") + .department_id("123456") + .form("") + .node_approver_user_id_list([]) + .node_approver_open_id_list([]) + .node_cc_user_id_list([]) + .node_cc_open_id_list([]) + .uuid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") + .allow_resubmit(True) + .allow_submit_again(True) + .cancel_bot_notification("0") + .forbid_revoke(False) + .i18n_resources([]) + .title("@i18n@1") + .title_display_method(0) + .node_auto_approval_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateInstanceResponse = client.approval.v4.instance.create(request) + # 发起请求 + response: CreateInstanceResponse = client.approval.v4.instance.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateInstanceRequest = CreateInstanceRequest.builder() \ - .request_body(InstanceCreate.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .user_id("f7cb567e") - .open_id("ou_123456") - .department_id("123456") - .form("") - .node_approver_user_id_list([]) - .node_approver_open_id_list([]) - .node_cc_user_id_list([]) - .node_cc_open_id_list([]) - .uuid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") - .allow_resubmit(True) - .allow_submit_again(True) - .cancel_bot_notification("0") - .forbid_revoke(False) - .i18n_resources([]) - .title("@i18n@1") - .title_display_method(0) - .node_auto_approval_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateInstanceRequest = CreateInstanceRequest.builder() \ + .request_body(InstanceCreate.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .user_id("f7cb567e") + .open_id("ou_123456") + .department_id("123456") + .form("") + .node_approver_user_id_list([]) + .node_approver_open_id_list([]) + .node_cc_user_id_list([]) + .node_cc_open_id_list([]) + .uuid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") + .allow_resubmit(True) + .allow_submit_again(True) + .cancel_bot_notification("0") + .forbid_revoke(False) + .i18n_resources([]) + .title("@i18n@1") + .title_display_method(0) + .node_auto_approval_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateInstanceResponse = await client.approval.v4.instance.acreate(request) + # 发起请求 + response: CreateInstanceResponse = await client.approval.v4.instance.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/delete_instance_comment_sample.py b/samples/api/approval/v4/delete_instance_comment_sample.py index dc3c3961a..abf3ddae7 100644 --- a/samples/api/approval/v4/delete_instance_comment_sample.py +++ b/samples/api/approval/v4/delete_instance_comment_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteInstanceCommentRequest = DeleteInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .comment_id("7081516627711606803") \ - .user_id_type("user_id") \ - .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ - .build() + # 构造请求对象 + request: DeleteInstanceCommentRequest = DeleteInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .comment_id("7081516627711606803") \ + .user_id_type("user_id") \ + .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ + .build() - # 发起请求 - response: DeleteInstanceCommentResponse = client.approval.v4.instance_comment.delete(request) + # 发起请求 + response: DeleteInstanceCommentResponse = client.approval.v4.instance_comment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteInstanceCommentRequest = DeleteInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .comment_id("7081516627711606803") \ - .user_id_type("user_id") \ - .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ - .build() + # 构造请求对象 + request: DeleteInstanceCommentRequest = DeleteInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .comment_id("7081516627711606803") \ + .user_id_type("user_id") \ + .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ + .build() - # 发起请求 - response: DeleteInstanceCommentResponse = await client.approval.v4.instance_comment.adelete(request) + # 发起请求 + response: DeleteInstanceCommentResponse = await client.approval.v4.instance_comment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/get_approval_sample.py b/samples/api/approval/v4/get_approval_sample.py index e8e776449..ccf702987 100644 --- a/samples/api/approval/v4/get_approval_sample.py +++ b/samples/api/approval/v4/get_approval_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApprovalRequest = GetApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .locale("zh-CN") \ - .with_admin_id(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApprovalRequest = GetApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .locale("zh-CN") \ + .with_admin_id(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApprovalResponse = client.approval.v4.approval.get(request) + # 发起请求 + response: GetApprovalResponse = client.approval.v4.approval.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApprovalRequest = GetApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .locale("zh-CN") \ - .with_admin_id(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetApprovalRequest = GetApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .locale("zh-CN") \ + .with_admin_id(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetApprovalResponse = await client.approval.v4.approval.aget(request) + # 发起请求 + response: GetApprovalResponse = await client.approval.v4.approval.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/get_external_approval_sample.py b/samples/api/approval/v4/get_external_approval_sample.py index 34557791b..126b75135 100644 --- a/samples/api/approval/v4/get_external_approval_sample.py +++ b/samples/api/approval/v4/get_external_approval_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExternalApprovalRequest = GetExternalApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetExternalApprovalRequest = GetExternalApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetExternalApprovalResponse = client.approval.v4.external_approval.get(request) + # 发起请求 + response: GetExternalApprovalResponse = client.approval.v4.external_approval.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_approval.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_approval.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExternalApprovalRequest = GetExternalApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetExternalApprovalRequest = GetExternalApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetExternalApprovalResponse = await client.approval.v4.external_approval.aget(request) + # 发起请求 + response: GetExternalApprovalResponse = await client.approval.v4.external_approval.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_approval.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_approval.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/get_instance_sample.py b/samples/api/approval/v4/get_instance_sample.py index 1f7a828bd..93b542d9c 100644 --- a/samples/api/approval/v4/get_instance_sample.py +++ b/samples/api/approval/v4/get_instance_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInstanceRequest = GetInstanceRequest.builder() \ - .instance_id("81D31358-93AF-92D6-7425-01A5D67C4E71") \ - .locale("zh-CN") \ - .user_id("f7cb567e") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetInstanceRequest = GetInstanceRequest.builder() \ + .instance_id("81D31358-93AF-92D6-7425-01A5D67C4E71") \ + .locale("zh-CN") \ + .user_id("f7cb567e") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetInstanceResponse = client.approval.v4.instance.get(request) + # 发起请求 + response: GetInstanceResponse = client.approval.v4.instance.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInstanceRequest = GetInstanceRequest.builder() \ - .instance_id("81D31358-93AF-92D6-7425-01A5D67C4E71") \ - .locale("zh-CN") \ - .user_id("f7cb567e") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetInstanceRequest = GetInstanceRequest.builder() \ + .instance_id("81D31358-93AF-92D6-7425-01A5D67C4E71") \ + .locale("zh-CN") \ + .user_id("f7cb567e") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetInstanceResponse = await client.approval.v4.instance.aget(request) + # 发起请求 + response: GetInstanceResponse = await client.approval.v4.instance.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/list_external_task_sample.py b/samples/api/approval/v4/list_external_task_sample.py index 8c6b031d0..0582c3f77 100644 --- a/samples/api/approval/v4/list_external_task_sample.py +++ b/samples/api/approval/v4/list_external_task_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExternalTaskRequest = ListExternalTaskRequest.builder() \ - .page_size(50) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .request_body(ListExternalTaskRequestBody.builder() - .approval_codes([]) - .instance_ids([]) - .user_ids([]) - .status("PENDING") - .build()) \ - .build() + # 构造请求对象 + request: ListExternalTaskRequest = ListExternalTaskRequest.builder() \ + .page_size(50) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .request_body(ListExternalTaskRequestBody.builder() + .approval_codes([]) + .instance_ids([]) + .user_ids([]) + .status("PENDING") + .build()) \ + .build() - # 发起请求 - response: ListExternalTaskResponse = client.approval.v4.external_task.list(request) + # 发起请求 + response: ListExternalTaskResponse = client.approval.v4.external_task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExternalTaskRequest = ListExternalTaskRequest.builder() \ - .page_size(50) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .request_body(ListExternalTaskRequestBody.builder() - .approval_codes([]) - .instance_ids([]) - .user_ids([]) - .status("PENDING") - .build()) \ - .build() + # 构造请求对象 + request: ListExternalTaskRequest = ListExternalTaskRequest.builder() \ + .page_size(50) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .request_body(ListExternalTaskRequestBody.builder() + .approval_codes([]) + .instance_ids([]) + .user_ids([]) + .status("PENDING") + .build()) \ + .build() - # 发起请求 - response: ListExternalTaskResponse = await client.approval.v4.external_task.alist(request) + # 发起请求 + response: ListExternalTaskResponse = await client.approval.v4.external_task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.external_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.external_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/list_instance_comment_sample.py b/samples/api/approval/v4/list_instance_comment_sample.py index f29ac0897..1ee9e1b69 100644 --- a/samples/api/approval/v4/list_instance_comment_sample.py +++ b/samples/api/approval/v4/list_instance_comment_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInstanceCommentRequest = ListInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("e5286g26") \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListInstanceCommentRequest = ListInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("e5286g26") \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListInstanceCommentResponse = client.approval.v4.instance_comment.list(request) + # 发起请求 + response: ListInstanceCommentResponse = client.approval.v4.instance_comment.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInstanceCommentRequest = ListInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("e5286g26") \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListInstanceCommentRequest = ListInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("e5286g26") \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListInstanceCommentResponse = await client.approval.v4.instance_comment.alist(request) + # 发起请求 + response: ListInstanceCommentResponse = await client.approval.v4.instance_comment.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/list_instance_sample.py b/samples/api/approval/v4/list_instance_sample.py index 7f46f6c73..b81a57ce7 100644 --- a/samples/api/approval/v4/list_instance_sample.py +++ b/samples/api/approval/v4/list_instance_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInstanceRequest = ListInstanceRequest.builder() \ - .page_size(100) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .start_time("1567690398020") \ - .end_time("1567690398020") \ - .build() + # 构造请求对象 + request: ListInstanceRequest = ListInstanceRequest.builder() \ + .page_size(100) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .start_time("1567690398020") \ + .end_time("1567690398020") \ + .build() - # 发起请求 - response: ListInstanceResponse = client.approval.v4.instance.list(request) + # 发起请求 + response: ListInstanceResponse = client.approval.v4.instance.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInstanceRequest = ListInstanceRequest.builder() \ - .page_size(100) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .start_time("1567690398020") \ - .end_time("1567690398020") \ - .build() + # 构造请求对象 + request: ListInstanceRequest = ListInstanceRequest.builder() \ + .page_size(100) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .start_time("1567690398020") \ + .end_time("1567690398020") \ + .build() - # 发起请求 - response: ListInstanceResponse = await client.approval.v4.instance.alist(request) + # 发起请求 + response: ListInstanceResponse = await client.approval.v4.instance.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/preview_instance_sample.py b/samples/api/approval/v4/preview_instance_sample.py index 4acd28ce9..8c24bd246 100644 --- a/samples/api/approval/v4/preview_instance_sample.py +++ b/samples/api/approval/v4/preview_instance_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewInstanceRequest = PreviewInstanceRequest.builder() \ - .user_id_type("open_id") \ - .request_body(PreviewInstanceRequestBody.builder() - .user_id("发起审批用户id,按照user_id_type类型填写") - .approval_code("C2CAAA90-70D9-3214-906B-B6FFF947F00D") - .department_id("6982332863116876308") - .form("") - .instance_code("12345CA6-97AC-32BB-8231-47C33FFFCCFD") - .locale("zh-CN: 中文 en-US: 英文") - .task_id("6982332863116876308") - .build()) \ - .build() + # 构造请求对象 + request: PreviewInstanceRequest = PreviewInstanceRequest.builder() \ + .user_id_type("open_id") \ + .request_body(PreviewInstanceRequestBody.builder() + .user_id("发起审批用户id,按照user_id_type类型填写") + .approval_code("C2CAAA90-70D9-3214-906B-B6FFF947F00D") + .department_id("6982332863116876308") + .form("") + .instance_code("12345CA6-97AC-32BB-8231-47C33FFFCCFD") + .locale("zh-CN: 中文 en-US: 英文") + .task_id("6982332863116876308") + .build()) \ + .build() - # 发起请求 - response: PreviewInstanceResponse = client.approval.v4.instance.preview(request) + # 发起请求 + response: PreviewInstanceResponse = client.approval.v4.instance.preview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewInstanceRequest = PreviewInstanceRequest.builder() \ - .user_id_type("open_id") \ - .request_body(PreviewInstanceRequestBody.builder() - .user_id("发起审批用户id,按照user_id_type类型填写") - .approval_code("C2CAAA90-70D9-3214-906B-B6FFF947F00D") - .department_id("6982332863116876308") - .form("") - .instance_code("12345CA6-97AC-32BB-8231-47C33FFFCCFD") - .locale("zh-CN: 中文 en-US: 英文") - .task_id("6982332863116876308") - .build()) \ - .build() + # 构造请求对象 + request: PreviewInstanceRequest = PreviewInstanceRequest.builder() \ + .user_id_type("open_id") \ + .request_body(PreviewInstanceRequestBody.builder() + .user_id("发起审批用户id,按照user_id_type类型填写") + .approval_code("C2CAAA90-70D9-3214-906B-B6FFF947F00D") + .department_id("6982332863116876308") + .form("") + .instance_code("12345CA6-97AC-32BB-8231-47C33FFFCCFD") + .locale("zh-CN: 中文 en-US: 英文") + .task_id("6982332863116876308") + .build()) \ + .build() - # 发起请求 - response: PreviewInstanceResponse = await client.approval.v4.instance.apreview(request) + # 发起请求 + response: PreviewInstanceResponse = await client.approval.v4.instance.apreview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/query_instance_sample.py b/samples/api/approval/v4/query_instance_sample.py index 688aa44b4..9596ace2b 100644 --- a/samples/api/approval/v4/query_instance_sample.py +++ b/samples/api/approval/v4/query_instance_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryInstanceRequest = QueryInstanceRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(InstanceSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .instance_title("test") - .instance_status("PENDING") - .instance_start_time_from("1547654251506") - .instance_start_time_to("1547654251506") - .locale("zh-CN") - .build()) \ - .build() + # 构造请求对象 + request: QueryInstanceRequest = QueryInstanceRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(InstanceSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .instance_title("test") + .instance_status("PENDING") + .instance_start_time_from("1547654251506") + .instance_start_time_to("1547654251506") + .locale("zh-CN") + .build()) \ + .build() - # 发起请求 - response: QueryInstanceResponse = client.approval.v4.instance.query(request) + # 发起请求 + response: QueryInstanceResponse = client.approval.v4.instance.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryInstanceRequest = QueryInstanceRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(InstanceSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .instance_title("test") - .instance_status("PENDING") - .instance_start_time_from("1547654251506") - .instance_start_time_to("1547654251506") - .locale("zh-CN") - .build()) \ - .build() + # 构造请求对象 + request: QueryInstanceRequest = QueryInstanceRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(InstanceSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .instance_title("test") + .instance_status("PENDING") + .instance_start_time_from("1547654251506") + .instance_start_time_to("1547654251506") + .locale("zh-CN") + .build()) \ + .build() - # 发起请求 - response: QueryInstanceResponse = await client.approval.v4.instance.aquery(request) + # 发起请求 + response: QueryInstanceResponse = await client.approval.v4.instance.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/query_task_sample.py b/samples/api/approval/v4/query_task_sample.py index 6c2353c6b..d458da89e 100644 --- a/samples/api/approval/v4/query_task_sample.py +++ b/samples/api/approval/v4/query_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTaskRequest = QueryTaskRequest.builder() \ - .page_size(100) \ - .page_token("1") \ - .user_id("example_user_id") \ - .topic("1") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryTaskRequest = QueryTaskRequest.builder() \ + .page_size(100) \ + .page_token("1") \ + .user_id("example_user_id") \ + .topic("1") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryTaskResponse = client.approval.v4.task.query(request) + # 发起请求 + response: QueryTaskResponse = client.approval.v4.task.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTaskRequest = QueryTaskRequest.builder() \ - .page_size(100) \ - .page_token("1") \ - .user_id("example_user_id") \ - .topic("1") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryTaskRequest = QueryTaskRequest.builder() \ + .page_size(100) \ + .page_token("1") \ + .user_id("example_user_id") \ + .topic("1") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryTaskResponse = await client.approval.v4.task.aquery(request) + # 发起请求 + response: QueryTaskResponse = await client.approval.v4.task.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/reject_task_sample.py b/samples/api/approval/v4/reject_task_sample.py index 806a25e36..593617a3a 100644 --- a/samples/api/approval/v4/reject_task_sample.py +++ b/samples/api/approval/v4/reject_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RejectTaskRequest = RejectTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskApprove.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: RejectTaskRequest = RejectTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskApprove.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: RejectTaskResponse = client.approval.v4.task.reject(request) + # 发起请求 + response: RejectTaskResponse = client.approval.v4.task.reject(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.reject failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.reject failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RejectTaskRequest = RejectTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskApprove.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: RejectTaskRequest = RejectTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskApprove.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: RejectTaskResponse = await client.approval.v4.task.areject(request) + # 发起请求 + response: RejectTaskResponse = await client.approval.v4.task.areject(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.areject failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.areject failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/remove_instance_comment_sample.py b/samples/api/approval/v4/remove_instance_comment_sample.py index e40a7f4b9..0027c43ab 100644 --- a/samples/api/approval/v4/remove_instance_comment_sample.py +++ b/samples/api/approval/v4/remove_instance_comment_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveInstanceCommentRequest = RemoveInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ - .build() + # 构造请求对象 + request: RemoveInstanceCommentRequest = RemoveInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ + .build() - # 发起请求 - response: RemoveInstanceCommentResponse = client.approval.v4.instance_comment.remove(request) + # 发起请求 + response: RemoveInstanceCommentResponse = client.approval.v4.instance_comment.remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveInstanceCommentRequest = RemoveInstanceCommentRequest.builder() \ - .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ - .user_id_type("user_id") \ - .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ - .build() + # 构造请求对象 + request: RemoveInstanceCommentRequest = RemoveInstanceCommentRequest.builder() \ + .instance_id("6A123516-FB88-470D-A428-9AF58B71B3C0") \ + .user_id_type("user_id") \ + .user_id("ou_806a18fb5bdf525e38ba219733bdbd73") \ + .build() - # 发起请求 - response: RemoveInstanceCommentResponse = await client.approval.v4.instance_comment.aremove(request) + # 发起请求 + response: RemoveInstanceCommentResponse = await client.approval.v4.instance_comment.aremove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance_comment.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance_comment.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/resubmit_task_sample.py b/samples/api/approval/v4/resubmit_task_sample.py index b32973054..9fdcbdd92 100644 --- a/samples/api/approval/v4/resubmit_task_sample.py +++ b/samples/api/approval/v4/resubmit_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResubmitTaskRequest = ResubmitTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskResubmit.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: ResubmitTaskRequest = ResubmitTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskResubmit.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: ResubmitTaskResponse = client.approval.v4.task.resubmit(request) + # 发起请求 + response: ResubmitTaskResponse = client.approval.v4.task.resubmit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.resubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.resubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResubmitTaskRequest = ResubmitTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskResubmit.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .task_id("12345") - .form("") - .build()) \ - .build() + # 构造请求对象 + request: ResubmitTaskRequest = ResubmitTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskResubmit.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .task_id("12345") + .form("") + .build()) \ + .build() - # 发起请求 - response: ResubmitTaskResponse = await client.approval.v4.task.aresubmit(request) + # 发起请求 + response: ResubmitTaskResponse = await client.approval.v4.task.aresubmit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.aresubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.aresubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/search_cc_instance_sample.py b/samples/api/approval/v4/search_cc_instance_sample.py index bf0856e96..f995f09c8 100644 --- a/samples/api/approval/v4/search_cc_instance_sample.py +++ b/samples/api/approval/v4/search_cc_instance_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCcInstanceRequest = SearchCcInstanceRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(CcSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .cc_title("test") - .read_status("READ") - .cc_create_time_from("1547654251506") - .cc_create_time_to("1547654251506") - .locale("zh-CN") - .build()) \ - .build() + # 构造请求对象 + request: SearchCcInstanceRequest = SearchCcInstanceRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(CcSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .cc_title("test") + .read_status("READ") + .cc_create_time_from("1547654251506") + .cc_create_time_to("1547654251506") + .locale("zh-CN") + .build()) \ + .build() - # 发起请求 - response: SearchCcInstanceResponse = client.approval.v4.instance.search_cc(request) + # 发起请求 + response: SearchCcInstanceResponse = client.approval.v4.instance.search_cc(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.search_cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.search_cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCcInstanceRequest = SearchCcInstanceRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(CcSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .cc_title("test") - .read_status("READ") - .cc_create_time_from("1547654251506") - .cc_create_time_to("1547654251506") - .locale("zh-CN") - .build()) \ - .build() + # 构造请求对象 + request: SearchCcInstanceRequest = SearchCcInstanceRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(CcSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .cc_title("test") + .read_status("READ") + .cc_create_time_from("1547654251506") + .cc_create_time_to("1547654251506") + .locale("zh-CN") + .build()) \ + .build() - # 发起请求 - response: SearchCcInstanceResponse = await client.approval.v4.instance.asearch_cc(request) + # 发起请求 + response: SearchCcInstanceResponse = await client.approval.v4.instance.asearch_cc(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.asearch_cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.asearch_cc failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/search_task_sample.py b/samples/api/approval/v4/search_task_sample.py index 320250601..bca433767 100644 --- a/samples/api/approval/v4/search_task_sample.py +++ b/samples/api/approval/v4/search_task_sample.py @@ -5,90 +5,90 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTaskRequest = SearchTaskRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(TaskSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .task_title("test") - .task_status("PENDING") - .task_start_time_from("1547654251506") - .task_start_time_to("1547654251506") - .locale("zh-CN") - .task_status_list([]) - .order(2) - .build()) \ - .build() + # 构造请求对象 + request: SearchTaskRequest = SearchTaskRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(TaskSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .task_title("test") + .task_status("PENDING") + .task_start_time_from("1547654251506") + .task_start_time_to("1547654251506") + .locale("zh-CN") + .task_status_list([]) + .order(2) + .build()) \ + .build() - # 发起请求 - response: SearchTaskResponse = client.approval.v4.task.search(request) + # 发起请求 + response: SearchTaskResponse = client.approval.v4.task.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTaskRequest = SearchTaskRequest.builder() \ - .page_size(10) \ - .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ - .user_id_type("user_id") \ - .request_body(TaskSearch.builder() - .user_id("lwiu098wj") - .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") - .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") - .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") - .group_external_id("1234567") - .task_title("test") - .task_status("PENDING") - .task_start_time_from("1547654251506") - .task_start_time_to("1547654251506") - .locale("zh-CN") - .task_status_list([]) - .order(2) - .build()) \ - .build() + # 构造请求对象 + request: SearchTaskRequest = SearchTaskRequest.builder() \ + .page_size(10) \ + .page_token("nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU") \ + .user_id_type("user_id") \ + .request_body(TaskSearch.builder() + .user_id("lwiu098wj") + .approval_code("EB828003-9FFE-4B3F-AA50-2E199E2ED942") + .instance_code("EB828003-9FFE-4B3F-AA50-2E199E2ED943") + .instance_external_id("EB828003-9FFE-4B3F-AA50-2E199E2ED976") + .group_external_id("1234567") + .task_title("test") + .task_status("PENDING") + .task_start_time_from("1547654251506") + .task_start_time_to("1547654251506") + .locale("zh-CN") + .task_status_list([]) + .order(2) + .build()) \ + .build() - # 发起请求 - response: SearchTaskResponse = await client.approval.v4.task.asearch(request) + # 发起请求 + response: SearchTaskResponse = await client.approval.v4.task.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/specified_rollback_instance_sample.py b/samples/api/approval/v4/specified_rollback_instance_sample.py index df2e31f47..01d7f9e0a 100644 --- a/samples/api/approval/v4/specified_rollback_instance_sample.py +++ b/samples/api/approval/v4/specified_rollback_instance_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SpecifiedRollbackInstanceRequest = SpecifiedRollbackInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SpecifiedRollback.builder() - .user_id("893g4c45") - .task_id("7026591166355210260") - .reason("申请事项填写不具体,请重新填写") - .extra("暂不填写") - .task_def_key_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SpecifiedRollbackInstanceRequest = SpecifiedRollbackInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SpecifiedRollback.builder() + .user_id("893g4c45") + .task_id("7026591166355210260") + .reason("申请事项填写不具体,请重新填写") + .extra("暂不填写") + .task_def_key_list([]) + .build()) \ + .build() - # 发起请求 - response: SpecifiedRollbackInstanceResponse = client.approval.v4.instance.specified_rollback(request) + # 发起请求 + response: SpecifiedRollbackInstanceResponse = client.approval.v4.instance.specified_rollback(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.specified_rollback failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.specified_rollback failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SpecifiedRollbackInstanceRequest = SpecifiedRollbackInstanceRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SpecifiedRollback.builder() - .user_id("893g4c45") - .task_id("7026591166355210260") - .reason("申请事项填写不具体,请重新填写") - .extra("暂不填写") - .task_def_key_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SpecifiedRollbackInstanceRequest = SpecifiedRollbackInstanceRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SpecifiedRollback.builder() + .user_id("893g4c45") + .task_id("7026591166355210260") + .reason("申请事项填写不具体,请重新填写") + .extra("暂不填写") + .task_def_key_list([]) + .build()) \ + .build() - # 发起请求 - response: SpecifiedRollbackInstanceResponse = await client.approval.v4.instance.aspecified_rollback(request) + # 发起请求 + response: SpecifiedRollbackInstanceResponse = await client.approval.v4.instance.aspecified_rollback(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.instance.aspecified_rollback failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.instance.aspecified_rollback failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/subscribe_approval_sample.py b/samples/api/approval/v4/subscribe_approval_sample.py index 8d966ded2..cb636e8d8 100644 --- a/samples/api/approval/v4/subscribe_approval_sample.py +++ b/samples/api/approval/v4/subscribe_approval_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeApprovalRequest = SubscribeApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .build() + # 构造请求对象 + request: SubscribeApprovalRequest = SubscribeApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .build() - # 发起请求 - response: SubscribeApprovalResponse = client.approval.v4.approval.subscribe(request) + # 发起请求 + response: SubscribeApprovalResponse = client.approval.v4.approval.subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeApprovalRequest = SubscribeApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .build() + # 构造请求对象 + request: SubscribeApprovalRequest = SubscribeApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .build() - # 发起请求 - response: SubscribeApprovalResponse = await client.approval.v4.approval.asubscribe(request) + # 发起请求 + response: SubscribeApprovalResponse = await client.approval.v4.approval.asubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/transfer_task_sample.py b/samples/api/approval/v4/transfer_task_sample.py index 5d13b98da..2fdd4dcce 100644 --- a/samples/api/approval/v4/transfer_task_sample.py +++ b/samples/api/approval/v4/transfer_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferTaskRequest = TransferTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskTransfer.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .transfer_user_id("f4ip317q") - .task_id("12345") - .build()) \ - .build() + # 构造请求对象 + request: TransferTaskRequest = TransferTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskTransfer.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .transfer_user_id("f4ip317q") + .task_id("12345") + .build()) \ + .build() - # 发起请求 - response: TransferTaskResponse = client.approval.v4.task.transfer(request) + # 发起请求 + response: TransferTaskResponse = client.approval.v4.task.transfer(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.transfer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.transfer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferTaskRequest = TransferTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TaskTransfer.builder() - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") - .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") - .user_id("f7cb567e") - .comment("OK") - .transfer_user_id("f4ip317q") - .task_id("12345") - .build()) \ - .build() + # 构造请求对象 + request: TransferTaskRequest = TransferTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TaskTransfer.builder() + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") + .instance_code("81D31358-93AF-92D6-7425-01A5D67C4E71") + .user_id("f7cb567e") + .comment("OK") + .transfer_user_id("f4ip317q") + .task_id("12345") + .build()) \ + .build() - # 发起请求 - response: TransferTaskResponse = await client.approval.v4.task.atransfer(request) + # 发起请求 + response: TransferTaskResponse = await client.approval.v4.task.atransfer(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.task.atransfer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.task.atransfer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/approval/v4/unsubscribe_approval_sample.py b/samples/api/approval/v4/unsubscribe_approval_sample.py index 30b2d5c1a..eaea16f1b 100644 --- a/samples/api/approval/v4/unsubscribe_approval_sample.py +++ b/samples/api/approval/v4/unsubscribe_approval_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeApprovalRequest = UnsubscribeApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .build() + # 构造请求对象 + request: UnsubscribeApprovalRequest = UnsubscribeApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .build() - # 发起请求 - response: UnsubscribeApprovalResponse = client.approval.v4.approval.unsubscribe(request) + # 发起请求 + response: UnsubscribeApprovalResponse = client.approval.v4.approval.unsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeApprovalRequest = UnsubscribeApprovalRequest.builder() \ - .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ - .build() + # 构造请求对象 + request: UnsubscribeApprovalRequest = UnsubscribeApprovalRequest.builder() \ + .approval_code("7C468A54-8745-2245-9675-08B7C63E7A85") \ + .build() - # 发起请求 - response: UnsubscribeApprovalResponse = await client.approval.v4.approval.aunsubscribe(request) + # 发起请求 + response: UnsubscribeApprovalResponse = await client.approval.v4.approval.aunsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.approval.v4.approval.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.approval.v4.approval.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/batch_create_user_daily_shift_sample.py b/samples/api/attendance/v1/batch_create_user_daily_shift_sample.py index 3e7137dc9..b47202c89 100644 --- a/samples/api/attendance/v1/batch_create_user_daily_shift_sample.py +++ b/samples/api/attendance/v1/batch_create_user_daily_shift_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateUserDailyShiftRequest = BatchCreateUserDailyShiftRequest.builder() \ - .employee_type("employee_id") \ - .request_body(BatchCreateUserDailyShiftRequestBody.builder() - .user_daily_shifts([]) - .operator_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateUserDailyShiftRequest = BatchCreateUserDailyShiftRequest.builder() \ + .employee_type("employee_id") \ + .request_body(BatchCreateUserDailyShiftRequestBody.builder() + .user_daily_shifts([]) + .operator_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: BatchCreateUserDailyShiftResponse = client.attendance.v1.user_daily_shift.batch_create(request) + # 发起请求 + response: BatchCreateUserDailyShiftResponse = client.attendance.v1.user_daily_shift.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_daily_shift.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_daily_shift.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateUserDailyShiftRequest = BatchCreateUserDailyShiftRequest.builder() \ - .employee_type("employee_id") \ - .request_body(BatchCreateUserDailyShiftRequestBody.builder() - .user_daily_shifts([]) - .operator_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateUserDailyShiftRequest = BatchCreateUserDailyShiftRequest.builder() \ + .employee_type("employee_id") \ + .request_body(BatchCreateUserDailyShiftRequestBody.builder() + .user_daily_shifts([]) + .operator_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: BatchCreateUserDailyShiftResponse = await client.attendance.v1.user_daily_shift.abatch_create(request) + # 发起请求 + response: BatchCreateUserDailyShiftResponse = await client.attendance.v1.user_daily_shift.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_daily_shift.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_daily_shift.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/batch_create_user_flow_sample.py b/samples/api/attendance/v1/batch_create_user_flow_sample.py index 1cabc9a02..5a643c151 100644 --- a/samples/api/attendance/v1/batch_create_user_flow_sample.py +++ b/samples/api/attendance/v1/batch_create_user_flow_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateUserFlowRequest = BatchCreateUserFlowRequest.builder() \ - .employee_type("employee_id") \ - .request_body(BatchCreateUserFlowRequestBody.builder() - .flow_records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateUserFlowRequest = BatchCreateUserFlowRequest.builder() \ + .employee_type("employee_id") \ + .request_body(BatchCreateUserFlowRequestBody.builder() + .flow_records([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateUserFlowResponse = client.attendance.v1.user_flow.batch_create(request) + # 发起请求 + response: BatchCreateUserFlowResponse = client.attendance.v1.user_flow.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateUserFlowRequest = BatchCreateUserFlowRequest.builder() \ - .employee_type("employee_id") \ - .request_body(BatchCreateUserFlowRequestBody.builder() - .flow_records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateUserFlowRequest = BatchCreateUserFlowRequest.builder() \ + .employee_type("employee_id") \ + .request_body(BatchCreateUserFlowRequestBody.builder() + .flow_records([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateUserFlowResponse = await client.attendance.v1.user_flow.abatch_create(request) + # 发起请求 + response: BatchCreateUserFlowResponse = await client.attendance.v1.user_flow.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/create_group_sample.py b/samples/api/attendance/v1/create_group_sample.py index a8e2e1768..0b3d13a53 100644 --- a/samples/api/attendance/v1/create_group_sample.py +++ b/samples/api/attendance/v1/create_group_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateGroupRequest = CreateGroupRequest.builder() \ - .employee_type("employee_id") \ - .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ - .request_body(CreateGroupRequestBody.builder() - .group(Group.builder().build()) - .operator_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: CreateGroupRequest = CreateGroupRequest.builder() \ + .employee_type("employee_id") \ + .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ + .request_body(CreateGroupRequestBody.builder() + .group(Group.builder().build()) + .operator_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: CreateGroupResponse = client.attendance.v1.group.create(request) + # 发起请求 + response: CreateGroupResponse = client.attendance.v1.group.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateGroupRequest = CreateGroupRequest.builder() \ - .employee_type("employee_id") \ - .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ - .request_body(CreateGroupRequestBody.builder() - .group(Group.builder().build()) - .operator_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: CreateGroupRequest = CreateGroupRequest.builder() \ + .employee_type("employee_id") \ + .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ + .request_body(CreateGroupRequestBody.builder() + .group(Group.builder().build()) + .operator_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: CreateGroupResponse = await client.attendance.v1.group.acreate(request) + # 发起请求 + response: CreateGroupResponse = await client.attendance.v1.group.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/create_shift_sample.py b/samples/api/attendance/v1/create_shift_sample.py index ae70db074..a01be5dc9 100644 --- a/samples/api/attendance/v1/create_shift_sample.py +++ b/samples/api/attendance/v1/create_shift_sample.py @@ -5,92 +5,92 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateShiftRequest = CreateShiftRequest.builder() \ - .request_body(Shift.builder() - .shift_name("早班") - .punch_times(1) - .sub_shift_leader_ids([]) - .is_flexible(False) - .flexible_minutes(60) - .flexible_rule([]) - .no_need_off(True) - .punch_time_rule([]) - .late_off_late_on_rule([]) - .rest_time_rule([]) - .overtime_rule([]) - .day_type(1) - .overtime_rest_time_rule([]) - .late_minutes_as_serious_late(40) - .shift_middle_time_rule(ShiftMiddleTimeRule.builder().build()) - .late_off_late_on_setting(LateOffLateOnSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateShiftRequest = CreateShiftRequest.builder() \ + .request_body(Shift.builder() + .shift_name("早班") + .punch_times(1) + .sub_shift_leader_ids([]) + .is_flexible(False) + .flexible_minutes(60) + .flexible_rule([]) + .no_need_off(True) + .punch_time_rule([]) + .late_off_late_on_rule([]) + .rest_time_rule([]) + .overtime_rule([]) + .day_type(1) + .overtime_rest_time_rule([]) + .late_minutes_as_serious_late(40) + .shift_middle_time_rule(ShiftMiddleTimeRule.builder().build()) + .late_off_late_on_setting(LateOffLateOnSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateShiftResponse = client.attendance.v1.shift.create(request) + # 发起请求 + response: CreateShiftResponse = client.attendance.v1.shift.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateShiftRequest = CreateShiftRequest.builder() \ - .request_body(Shift.builder() - .shift_name("早班") - .punch_times(1) - .sub_shift_leader_ids([]) - .is_flexible(False) - .flexible_minutes(60) - .flexible_rule([]) - .no_need_off(True) - .punch_time_rule([]) - .late_off_late_on_rule([]) - .rest_time_rule([]) - .overtime_rule([]) - .day_type(1) - .overtime_rest_time_rule([]) - .late_minutes_as_serious_late(40) - .shift_middle_time_rule(ShiftMiddleTimeRule.builder().build()) - .late_off_late_on_setting(LateOffLateOnSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateShiftRequest = CreateShiftRequest.builder() \ + .request_body(Shift.builder() + .shift_name("早班") + .punch_times(1) + .sub_shift_leader_ids([]) + .is_flexible(False) + .flexible_minutes(60) + .flexible_rule([]) + .no_need_off(True) + .punch_time_rule([]) + .late_off_late_on_rule([]) + .rest_time_rule([]) + .overtime_rule([]) + .day_type(1) + .overtime_rest_time_rule([]) + .late_minutes_as_serious_late(40) + .shift_middle_time_rule(ShiftMiddleTimeRule.builder().build()) + .late_off_late_on_setting(LateOffLateOnSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateShiftResponse = await client.attendance.v1.shift.acreate(request) + # 发起请求 + response: CreateShiftResponse = await client.attendance.v1.shift.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/create_user_approval_sample.py b/samples/api/attendance/v1/create_user_approval_sample.py index 0a1886037..8ba58c47a 100644 --- a/samples/api/attendance/v1/create_user_approval_sample.py +++ b/samples/api/attendance/v1/create_user_approval_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserApprovalRequest = CreateUserApprovalRequest.builder() \ - .employee_type("employee_id") \ - .request_body(CreateUserApprovalRequestBody.builder() - .user_approval(UserApproval.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateUserApprovalRequest = CreateUserApprovalRequest.builder() \ + .employee_type("employee_id") \ + .request_body(CreateUserApprovalRequestBody.builder() + .user_approval(UserApproval.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateUserApprovalResponse = client.attendance.v1.user_approval.create(request) + # 发起请求 + response: CreateUserApprovalResponse = client.attendance.v1.user_approval.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_approval.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserApprovalRequest = CreateUserApprovalRequest.builder() \ - .employee_type("employee_id") \ - .request_body(CreateUserApprovalRequestBody.builder() - .user_approval(UserApproval.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateUserApprovalRequest = CreateUserApprovalRequest.builder() \ + .employee_type("employee_id") \ + .request_body(CreateUserApprovalRequestBody.builder() + .user_approval(UserApproval.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateUserApprovalResponse = await client.attendance.v1.user_approval.acreate(request) + # 发起请求 + response: CreateUserApprovalResponse = await client.attendance.v1.user_approval.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_approval.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/create_user_task_remedy_sample.py b/samples/api/attendance/v1/create_user_task_remedy_sample.py index 95134e202..0f03f75a5 100644 --- a/samples/api/attendance/v1/create_user_task_remedy_sample.py +++ b/samples/api/attendance/v1/create_user_task_remedy_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserTaskRemedyRequest = CreateUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UserTaskRemedy.builder() - .user_id("abd754f7") - .remedy_date(20210701) - .punch_no(0) - .work_type(1) - .remedy_time("str") - .reason("忘记打卡") - .time("1611476284") - .build()) \ - .build() + # 构造请求对象 + request: CreateUserTaskRemedyRequest = CreateUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UserTaskRemedy.builder() + .user_id("abd754f7") + .remedy_date(20210701) + .punch_no(0) + .work_type(1) + .remedy_time("str") + .reason("忘记打卡") + .time("1611476284") + .build()) \ + .build() - # 发起请求 - response: CreateUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.create(request) + # 发起请求 + response: CreateUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserTaskRemedyRequest = CreateUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UserTaskRemedy.builder() - .user_id("abd754f7") - .remedy_date(20210701) - .punch_no(0) - .work_type(1) - .remedy_time("str") - .reason("忘记打卡") - .time("1611476284") - .build()) \ - .build() + # 构造请求对象 + request: CreateUserTaskRemedyRequest = CreateUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UserTaskRemedy.builder() + .user_id("abd754f7") + .remedy_date(20210701) + .punch_no(0) + .work_type(1) + .remedy_time("str") + .reason("忘记打卡") + .time("1611476284") + .build()) \ + .build() - # 发起请求 - response: CreateUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.acreate(request) + # 发起请求 + response: CreateUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/del_report_archive_rule_sample.py b/samples/api/attendance/v1/del_report_archive_rule_sample.py index e0c109c7f..3bfddbd0e 100644 --- a/samples/api/attendance/v1/del_report_archive_rule_sample.py +++ b/samples/api/attendance/v1/del_report_archive_rule_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DelReportArchiveRuleRequest = DelReportArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(DelReportArchiveRuleRequestBody.builder() - .month("202409") - .operator_id("a111xd") - .archive_rule_id("1") - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DelReportArchiveRuleRequest = DelReportArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(DelReportArchiveRuleRequestBody.builder() + .month("202409") + .operator_id("a111xd") + .archive_rule_id("1") + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: DelReportArchiveRuleResponse = client.attendance.v1.archive_rule.del_report(request) + # 发起请求 + response: DelReportArchiveRuleResponse = client.attendance.v1.archive_rule.del_report(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.del_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.del_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DelReportArchiveRuleRequest = DelReportArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(DelReportArchiveRuleRequestBody.builder() - .month("202409") - .operator_id("a111xd") - .archive_rule_id("1") - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DelReportArchiveRuleRequest = DelReportArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(DelReportArchiveRuleRequestBody.builder() + .month("202409") + .operator_id("a111xd") + .archive_rule_id("1") + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: DelReportArchiveRuleResponse = await client.attendance.v1.archive_rule.adel_report(request) + # 发起请求 + response: DelReportArchiveRuleResponse = await client.attendance.v1.archive_rule.adel_report(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.adel_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.adel_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/delete_group_sample.py b/samples/api/attendance/v1/delete_group_sample.py index a12b4e3a5..a26080950 100644 --- a/samples/api/attendance/v1/delete_group_sample.py +++ b/samples/api/attendance/v1/delete_group_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteGroupRequest = DeleteGroupRequest.builder() \ - .group_id("6919358128597097404") \ - .build() + # 构造请求对象 + request: DeleteGroupRequest = DeleteGroupRequest.builder() \ + .group_id("6919358128597097404") \ + .build() - # 发起请求 - response: DeleteGroupResponse = client.attendance.v1.group.delete(request) + # 发起请求 + response: DeleteGroupResponse = client.attendance.v1.group.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteGroupRequest = DeleteGroupRequest.builder() \ - .group_id("6919358128597097404") \ - .build() + # 构造请求对象 + request: DeleteGroupRequest = DeleteGroupRequest.builder() \ + .group_id("6919358128597097404") \ + .build() - # 发起请求 - response: DeleteGroupResponse = await client.attendance.v1.group.adelete(request) + # 发起请求 + response: DeleteGroupResponse = await client.attendance.v1.group.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/delete_shift_sample.py b/samples/api/attendance/v1/delete_shift_sample.py index c223a7d86..332ea6257 100644 --- a/samples/api/attendance/v1/delete_shift_sample.py +++ b/samples/api/attendance/v1/delete_shift_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteShiftRequest = DeleteShiftRequest.builder() \ - .shift_id("6919358778597097404") \ - .build() + # 构造请求对象 + request: DeleteShiftRequest = DeleteShiftRequest.builder() \ + .shift_id("6919358778597097404") \ + .build() - # 发起请求 - response: DeleteShiftResponse = client.attendance.v1.shift.delete(request) + # 发起请求 + response: DeleteShiftResponse = client.attendance.v1.shift.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteShiftRequest = DeleteShiftRequest.builder() \ - .shift_id("6919358778597097404") \ - .build() + # 构造请求对象 + request: DeleteShiftRequest = DeleteShiftRequest.builder() \ + .shift_id("6919358778597097404") \ + .build() - # 发起请求 - response: DeleteShiftResponse = await client.attendance.v1.shift.adelete(request) + # 发起请求 + response: DeleteShiftResponse = await client.attendance.v1.shift.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/download_file_sample.py b/samples/api/attendance/v1/download_file_sample.py index 86127436e..201e4083f 100644 --- a/samples/api/attendance/v1/download_file_sample.py +++ b/samples/api/attendance/v1/download_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_id("xxxxxb306842b1c189bc5212eefxxxxx") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_id("xxxxxb306842b1c189bc5212eefxxxxx") \ + .build() - # 发起请求 - response: DownloadFileResponse = client.attendance.v1.file.download(request) + # 发起请求 + response: DownloadFileResponse = client.attendance.v1.file.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_id("xxxxxb306842b1c189bc5212eefxxxxx") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_id("xxxxxb306842b1c189bc5212eefxxxxx") \ + .build() - # 发起请求 - response: DownloadFileResponse = await client.attendance.v1.file.adownload(request) + # 发起请求 + response: DownloadFileResponse = await client.attendance.v1.file.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/get_group_sample.py b/samples/api/attendance/v1/get_group_sample.py index 69046ff27..0c8d7af3a 100644 --- a/samples/api/attendance/v1/get_group_sample.py +++ b/samples/api/attendance/v1/get_group_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetGroupRequest = GetGroupRequest.builder() \ - .group_id("6919358128597097404") \ - .employee_type("employee_id") \ - .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ - .build() + # 构造请求对象 + request: GetGroupRequest = GetGroupRequest.builder() \ + .group_id("6919358128597097404") \ + .employee_type("employee_id") \ + .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ + .build() - # 发起请求 - response: GetGroupResponse = client.attendance.v1.group.get(request) + # 发起请求 + response: GetGroupResponse = client.attendance.v1.group.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetGroupRequest = GetGroupRequest.builder() \ - .group_id("6919358128597097404") \ - .employee_type("employee_id") \ - .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ - .build() + # 构造请求对象 + request: GetGroupRequest = GetGroupRequest.builder() \ + .group_id("6919358128597097404") \ + .employee_type("employee_id") \ + .dept_type("od-fcb45c28a45311afd441b8869541ece8") \ + .build() - # 发起请求 - response: GetGroupResponse = await client.attendance.v1.group.aget(request) + # 发起请求 + response: GetGroupResponse = await client.attendance.v1.group.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/get_leave_employ_expire_record_sample.py b/samples/api/attendance/v1/get_leave_employ_expire_record_sample.py index 40f68d592..212e4c51b 100644 --- a/samples/api/attendance/v1/get_leave_employ_expire_record_sample.py +++ b/samples/api/attendance/v1/get_leave_employ_expire_record_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetLeaveEmployExpireRecordRequest = GetLeaveEmployExpireRecordRequest.builder() \ - .leave_id("1") \ - .user_id_type("open_id") \ - .request_body(GetLeaveEmployExpireRecordRequestBody.builder() - .employment_id("1") - .leave_type_id("1") - .start_expiration_date("2023-04-10") - .end_expiration_date("2023-05-10") - .time_offset(480) - .build()) \ - .build() + # 构造请求对象 + request: GetLeaveEmployExpireRecordRequest = GetLeaveEmployExpireRecordRequest.builder() \ + .leave_id("1") \ + .user_id_type("open_id") \ + .request_body(GetLeaveEmployExpireRecordRequestBody.builder() + .employment_id("1") + .leave_type_id("1") + .start_expiration_date("2023-04-10") + .end_expiration_date("2023-05-10") + .time_offset(480) + .build()) \ + .build() - # 发起请求 - response: GetLeaveEmployExpireRecordResponse = client.attendance.v1.leave_employ_expire_record.get(request) + # 发起请求 + response: GetLeaveEmployExpireRecordResponse = client.attendance.v1.leave_employ_expire_record.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.leave_employ_expire_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.leave_employ_expire_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetLeaveEmployExpireRecordRequest = GetLeaveEmployExpireRecordRequest.builder() \ - .leave_id("1") \ - .user_id_type("open_id") \ - .request_body(GetLeaveEmployExpireRecordRequestBody.builder() - .employment_id("1") - .leave_type_id("1") - .start_expiration_date("2023-04-10") - .end_expiration_date("2023-05-10") - .time_offset(480) - .build()) \ - .build() + # 构造请求对象 + request: GetLeaveEmployExpireRecordRequest = GetLeaveEmployExpireRecordRequest.builder() \ + .leave_id("1") \ + .user_id_type("open_id") \ + .request_body(GetLeaveEmployExpireRecordRequestBody.builder() + .employment_id("1") + .leave_type_id("1") + .start_expiration_date("2023-04-10") + .end_expiration_date("2023-05-10") + .time_offset(480) + .build()) \ + .build() - # 发起请求 - response: GetLeaveEmployExpireRecordResponse = await client.attendance.v1.leave_employ_expire_record.aget(request) + # 发起请求 + response: GetLeaveEmployExpireRecordResponse = await client.attendance.v1.leave_employ_expire_record.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.leave_employ_expire_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.leave_employ_expire_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/get_shift_sample.py b/samples/api/attendance/v1/get_shift_sample.py index 8adf20d7c..f5c18ba76 100644 --- a/samples/api/attendance/v1/get_shift_sample.py +++ b/samples/api/attendance/v1/get_shift_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetShiftRequest = GetShiftRequest.builder() \ - .shift_id("6919358778597097404") \ - .build() + # 构造请求对象 + request: GetShiftRequest = GetShiftRequest.builder() \ + .shift_id("6919358778597097404") \ + .build() - # 发起请求 - response: GetShiftResponse = client.attendance.v1.shift.get(request) + # 发起请求 + response: GetShiftResponse = client.attendance.v1.shift.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetShiftRequest = GetShiftRequest.builder() \ - .shift_id("6919358778597097404") \ - .build() + # 构造请求对象 + request: GetShiftRequest = GetShiftRequest.builder() \ + .shift_id("6919358778597097404") \ + .build() - # 发起请求 - response: GetShiftResponse = await client.attendance.v1.shift.aget(request) + # 发起请求 + response: GetShiftResponse = await client.attendance.v1.shift.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/get_user_flow_sample.py b/samples/api/attendance/v1/get_user_flow_sample.py index 62a063add..60b43a62f 100644 --- a/samples/api/attendance/v1/get_user_flow_sample.py +++ b/samples/api/attendance/v1/get_user_flow_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserFlowRequest = GetUserFlowRequest.builder() \ - .user_flow_id("6708236686834352397") \ - .employee_type("employee_id") \ - .build() + # 构造请求对象 + request: GetUserFlowRequest = GetUserFlowRequest.builder() \ + .user_flow_id("6708236686834352397") \ + .employee_type("employee_id") \ + .build() - # 发起请求 - response: GetUserFlowResponse = client.attendance.v1.user_flow.get(request) + # 发起请求 + response: GetUserFlowResponse = client.attendance.v1.user_flow.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserFlowRequest = GetUserFlowRequest.builder() \ - .user_flow_id("6708236686834352397") \ - .employee_type("employee_id") \ - .build() + # 构造请求对象 + request: GetUserFlowRequest = GetUserFlowRequest.builder() \ + .user_flow_id("6708236686834352397") \ + .employee_type("employee_id") \ + .build() - # 发起请求 - response: GetUserFlowResponse = await client.attendance.v1.user_flow.aget(request) + # 发起请求 + response: GetUserFlowResponse = await client.attendance.v1.user_flow.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/list_archive_rule_sample.py b/samples/api/attendance/v1/list_archive_rule_sample.py index f5f687d46..41e5a5a65 100644 --- a/samples/api/attendance/v1/list_archive_rule_sample.py +++ b/samples/api/attendance/v1/list_archive_rule_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListArchiveRuleRequest = ListArchiveRuleRequest.builder() \ - .page_size(10) \ - .page_token("xxx") \ - .build() + # 构造请求对象 + request: ListArchiveRuleRequest = ListArchiveRuleRequest.builder() \ + .page_size(10) \ + .page_token("xxx") \ + .build() - # 发起请求 - response: ListArchiveRuleResponse = client.attendance.v1.archive_rule.list(request) + # 发起请求 + response: ListArchiveRuleResponse = client.attendance.v1.archive_rule.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListArchiveRuleRequest = ListArchiveRuleRequest.builder() \ - .page_size(10) \ - .page_token("xxx") \ - .build() + # 构造请求对象 + request: ListArchiveRuleRequest = ListArchiveRuleRequest.builder() \ + .page_size(10) \ + .page_token("xxx") \ + .build() - # 发起请求 - response: ListArchiveRuleResponse = await client.attendance.v1.archive_rule.alist(request) + # 发起请求 + response: ListArchiveRuleResponse = await client.attendance.v1.archive_rule.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/list_group_sample.py b/samples/api/attendance/v1/list_group_sample.py index 2b10e8f7d..a6a0831e6 100644 --- a/samples/api/attendance/v1/list_group_sample.py +++ b/samples/api/attendance/v1/list_group_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListGroupRequest = ListGroupRequest.builder() \ - .page_size(10) \ - .page_token("wgNOR1rmxogRvAsGl6CXlQ==") \ - .build() + # 构造请求对象 + request: ListGroupRequest = ListGroupRequest.builder() \ + .page_size(10) \ + .page_token("wgNOR1rmxogRvAsGl6CXlQ==") \ + .build() - # 发起请求 - response: ListGroupResponse = client.attendance.v1.group.list(request) + # 发起请求 + response: ListGroupResponse = client.attendance.v1.group.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListGroupRequest = ListGroupRequest.builder() \ - .page_size(10) \ - .page_token("wgNOR1rmxogRvAsGl6CXlQ==") \ - .build() + # 构造请求对象 + request: ListGroupRequest = ListGroupRequest.builder() \ + .page_size(10) \ + .page_token("wgNOR1rmxogRvAsGl6CXlQ==") \ + .build() - # 发起请求 - response: ListGroupResponse = await client.attendance.v1.group.alist(request) + # 发起请求 + response: ListGroupResponse = await client.attendance.v1.group.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/list_shift_sample.py b/samples/api/attendance/v1/list_shift_sample.py index 2211ad0f4..9c2e9205b 100644 --- a/samples/api/attendance/v1/list_shift_sample.py +++ b/samples/api/attendance/v1/list_shift_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListShiftRequest = ListShiftRequest.builder() \ - .page_size(10) \ - .page_token("YrkvQ1wGaPVta45tkxuGiQ==") \ - .build() + # 构造请求对象 + request: ListShiftRequest = ListShiftRequest.builder() \ + .page_size(10) \ + .page_token("YrkvQ1wGaPVta45tkxuGiQ==") \ + .build() - # 发起请求 - response: ListShiftResponse = client.attendance.v1.shift.list(request) + # 发起请求 + response: ListShiftResponse = client.attendance.v1.shift.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListShiftRequest = ListShiftRequest.builder() \ - .page_size(10) \ - .page_token("YrkvQ1wGaPVta45tkxuGiQ==") \ - .build() + # 构造请求对象 + request: ListShiftRequest = ListShiftRequest.builder() \ + .page_size(10) \ + .page_token("YrkvQ1wGaPVta45tkxuGiQ==") \ + .build() - # 发起请求 - response: ListShiftResponse = await client.attendance.v1.shift.alist(request) + # 发起请求 + response: ListShiftResponse = await client.attendance.v1.shift.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/modify_user_setting_sample.py b/samples/api/attendance/v1/modify_user_setting_sample.py index 4b5c907d4..088da3ff5 100644 --- a/samples/api/attendance/v1/modify_user_setting_sample.py +++ b/samples/api/attendance/v1/modify_user_setting_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ModifyUserSettingRequest = ModifyUserSettingRequest.builder() \ - .employee_type("employee_id") \ - .request_body(ModifyUserSettingRequestBody.builder() - .user_setting(UserSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: ModifyUserSettingRequest = ModifyUserSettingRequest.builder() \ + .employee_type("employee_id") \ + .request_body(ModifyUserSettingRequestBody.builder() + .user_setting(UserSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: ModifyUserSettingResponse = client.attendance.v1.user_setting.modify(request) + # 发起请求 + response: ModifyUserSettingResponse = client.attendance.v1.user_setting.modify(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_setting.modify failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_setting.modify failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ModifyUserSettingRequest = ModifyUserSettingRequest.builder() \ - .employee_type("employee_id") \ - .request_body(ModifyUserSettingRequestBody.builder() - .user_setting(UserSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: ModifyUserSettingRequest = ModifyUserSettingRequest.builder() \ + .employee_type("employee_id") \ + .request_body(ModifyUserSettingRequestBody.builder() + .user_setting(UserSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: ModifyUserSettingResponse = await client.attendance.v1.user_setting.amodify(request) + # 发起请求 + response: ModifyUserSettingResponse = await client.attendance.v1.user_setting.amodify(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_setting.amodify failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_setting.amodify failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/patch_leave_accrual_record_sample.py b/samples/api/attendance/v1/patch_leave_accrual_record_sample.py index 662980caa..8ec2b761a 100644 --- a/samples/api/attendance/v1/patch_leave_accrual_record_sample.py +++ b/samples/api/attendance/v1/patch_leave_accrual_record_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchLeaveAccrualRecordRequest = PatchLeaveAccrualRecordRequest.builder() \ - .leave_id("1") \ - .user_id_type("open_id") \ - .request_body(PatchLeaveAccrualRecordRequestBody.builder() - .leave_granting_record_id("1") - .employment_id("1") - .leave_type_id("1") - .reason([]) - .time_offset(480) - .expiration_date("2020-01-01") - .quantity("1") - .section_type(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchLeaveAccrualRecordRequest = PatchLeaveAccrualRecordRequest.builder() \ + .leave_id("1") \ + .user_id_type("open_id") \ + .request_body(PatchLeaveAccrualRecordRequestBody.builder() + .leave_granting_record_id("1") + .employment_id("1") + .leave_type_id("1") + .reason([]) + .time_offset(480) + .expiration_date("2020-01-01") + .quantity("1") + .section_type(1) + .build()) \ + .build() - # 发起请求 - response: PatchLeaveAccrualRecordResponse = client.attendance.v1.leave_accrual_record.patch(request) + # 发起请求 + response: PatchLeaveAccrualRecordResponse = client.attendance.v1.leave_accrual_record.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.leave_accrual_record.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.leave_accrual_record.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchLeaveAccrualRecordRequest = PatchLeaveAccrualRecordRequest.builder() \ - .leave_id("1") \ - .user_id_type("open_id") \ - .request_body(PatchLeaveAccrualRecordRequestBody.builder() - .leave_granting_record_id("1") - .employment_id("1") - .leave_type_id("1") - .reason([]) - .time_offset(480) - .expiration_date("2020-01-01") - .quantity("1") - .section_type(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchLeaveAccrualRecordRequest = PatchLeaveAccrualRecordRequest.builder() \ + .leave_id("1") \ + .user_id_type("open_id") \ + .request_body(PatchLeaveAccrualRecordRequestBody.builder() + .leave_granting_record_id("1") + .employment_id("1") + .leave_type_id("1") + .reason([]) + .time_offset(480) + .expiration_date("2020-01-01") + .quantity("1") + .section_type(1) + .build()) \ + .build() - # 发起请求 - response: PatchLeaveAccrualRecordResponse = await client.attendance.v1.leave_accrual_record.apatch(request) + # 发起请求 + response: PatchLeaveAccrualRecordResponse = await client.attendance.v1.leave_accrual_record.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.leave_accrual_record.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.leave_accrual_record.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/process_approval_info_sample.py b/samples/api/attendance/v1/process_approval_info_sample.py index 328d21556..65b1d1fd8 100644 --- a/samples/api/attendance/v1/process_approval_info_sample.py +++ b/samples/api/attendance/v1/process_approval_info_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProcessApprovalInfoRequest = ProcessApprovalInfoRequest.builder() \ - .request_body(ProcessApprovalInfoRequestBody.builder() - .approval_id("6737202939523236113") - .approval_type("remedy") - .status(4) - .build()) \ - .build() + # 构造请求对象 + request: ProcessApprovalInfoRequest = ProcessApprovalInfoRequest.builder() \ + .request_body(ProcessApprovalInfoRequestBody.builder() + .approval_id("6737202939523236113") + .approval_type("remedy") + .status(4) + .build()) \ + .build() - # 发起请求 - response: ProcessApprovalInfoResponse = client.attendance.v1.approval_info.process(request) + # 发起请求 + response: ProcessApprovalInfoResponse = client.attendance.v1.approval_info.process(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.approval_info.process failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.approval_info.process failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProcessApprovalInfoRequest = ProcessApprovalInfoRequest.builder() \ - .request_body(ProcessApprovalInfoRequestBody.builder() - .approval_id("6737202939523236113") - .approval_type("remedy") - .status(4) - .build()) \ - .build() + # 构造请求对象 + request: ProcessApprovalInfoRequest = ProcessApprovalInfoRequest.builder() \ + .request_body(ProcessApprovalInfoRequestBody.builder() + .approval_id("6737202939523236113") + .approval_type("remedy") + .status(4) + .build()) \ + .build() - # 发起请求 - response: ProcessApprovalInfoResponse = await client.attendance.v1.approval_info.aprocess(request) + # 发起请求 + response: ProcessApprovalInfoResponse = await client.attendance.v1.approval_info.aprocess(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.approval_info.aprocess failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.approval_info.aprocess failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_shift_sample.py b/samples/api/attendance/v1/query_shift_sample.py index c20ff457b..7b092358e 100644 --- a/samples/api/attendance/v1/query_shift_sample.py +++ b/samples/api/attendance/v1/query_shift_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryShiftRequest = QueryShiftRequest.builder() \ - .shift_name("早班") \ - .build() + # 构造请求对象 + request: QueryShiftRequest = QueryShiftRequest.builder() \ + .shift_name("早班") \ + .build() - # 发起请求 - response: QueryShiftResponse = client.attendance.v1.shift.query(request) + # 发起请求 + response: QueryShiftResponse = client.attendance.v1.shift.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryShiftRequest = QueryShiftRequest.builder() \ - .shift_name("早班") \ - .build() + # 构造请求对象 + request: QueryShiftRequest = QueryShiftRequest.builder() \ + .shift_name("早班") \ + .build() - # 发起请求 - response: QueryShiftResponse = await client.attendance.v1.shift.aquery(request) + # 发起请求 + response: QueryShiftResponse = await client.attendance.v1.shift.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.shift.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.shift.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_allowed_remedys_user_task_remedy_sample.py b/samples/api/attendance/v1/query_user_allowed_remedys_user_task_remedy_sample.py index f4c397b86..39d4d9d41 100644 --- a/samples/api/attendance/v1/query_user_allowed_remedys_user_task_remedy_sample.py +++ b/samples/api/attendance/v1/query_user_allowed_remedys_user_task_remedy_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserAllowedRemedysUserTaskRemedyRequest = QueryUserAllowedRemedysUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserAllowedRemedysUserTaskRemedyRequestBody.builder() - .user_id("abd754f7") - .remedy_date(20210104) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserAllowedRemedysUserTaskRemedyRequest = QueryUserAllowedRemedysUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserAllowedRemedysUserTaskRemedyRequestBody.builder() + .user_id("abd754f7") + .remedy_date(20210104) + .build()) \ + .build() - # 发起请求 - response: QueryUserAllowedRemedysUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.query_user_allowed_remedys( - request) + # 发起请求 + response: QueryUserAllowedRemedysUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.query_user_allowed_remedys(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.query_user_allowed_remedys failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.query_user_allowed_remedys failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserAllowedRemedysUserTaskRemedyRequest = QueryUserAllowedRemedysUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserAllowedRemedysUserTaskRemedyRequestBody.builder() - .user_id("abd754f7") - .remedy_date(20210104) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserAllowedRemedysUserTaskRemedyRequest = QueryUserAllowedRemedysUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserAllowedRemedysUserTaskRemedyRequestBody.builder() + .user_id("abd754f7") + .remedy_date(20210104) + .build()) \ + .build() - # 发起请求 - response: QueryUserAllowedRemedysUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.aquery_user_allowed_remedys( - request) + # 发起请求 + response: QueryUserAllowedRemedysUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.aquery_user_allowed_remedys(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.aquery_user_allowed_remedys failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.aquery_user_allowed_remedys failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_approval_sample.py b/samples/api/attendance/v1/query_user_approval_sample.py index 639aeabea..96c7ad128 100644 --- a/samples/api/attendance/v1/query_user_approval_sample.py +++ b/samples/api/attendance/v1/query_user_approval_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserApprovalRequest = QueryUserApprovalRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserApprovalRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .check_date_type("PeriodTime") - .status(2) - .check_time_from("1566641088") - .check_time_to("1592561088") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserApprovalRequest = QueryUserApprovalRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserApprovalRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .check_date_type("PeriodTime") + .status(2) + .check_time_from("1566641088") + .check_time_to("1592561088") + .build()) \ + .build() - # 发起请求 - response: QueryUserApprovalResponse = client.attendance.v1.user_approval.query(request) + # 发起请求 + response: QueryUserApprovalResponse = client.attendance.v1.user_approval.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_approval.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_approval.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserApprovalRequest = QueryUserApprovalRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserApprovalRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .check_date_type("PeriodTime") - .status(2) - .check_time_from("1566641088") - .check_time_to("1592561088") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserApprovalRequest = QueryUserApprovalRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserApprovalRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .check_date_type("PeriodTime") + .status(2) + .check_time_from("1566641088") + .check_time_to("1592561088") + .build()) \ + .build() - # 发起请求 - response: QueryUserApprovalResponse = await client.attendance.v1.user_approval.aquery(request) + # 发起请求 + response: QueryUserApprovalResponse = await client.attendance.v1.user_approval.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_approval.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_approval.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_daily_shift_sample.py b/samples/api/attendance/v1/query_user_daily_shift_sample.py index 86bfd74df..2f3932de7 100644 --- a/samples/api/attendance/v1/query_user_daily_shift_sample.py +++ b/samples/api/attendance/v1/query_user_daily_shift_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserDailyShiftRequest = QueryUserDailyShiftRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserDailyShiftRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserDailyShiftRequest = QueryUserDailyShiftRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserDailyShiftRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .build()) \ + .build() - # 发起请求 - response: QueryUserDailyShiftResponse = client.attendance.v1.user_daily_shift.query(request) + # 发起请求 + response: QueryUserDailyShiftResponse = client.attendance.v1.user_daily_shift.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_daily_shift.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_daily_shift.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserDailyShiftRequest = QueryUserDailyShiftRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserDailyShiftRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserDailyShiftRequest = QueryUserDailyShiftRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserDailyShiftRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .build()) \ + .build() - # 发起请求 - response: QueryUserDailyShiftResponse = await client.attendance.v1.user_daily_shift.aquery(request) + # 发起请求 + response: QueryUserDailyShiftResponse = await client.attendance.v1.user_daily_shift.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_daily_shift.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_daily_shift.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_flow_sample.py b/samples/api/attendance/v1/query_user_flow_sample.py index 2a8b7db83..c6ee9ac0a 100644 --- a/samples/api/attendance/v1/query_user_flow_sample.py +++ b/samples/api/attendance/v1/query_user_flow_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserFlowRequest = QueryUserFlowRequest.builder() \ - .employee_type("employee_id") \ - .include_terminated_user(True) \ - .request_body(QueryUserFlowRequestBody.builder() - .user_ids([]) - .check_time_from("1566641088") - .check_time_to("1566641088") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserFlowRequest = QueryUserFlowRequest.builder() \ + .employee_type("employee_id") \ + .include_terminated_user(True) \ + .request_body(QueryUserFlowRequestBody.builder() + .user_ids([]) + .check_time_from("1566641088") + .check_time_to("1566641088") + .build()) \ + .build() - # 发起请求 - response: QueryUserFlowResponse = client.attendance.v1.user_flow.query(request) + # 发起请求 + response: QueryUserFlowResponse = client.attendance.v1.user_flow.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserFlowRequest = QueryUserFlowRequest.builder() \ - .employee_type("employee_id") \ - .include_terminated_user(True) \ - .request_body(QueryUserFlowRequestBody.builder() - .user_ids([]) - .check_time_from("1566641088") - .check_time_to("1566641088") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserFlowRequest = QueryUserFlowRequest.builder() \ + .employee_type("employee_id") \ + .include_terminated_user(True) \ + .request_body(QueryUserFlowRequestBody.builder() + .user_ids([]) + .check_time_from("1566641088") + .check_time_to("1566641088") + .build()) \ + .build() - # 发起请求 - response: QueryUserFlowResponse = await client.attendance.v1.user_flow.aquery(request) + # 发起请求 + response: QueryUserFlowResponse = await client.attendance.v1.user_flow.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_flow.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_flow.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_setting_sample.py b/samples/api/attendance/v1/query_user_setting_sample.py index cc099214f..f3c39fcdb 100644 --- a/samples/api/attendance/v1/query_user_setting_sample.py +++ b/samples/api/attendance/v1/query_user_setting_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserSettingRequest = QueryUserSettingRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserSettingRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserSettingRequest = QueryUserSettingRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserSettingRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: QueryUserSettingResponse = client.attendance.v1.user_setting.query(request) + # 发起请求 + response: QueryUserSettingResponse = client.attendance.v1.user_setting.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_setting.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_setting.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserSettingRequest = QueryUserSettingRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserSettingRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserSettingRequest = QueryUserSettingRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserSettingRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: QueryUserSettingResponse = await client.attendance.v1.user_setting.aquery(request) + # 发起请求 + response: QueryUserSettingResponse = await client.attendance.v1.user_setting.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_setting.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_setting.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_stats_data_sample.py b/samples/api/attendance/v1/query_user_stats_data_sample.py index 4e1fe8c49..15094c2e0 100644 --- a/samples/api/attendance/v1/query_user_stats_data_sample.py +++ b/samples/api/attendance/v1/query_user_stats_data_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsDataRequest = QueryUserStatsDataRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsDataRequestBody.builder() - .locale("zh") - .stats_type("month") - .start_date(20210316) - .end_date(20210323) - .user_ids([]) - .need_history(True) - .current_group_only(True) - .user_id("ec8ddg56") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsDataRequest = QueryUserStatsDataRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsDataRequestBody.builder() + .locale("zh") + .stats_type("month") + .start_date(20210316) + .end_date(20210323) + .user_ids([]) + .need_history(True) + .current_group_only(True) + .user_id("ec8ddg56") + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsDataResponse = client.attendance.v1.user_stats_data.query(request) + # 发起请求 + response: QueryUserStatsDataResponse = client.attendance.v1.user_stats_data.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_data.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_data.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsDataRequest = QueryUserStatsDataRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsDataRequestBody.builder() - .locale("zh") - .stats_type("month") - .start_date(20210316) - .end_date(20210323) - .user_ids([]) - .need_history(True) - .current_group_only(True) - .user_id("ec8ddg56") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsDataRequest = QueryUserStatsDataRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsDataRequestBody.builder() + .locale("zh") + .stats_type("month") + .start_date(20210316) + .end_date(20210323) + .user_ids([]) + .need_history(True) + .current_group_only(True) + .user_id("ec8ddg56") + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsDataResponse = await client.attendance.v1.user_stats_data.aquery(request) + # 发起请求 + response: QueryUserStatsDataResponse = await client.attendance.v1.user_stats_data.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_data.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_data.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_stats_field_sample.py b/samples/api/attendance/v1/query_user_stats_field_sample.py index 5a2b8cf20..441d2a03c 100644 --- a/samples/api/attendance/v1/query_user_stats_field_sample.py +++ b/samples/api/attendance/v1/query_user_stats_field_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsFieldRequest = QueryUserStatsFieldRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsFieldRequestBody.builder() - .locale("zh") - .stats_type("daily") - .start_date(20210316) - .end_date(20210323) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsFieldRequest = QueryUserStatsFieldRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsFieldRequestBody.builder() + .locale("zh") + .stats_type("daily") + .start_date(20210316) + .end_date(20210323) + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsFieldResponse = client.attendance.v1.user_stats_field.query(request) + # 发起请求 + response: QueryUserStatsFieldResponse = client.attendance.v1.user_stats_field.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_field.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_field.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsFieldRequest = QueryUserStatsFieldRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsFieldRequestBody.builder() - .locale("zh") - .stats_type("daily") - .start_date(20210316) - .end_date(20210323) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsFieldRequest = QueryUserStatsFieldRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsFieldRequestBody.builder() + .locale("zh") + .stats_type("daily") + .start_date(20210316) + .end_date(20210323) + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsFieldResponse = await client.attendance.v1.user_stats_field.aquery(request) + # 发起请求 + response: QueryUserStatsFieldResponse = await client.attendance.v1.user_stats_field.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_field.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_field.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_stats_view_sample.py b/samples/api/attendance/v1/query_user_stats_view_sample.py index d2f6b871e..7ab58713a 100644 --- a/samples/api/attendance/v1/query_user_stats_view_sample.py +++ b/samples/api/attendance/v1/query_user_stats_view_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsViewRequest = QueryUserStatsViewRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsViewRequestBody.builder() - .locale("zh") - .stats_type("daily") - .user_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsViewRequest = QueryUserStatsViewRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsViewRequestBody.builder() + .locale("zh") + .stats_type("daily") + .user_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsViewResponse = client.attendance.v1.user_stats_view.query(request) + # 发起请求 + response: QueryUserStatsViewResponse = client.attendance.v1.user_stats_view.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_view.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_view.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserStatsViewRequest = QueryUserStatsViewRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserStatsViewRequestBody.builder() - .locale("zh") - .stats_type("daily") - .user_id("dd31248a") - .build()) \ - .build() + # 构造请求对象 + request: QueryUserStatsViewRequest = QueryUserStatsViewRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserStatsViewRequestBody.builder() + .locale("zh") + .stats_type("daily") + .user_id("dd31248a") + .build()) \ + .build() - # 发起请求 - response: QueryUserStatsViewResponse = await client.attendance.v1.user_stats_view.aquery(request) + # 发起请求 + response: QueryUserStatsViewResponse = await client.attendance.v1.user_stats_view.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_view.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_view.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_task_remedy_sample.py b/samples/api/attendance/v1/query_user_task_remedy_sample.py index d716fbeac..17c4ce7dc 100644 --- a/samples/api/attendance/v1/query_user_task_remedy_sample.py +++ b/samples/api/attendance/v1/query_user_task_remedy_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserTaskRemedyRequest = QueryUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserTaskRemedyRequestBody.builder() - .user_ids([]) - .check_time_from("1566641088") - .check_time_to("1592561088") - .check_date_type("PeriodTime") - .status(2) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserTaskRemedyRequest = QueryUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserTaskRemedyRequestBody.builder() + .user_ids([]) + .check_time_from("1566641088") + .check_time_to("1592561088") + .check_date_type("PeriodTime") + .status(2) + .build()) \ + .build() - # 发起请求 - response: QueryUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.query(request) + # 发起请求 + response: QueryUserTaskRemedyResponse = client.attendance.v1.user_task_remedy.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserTaskRemedyRequest = QueryUserTaskRemedyRequest.builder() \ - .employee_type("employee_id") \ - .request_body(QueryUserTaskRemedyRequestBody.builder() - .user_ids([]) - .check_time_from("1566641088") - .check_time_to("1592561088") - .check_date_type("PeriodTime") - .status(2) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserTaskRemedyRequest = QueryUserTaskRemedyRequest.builder() \ + .employee_type("employee_id") \ + .request_body(QueryUserTaskRemedyRequestBody.builder() + .user_ids([]) + .check_time_from("1566641088") + .check_time_to("1592561088") + .check_date_type("PeriodTime") + .status(2) + .build()) \ + .build() - # 发起请求 - response: QueryUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.aquery(request) + # 发起请求 + response: QueryUserTaskRemedyResponse = await client.attendance.v1.user_task_remedy.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task_remedy.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task_remedy.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/query_user_task_sample.py b/samples/api/attendance/v1/query_user_task_sample.py index 4996636a3..05d063bc4 100644 --- a/samples/api/attendance/v1/query_user_task_sample.py +++ b/samples/api/attendance/v1/query_user_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserTaskRequest = QueryUserTaskRequest.builder() \ - .employee_type("employee_id") \ - .ignore_invalid_users(True) \ - .include_terminated_user(True) \ - .request_body(QueryUserTaskRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .need_overtime_result(True) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserTaskRequest = QueryUserTaskRequest.builder() \ + .employee_type("employee_id") \ + .ignore_invalid_users(True) \ + .include_terminated_user(True) \ + .request_body(QueryUserTaskRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .need_overtime_result(True) + .build()) \ + .build() - # 发起请求 - response: QueryUserTaskResponse = client.attendance.v1.user_task.query(request) + # 发起请求 + response: QueryUserTaskResponse = client.attendance.v1.user_task.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserTaskRequest = QueryUserTaskRequest.builder() \ - .employee_type("employee_id") \ - .ignore_invalid_users(True) \ - .include_terminated_user(True) \ - .request_body(QueryUserTaskRequestBody.builder() - .user_ids([]) - .check_date_from(20190817) - .check_date_to(20190820) - .need_overtime_result(True) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserTaskRequest = QueryUserTaskRequest.builder() \ + .employee_type("employee_id") \ + .ignore_invalid_users(True) \ + .include_terminated_user(True) \ + .request_body(QueryUserTaskRequestBody.builder() + .user_ids([]) + .check_date_from(20190817) + .check_date_to(20190820) + .need_overtime_result(True) + .build()) \ + .build() - # 发起请求 - response: QueryUserTaskResponse = await client.attendance.v1.user_task.aquery(request) + # 发起请求 + response: QueryUserTaskResponse = await client.attendance.v1.user_task.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/search_group_sample.py b/samples/api/attendance/v1/search_group_sample.py index 36e29e3d0..da761abc1 100644 --- a/samples/api/attendance/v1/search_group_sample.py +++ b/samples/api/attendance/v1/search_group_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchGroupRequest = SearchGroupRequest.builder() \ - .request_body(SearchGroupRequestBody.builder() - .group_name("考勤组1") - .build()) \ - .build() + # 构造请求对象 + request: SearchGroupRequest = SearchGroupRequest.builder() \ + .request_body(SearchGroupRequestBody.builder() + .group_name("考勤组1") + .build()) \ + .build() - # 发起请求 - response: SearchGroupResponse = client.attendance.v1.group.search(request) + # 发起请求 + response: SearchGroupResponse = client.attendance.v1.group.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchGroupRequest = SearchGroupRequest.builder() \ - .request_body(SearchGroupRequestBody.builder() - .group_name("考勤组1") - .build()) \ - .build() + # 构造请求对象 + request: SearchGroupRequest = SearchGroupRequest.builder() \ + .request_body(SearchGroupRequestBody.builder() + .group_name("考勤组1") + .build()) \ + .build() - # 发起请求 - response: SearchGroupResponse = await client.attendance.v1.group.asearch(request) + # 发起请求 + response: SearchGroupResponse = await client.attendance.v1.group.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.group.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.group.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/update_user_stats_view_sample.py b/samples/api/attendance/v1/update_user_stats_view_sample.py index 71af7c657..e8611a6b7 100644 --- a/samples/api/attendance/v1/update_user_stats_view_sample.py +++ b/samples/api/attendance/v1/update_user_stats_view_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserStatsViewRequest = UpdateUserStatsViewRequest.builder() \ - .user_stats_view_id("TmpZNU5qTTJORFF6T1RnNU5UTTNOakV6TWl0dGIyNTBhQT09") \ - .employee_type("employee_id") \ - .request_body(UpdateUserStatsViewRequestBody.builder() - .view(UserStatsView.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserStatsViewRequest = UpdateUserStatsViewRequest.builder() \ + .user_stats_view_id("TmpZNU5qTTJORFF6T1RnNU5UTTNOakV6TWl0dGIyNTBhQT09") \ + .employee_type("employee_id") \ + .request_body(UpdateUserStatsViewRequestBody.builder() + .view(UserStatsView.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateUserStatsViewResponse = client.attendance.v1.user_stats_view.update(request) + # 发起请求 + response: UpdateUserStatsViewResponse = client.attendance.v1.user_stats_view.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_view.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_view.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserStatsViewRequest = UpdateUserStatsViewRequest.builder() \ - .user_stats_view_id("TmpZNU5qTTJORFF6T1RnNU5UTTNOakV6TWl0dGIyNTBhQT09") \ - .employee_type("employee_id") \ - .request_body(UpdateUserStatsViewRequestBody.builder() - .view(UserStatsView.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserStatsViewRequest = UpdateUserStatsViewRequest.builder() \ + .user_stats_view_id("TmpZNU5qTTJORFF6T1RnNU5UTTNOakV6TWl0dGIyNTBhQT09") \ + .employee_type("employee_id") \ + .request_body(UpdateUserStatsViewRequestBody.builder() + .view(UserStatsView.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateUserStatsViewResponse = await client.attendance.v1.user_stats_view.aupdate(request) + # 发起请求 + response: UpdateUserStatsViewResponse = await client.attendance.v1.user_stats_view.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.user_stats_view.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.user_stats_view.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/upload_file_sample.py b/samples/api/attendance/v1/upload_file_sample.py index 56ac79008..b4ee26c91 100644 --- a/samples/api/attendance/v1/upload_file_sample.py +++ b/samples/api/attendance/v1/upload_file_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .file_name("人脸照片.jpg") \ - .request_body(UploadFileRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .file_name("人脸照片.jpg") \ + .request_body(UploadFileRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = client.attendance.v1.file.upload(request) + # 发起请求 + response: UploadFileResponse = client.attendance.v1.file.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .file_name("人脸照片.jpg") \ - .request_body(UploadFileRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .file_name("人脸照片.jpg") \ + .request_body(UploadFileRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = await client.attendance.v1.file.aupload(request) + # 发起请求 + response: UploadFileResponse = await client.attendance.v1.file.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/upload_report_archive_rule_sample.py b/samples/api/attendance/v1/upload_report_archive_rule_sample.py index 1e1c30d24..3762ef982 100644 --- a/samples/api/attendance/v1/upload_report_archive_rule_sample.py +++ b/samples/api/attendance/v1/upload_report_archive_rule_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadReportArchiveRuleRequest = UploadReportArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UploadReportArchiveRuleRequestBody.builder() - .month("202409") - .operator_id("ax11d") - .archive_report_datas([]) - .archive_rule_id("1") - .build()) \ - .build() + # 构造请求对象 + request: UploadReportArchiveRuleRequest = UploadReportArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UploadReportArchiveRuleRequestBody.builder() + .month("202409") + .operator_id("ax11d") + .archive_report_datas([]) + .archive_rule_id("1") + .build()) \ + .build() - # 发起请求 - response: UploadReportArchiveRuleResponse = client.attendance.v1.archive_rule.upload_report(request) + # 发起请求 + response: UploadReportArchiveRuleResponse = client.attendance.v1.archive_rule.upload_report(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.upload_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.upload_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadReportArchiveRuleRequest = UploadReportArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UploadReportArchiveRuleRequestBody.builder() - .month("202409") - .operator_id("ax11d") - .archive_report_datas([]) - .archive_rule_id("1") - .build()) \ - .build() + # 构造请求对象 + request: UploadReportArchiveRuleRequest = UploadReportArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UploadReportArchiveRuleRequestBody.builder() + .month("202409") + .operator_id("ax11d") + .archive_report_datas([]) + .archive_rule_id("1") + .build()) \ + .build() - # 发起请求 - response: UploadReportArchiveRuleResponse = await client.attendance.v1.archive_rule.aupload_report(request) + # 发起请求 + response: UploadReportArchiveRuleResponse = await client.attendance.v1.archive_rule.aupload_report(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.aupload_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.aupload_report failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/attendance/v1/user_stats_fields_query_archive_rule_sample.py b/samples/api/attendance/v1/user_stats_fields_query_archive_rule_sample.py index 55c98a226..1fa96ceec 100644 --- a/samples/api/attendance/v1/user_stats_fields_query_archive_rule_sample.py +++ b/samples/api/attendance/v1/user_stats_fields_query_archive_rule_sample.py @@ -5,72 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UserStatsFieldsQueryArchiveRuleRequest = UserStatsFieldsQueryArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UserStatsFieldsQueryArchiveRuleRequestBody.builder() - .locale("zh") - .month("202409") - .archive_rule_id("1") - .operator_id("ax8ud") - .build()) \ - .build() + # 构造请求对象 + request: UserStatsFieldsQueryArchiveRuleRequest = UserStatsFieldsQueryArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UserStatsFieldsQueryArchiveRuleRequestBody.builder() + .locale("zh") + .month("202409") + .archive_rule_id("1") + .operator_id("ax8ud") + .build()) \ + .build() - # 发起请求 - response: UserStatsFieldsQueryArchiveRuleResponse = client.attendance.v1.archive_rule.user_stats_fields_query( - request) + # 发起请求 + response: UserStatsFieldsQueryArchiveRuleResponse = client.attendance.v1.archive_rule.user_stats_fields_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.user_stats_fields_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.user_stats_fields_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UserStatsFieldsQueryArchiveRuleRequest = UserStatsFieldsQueryArchiveRuleRequest.builder() \ - .employee_type("employee_id") \ - .request_body(UserStatsFieldsQueryArchiveRuleRequestBody.builder() - .locale("zh") - .month("202409") - .archive_rule_id("1") - .operator_id("ax8ud") - .build()) \ - .build() + # 构造请求对象 + request: UserStatsFieldsQueryArchiveRuleRequest = UserStatsFieldsQueryArchiveRuleRequest.builder() \ + .employee_type("employee_id") \ + .request_body(UserStatsFieldsQueryArchiveRuleRequestBody.builder() + .locale("zh") + .month("202409") + .archive_rule_id("1") + .operator_id("ax8ud") + .build()) \ + .build() - # 发起请求 - response: UserStatsFieldsQueryArchiveRuleResponse = await client.attendance.v1.archive_rule.auser_stats_fields_query( - request) + # 发起请求 + response: UserStatsFieldsQueryArchiveRuleResponse = await client.attendance.v1.archive_rule.auser_stats_fields_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.attendance.v1.archive_rule.auser_stats_fields_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.attendance.v1.archive_rule.auser_stats_fields_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/auth/v3/create_app_access_token_sample.py b/samples/api/auth/v3/create_app_access_token_sample.py index 3bd7a3b7f..4a63da9d2 100644 --- a/samples/api/auth/v3/create_app_access_token_sample.py +++ b/samples/api/auth/v3/create_app_access_token_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppAccessTokenRequest = CreateAppAccessTokenRequest.builder() \ - .request_body(CreateAppAccessTokenRequestBody.builder() - .app_id("cli_ddfgkk38emd38") - .app_secret("clkfgkfdjes384kjdf9830d3k") - .app_ticket("jdjlsd03jk34hj3kldjflcmkel") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppAccessTokenRequest = CreateAppAccessTokenRequest.builder() \ + .request_body(CreateAppAccessTokenRequestBody.builder() + .app_id("cli_ddfgkk38emd38") + .app_secret("clkfgkfdjes384kjdf9830d3k") + .app_ticket("jdjlsd03jk34hj3kldjflcmkel") + .build()) \ + .build() - # 发起请求 - response: CreateAppAccessTokenResponse = client.auth.v3.app_access_token.create(request) + # 发起请求 + response: CreateAppAccessTokenResponse = client.auth.v3.app_access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppAccessTokenRequest = CreateAppAccessTokenRequest.builder() \ - .request_body(CreateAppAccessTokenRequestBody.builder() - .app_id("cli_ddfgkk38emd38") - .app_secret("clkfgkfdjes384kjdf9830d3k") - .app_ticket("jdjlsd03jk34hj3kldjflcmkel") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppAccessTokenRequest = CreateAppAccessTokenRequest.builder() \ + .request_body(CreateAppAccessTokenRequestBody.builder() + .app_id("cli_ddfgkk38emd38") + .app_secret("clkfgkfdjes384kjdf9830d3k") + .app_ticket("jdjlsd03jk34hj3kldjflcmkel") + .build()) \ + .build() - # 发起请求 - response: CreateAppAccessTokenResponse = await client.auth.v3.app_access_token.acreate(request) + # 发起请求 + response: CreateAppAccessTokenResponse = await client.auth.v3.app_access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/auth/v3/create_tenant_access_token_sample.py b/samples/api/auth/v3/create_tenant_access_token_sample.py index 3b0361f92..183405212 100644 --- a/samples/api/auth/v3/create_tenant_access_token_sample.py +++ b/samples/api/auth/v3/create_tenant_access_token_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTenantAccessTokenRequest = CreateTenantAccessTokenRequest.builder() \ - .request_body(CreateTenantAccessTokenRequestBody.builder() - .app_access_token("a-32bd8551db2f081cbfd26293f27516390b9feb04") - .tenant_key("73658811060f175d") - .build()) \ - .build() + # 构造请求对象 + request: CreateTenantAccessTokenRequest = CreateTenantAccessTokenRequest.builder() \ + .request_body(CreateTenantAccessTokenRequestBody.builder() + .app_access_token("a-32bd8551db2f081cbfd26293f27516390b9feb04") + .tenant_key("73658811060f175d") + .build()) \ + .build() - # 发起请求 - response: CreateTenantAccessTokenResponse = client.auth.v3.tenant_access_token.create(request) + # 发起请求 + response: CreateTenantAccessTokenResponse = client.auth.v3.tenant_access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.tenant_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.tenant_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTenantAccessTokenRequest = CreateTenantAccessTokenRequest.builder() \ - .request_body(CreateTenantAccessTokenRequestBody.builder() - .app_access_token("a-32bd8551db2f081cbfd26293f27516390b9feb04") - .tenant_key("73658811060f175d") - .build()) \ - .build() + # 构造请求对象 + request: CreateTenantAccessTokenRequest = CreateTenantAccessTokenRequest.builder() \ + .request_body(CreateTenantAccessTokenRequestBody.builder() + .app_access_token("a-32bd8551db2f081cbfd26293f27516390b9feb04") + .tenant_key("73658811060f175d") + .build()) \ + .build() - # 发起请求 - response: CreateTenantAccessTokenResponse = await client.auth.v3.tenant_access_token.acreate(request) + # 发起请求 + response: CreateTenantAccessTokenResponse = await client.auth.v3.tenant_access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.tenant_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.tenant_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/auth/v3/internal_app_access_token_sample.py b/samples/api/auth/v3/internal_app_access_token_sample.py index a70f5bb26..83f5020e3 100644 --- a/samples/api/auth/v3/internal_app_access_token_sample.py +++ b/samples/api/auth/v3/internal_app_access_token_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternalAppAccessTokenRequest = InternalAppAccessTokenRequest.builder() \ - .request_body(InternalAppAccessTokenRequestBody.builder() - .app_id("cli_hsjeriogfkd93jf84") - .app_secret("jdsfslkjdg8e73hdf9237enbd") - .build()) \ - .build() + # 构造请求对象 + request: InternalAppAccessTokenRequest = InternalAppAccessTokenRequest.builder() \ + .request_body(InternalAppAccessTokenRequestBody.builder() + .app_id("cli_hsjeriogfkd93jf84") + .app_secret("jdsfslkjdg8e73hdf9237enbd") + .build()) \ + .build() - # 发起请求 - response: InternalAppAccessTokenResponse = client.auth.v3.app_access_token.internal(request) + # 发起请求 + response: InternalAppAccessTokenResponse = client.auth.v3.app_access_token.internal(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_access_token.internal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_access_token.internal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternalAppAccessTokenRequest = InternalAppAccessTokenRequest.builder() \ - .request_body(InternalAppAccessTokenRequestBody.builder() - .app_id("cli_hsjeriogfkd93jf84") - .app_secret("jdsfslkjdg8e73hdf9237enbd") - .build()) \ - .build() + # 构造请求对象 + request: InternalAppAccessTokenRequest = InternalAppAccessTokenRequest.builder() \ + .request_body(InternalAppAccessTokenRequestBody.builder() + .app_id("cli_hsjeriogfkd93jf84") + .app_secret("jdsfslkjdg8e73hdf9237enbd") + .build()) \ + .build() - # 发起请求 - response: InternalAppAccessTokenResponse = await client.auth.v3.app_access_token.ainternal(request) + # 发起请求 + response: InternalAppAccessTokenResponse = await client.auth.v3.app_access_token.ainternal(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_access_token.ainternal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_access_token.ainternal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/auth/v3/internal_tenant_access_token_sample.py b/samples/api/auth/v3/internal_tenant_access_token_sample.py index fd243d84e..ea4ee4151 100644 --- a/samples/api/auth/v3/internal_tenant_access_token_sample.py +++ b/samples/api/auth/v3/internal_tenant_access_token_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternalTenantAccessTokenRequest = InternalTenantAccessTokenRequest.builder() \ - .request_body(InternalTenantAccessTokenRequestBody.builder() - .app_id("cli_slkdjalasdkjasd") - .app_secret("dskLLdkasdjlasdKK") - .build()) \ - .build() + # 构造请求对象 + request: InternalTenantAccessTokenRequest = InternalTenantAccessTokenRequest.builder() \ + .request_body(InternalTenantAccessTokenRequestBody.builder() + .app_id("cli_slkdjalasdkjasd") + .app_secret("dskLLdkasdjlasdKK") + .build()) \ + .build() - # 发起请求 - response: InternalTenantAccessTokenResponse = client.auth.v3.tenant_access_token.internal(request) + # 发起请求 + response: InternalTenantAccessTokenResponse = client.auth.v3.tenant_access_token.internal(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.tenant_access_token.internal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.tenant_access_token.internal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternalTenantAccessTokenRequest = InternalTenantAccessTokenRequest.builder() \ - .request_body(InternalTenantAccessTokenRequestBody.builder() - .app_id("cli_slkdjalasdkjasd") - .app_secret("dskLLdkasdjlasdKK") - .build()) \ - .build() + # 构造请求对象 + request: InternalTenantAccessTokenRequest = InternalTenantAccessTokenRequest.builder() \ + .request_body(InternalTenantAccessTokenRequestBody.builder() + .app_id("cli_slkdjalasdkjasd") + .app_secret("dskLLdkasdjlasdKK") + .build()) \ + .build() - # 发起请求 - response: InternalTenantAccessTokenResponse = await client.auth.v3.tenant_access_token.ainternal(request) + # 发起请求 + response: InternalTenantAccessTokenResponse = await client.auth.v3.tenant_access_token.ainternal(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.tenant_access_token.ainternal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.tenant_access_token.ainternal failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/auth/v3/resend_app_ticket_sample.py b/samples/api/auth/v3/resend_app_ticket_sample.py index e29a687bb..3a0454706 100644 --- a/samples/api/auth/v3/resend_app_ticket_sample.py +++ b/samples/api/auth/v3/resend_app_ticket_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResendAppTicketRequest = ResendAppTicketRequest.builder() \ - .request_body(ResendAppTicketRequestBody.builder() - .app_id("cli_slkdjalasdkjasd") - .app_secret("dskLLdkasdjlasdKK") - .build()) \ - .build() + # 构造请求对象 + request: ResendAppTicketRequest = ResendAppTicketRequest.builder() \ + .request_body(ResendAppTicketRequestBody.builder() + .app_id("cli_slkdjalasdkjasd") + .app_secret("dskLLdkasdjlasdKK") + .build()) \ + .build() - # 发起请求 - response: ResendAppTicketResponse = client.auth.v3.app_ticket.resend(request) + # 发起请求 + response: ResendAppTicketResponse = client.auth.v3.app_ticket.resend(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_ticket.resend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_ticket.resend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResendAppTicketRequest = ResendAppTicketRequest.builder() \ - .request_body(ResendAppTicketRequestBody.builder() - .app_id("cli_slkdjalasdkjasd") - .app_secret("dskLLdkasdjlasdKK") - .build()) \ - .build() + # 构造请求对象 + request: ResendAppTicketRequest = ResendAppTicketRequest.builder() \ + .request_body(ResendAppTicketRequestBody.builder() + .app_id("cli_slkdjalasdkjasd") + .app_secret("dskLLdkasdjlasdKK") + .build()) \ + .build() - # 发起请求 - response: ResendAppTicketResponse = await client.auth.v3.app_ticket.aresend(request) + # 发起请求 + response: ResendAppTicketResponse = await client.auth.v3.app_ticket.aresend(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.auth.v3.app_ticket.aresend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.auth.v3.app_ticket.aresend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/authen/v1/create_access_token_sample.py b/samples/api/authen/v1/create_access_token_sample.py index 4714c033d..2fd4262fd 100644 --- a/samples/api/authen/v1/create_access_token_sample.py +++ b/samples/api/authen/v1/create_access_token_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAccessTokenRequest = CreateAccessTokenRequest.builder() \ - .request_body(CreateAccessTokenRequestBody.builder() - .grant_type("authorization_code") - .code("xMSldislSkdK") - .build()) \ - .build() + # 构造请求对象 + request: CreateAccessTokenRequest = CreateAccessTokenRequest.builder() \ + .request_body(CreateAccessTokenRequestBody.builder() + .grant_type("authorization_code") + .code("xMSldislSkdK") + .build()) \ + .build() - # 发起请求 - response: CreateAccessTokenResponse = client.authen.v1.access_token.create(request) + # 发起请求 + response: CreateAccessTokenResponse = client.authen.v1.access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAccessTokenRequest = CreateAccessTokenRequest.builder() \ - .request_body(CreateAccessTokenRequestBody.builder() - .grant_type("authorization_code") - .code("xMSldislSkdK") - .build()) \ - .build() + # 构造请求对象 + request: CreateAccessTokenRequest = CreateAccessTokenRequest.builder() \ + .request_body(CreateAccessTokenRequestBody.builder() + .grant_type("authorization_code") + .code("xMSldislSkdK") + .build()) \ + .build() - # 发起请求 - response: CreateAccessTokenResponse = await client.authen.v1.access_token.acreate(request) + # 发起请求 + response: CreateAccessTokenResponse = await client.authen.v1.access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/authen/v1/create_oidc_access_token_sample.py b/samples/api/authen/v1/create_oidc_access_token_sample.py index 26729a441..3e4caa75c 100644 --- a/samples/api/authen/v1/create_oidc_access_token_sample.py +++ b/samples/api/authen/v1/create_oidc_access_token_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOidcAccessTokenRequest = CreateOidcAccessTokenRequest.builder() \ - .request_body(CreateOidcAccessTokenRequestBody.builder() - .grant_type("authorization_code") - .code("xMSldislSkdK") - .build()) \ - .build() + # 构造请求对象 + request: CreateOidcAccessTokenRequest = CreateOidcAccessTokenRequest.builder() \ + .request_body(CreateOidcAccessTokenRequestBody.builder() + .grant_type("authorization_code") + .code("xMSldislSkdK") + .build()) \ + .build() - # 发起请求 - response: CreateOidcAccessTokenResponse = client.authen.v1.oidc_access_token.create(request) + # 发起请求 + response: CreateOidcAccessTokenResponse = client.authen.v1.oidc_access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.oidc_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.oidc_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOidcAccessTokenRequest = CreateOidcAccessTokenRequest.builder() \ - .request_body(CreateOidcAccessTokenRequestBody.builder() - .grant_type("authorization_code") - .code("xMSldislSkdK") - .build()) \ - .build() + # 构造请求对象 + request: CreateOidcAccessTokenRequest = CreateOidcAccessTokenRequest.builder() \ + .request_body(CreateOidcAccessTokenRequestBody.builder() + .grant_type("authorization_code") + .code("xMSldislSkdK") + .build()) \ + .build() - # 发起请求 - response: CreateOidcAccessTokenResponse = await client.authen.v1.oidc_access_token.acreate(request) + # 发起请求 + response: CreateOidcAccessTokenResponse = await client.authen.v1.oidc_access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.oidc_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.oidc_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/authen/v1/create_oidc_refresh_access_token_sample.py b/samples/api/authen/v1/create_oidc_refresh_access_token_sample.py index da3533bf6..b4d77b2c1 100644 --- a/samples/api/authen/v1/create_oidc_refresh_access_token_sample.py +++ b/samples/api/authen/v1/create_oidc_refresh_access_token_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOidcRefreshAccessTokenRequest = CreateOidcRefreshAccessTokenRequest.builder() \ - .request_body(CreateOidcRefreshAccessTokenRequestBody.builder() - .grant_type("refresh_token") - .refresh_token( - "ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") - .build()) \ - .build() + # 构造请求对象 + request: CreateOidcRefreshAccessTokenRequest = CreateOidcRefreshAccessTokenRequest.builder() \ + .request_body(CreateOidcRefreshAccessTokenRequestBody.builder() + .grant_type("refresh_token") + .refresh_token("ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") + .build()) \ + .build() - # 发起请求 - response: CreateOidcRefreshAccessTokenResponse = client.authen.v1.oidc_refresh_access_token.create(request) + # 发起请求 + response: CreateOidcRefreshAccessTokenResponse = client.authen.v1.oidc_refresh_access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.oidc_refresh_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.oidc_refresh_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOidcRefreshAccessTokenRequest = CreateOidcRefreshAccessTokenRequest.builder() \ - .request_body(CreateOidcRefreshAccessTokenRequestBody.builder() - .grant_type("refresh_token") - .refresh_token( - "ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") - .build()) \ - .build() + # 构造请求对象 + request: CreateOidcRefreshAccessTokenRequest = CreateOidcRefreshAccessTokenRequest.builder() \ + .request_body(CreateOidcRefreshAccessTokenRequestBody.builder() + .grant_type("refresh_token") + .refresh_token("ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") + .build()) \ + .build() - # 发起请求 - response: CreateOidcRefreshAccessTokenResponse = await client.authen.v1.oidc_refresh_access_token.acreate(request) + # 发起请求 + response: CreateOidcRefreshAccessTokenResponse = await client.authen.v1.oidc_refresh_access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.oidc_refresh_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.oidc_refresh_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/authen/v1/create_refresh_access_token_sample.py b/samples/api/authen/v1/create_refresh_access_token_sample.py index 501b21a34..d389e6ea3 100644 --- a/samples/api/authen/v1/create_refresh_access_token_sample.py +++ b/samples/api/authen/v1/create_refresh_access_token_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRefreshAccessTokenRequest = CreateRefreshAccessTokenRequest.builder() \ - .request_body(CreateRefreshAccessTokenRequestBody.builder() - .grant_type("refresh_token") - .refresh_token( - "ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") - .build()) \ - .build() + # 构造请求对象 + request: CreateRefreshAccessTokenRequest = CreateRefreshAccessTokenRequest.builder() \ + .request_body(CreateRefreshAccessTokenRequestBody.builder() + .grant_type("refresh_token") + .refresh_token("ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") + .build()) \ + .build() - # 发起请求 - response: CreateRefreshAccessTokenResponse = client.authen.v1.refresh_access_token.create(request) + # 发起请求 + response: CreateRefreshAccessTokenResponse = client.authen.v1.refresh_access_token.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.refresh_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.refresh_access_token.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRefreshAccessTokenRequest = CreateRefreshAccessTokenRequest.builder() \ - .request_body(CreateRefreshAccessTokenRequestBody.builder() - .grant_type("refresh_token") - .refresh_token( - "ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") - .build()) \ - .build() + # 构造请求对象 + request: CreateRefreshAccessTokenRequest = CreateRefreshAccessTokenRequest.builder() \ + .request_body(CreateRefreshAccessTokenRequestBody.builder() + .grant_type("refresh_token") + .refresh_token("ur-oQ0mMq6MCcueAv0pwx2fQQhxqv__CbLu6G8ySFwafeKww2Def2BJdOkW3.9gCFM.LBQgFri901QaqeuL") + .build()) \ + .build() - # 发起请求 - response: CreateRefreshAccessTokenResponse = await client.authen.v1.refresh_access_token.acreate(request) + # 发起请求 + response: CreateRefreshAccessTokenResponse = await client.authen.v1.refresh_access_token.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.refresh_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.refresh_access_token.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/authen/v1/get_user_info_sample.py b/samples/api/authen/v1/get_user_info_sample.py index 2c0c59526..2bb36bf1e 100644 --- a/samples/api/authen/v1/get_user_info_sample.py +++ b/samples/api/authen/v1/get_user_info_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserInfoRequest = GetUserInfoRequest.builder() \ - .build() + # 构造请求对象 + request: GetUserInfoRequest = GetUserInfoRequest.builder() \ + .build() - # 发起请求 - response: GetUserInfoResponse = client.authen.v1.user_info.get(request) + # 发起请求 + response: GetUserInfoResponse = client.authen.v1.user_info.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.user_info.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.user_info.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserInfoRequest = GetUserInfoRequest.builder() \ - .build() + # 构造请求对象 + request: GetUserInfoRequest = GetUserInfoRequest.builder() \ + .build() - # 发起请求 - response: GetUserInfoResponse = await client.authen.v1.user_info.aget(request) + # 发起请求 + response: GetUserInfoResponse = await client.authen.v1.user_info.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.authen.v1.user_info.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.authen.v1.user_info.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/create_draft_sample.py b/samples/api/baike/v1/create_draft_sample.py index 96715d8cf..f60d02427 100644 --- a/samples/api/baike/v1/create_draft_sample.py +++ b/samples/api/baike/v1/create_draft_sample.py @@ -5,78 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDraftRequest = CreateDraftRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: CreateDraftRequest = CreateDraftRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: CreateDraftResponse = client.baike.v1.draft.create(request) + # 发起请求 + response: CreateDraftResponse = client.baike.v1.draft.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.draft.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.draft.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDraftRequest = CreateDraftRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: CreateDraftRequest = CreateDraftRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: CreateDraftResponse = await client.baike.v1.draft.acreate(request) + # 发起请求 + response: CreateDraftResponse = await client.baike.v1.draft.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.draft.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.draft.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/create_entity_sample.py b/samples/api/baike/v1/create_entity_sample.py index d286b9a3c..fbd7d02dd 100644 --- a/samples/api/baike/v1/create_entity_sample.py +++ b/samples/api/baike/v1/create_entity_sample.py @@ -5,76 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = client.baike.v1.entity.create(request) + # 发起请求 + response: CreateEntityResponse = client.baike.v1.entity.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = await client.baike.v1.entity.acreate(request) + # 发起请求 + response: CreateEntityResponse = await client.baike.v1.entity.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/download_file_sample.py b/samples/api/baike/v1/download_file_sample.py index fbb0231fb..97acf19ba 100644 --- a/samples/api/baike/v1/download_file_sample.py +++ b/samples/api/baike/v1/download_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("boxbcEcmKiD3SGHvgqWTpvdc7jc") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("boxbcEcmKiD3SGHvgqWTpvdc7jc") \ + .build() - # 发起请求 - response: DownloadFileResponse = client.baike.v1.file.download(request) + # 发起请求 + response: DownloadFileResponse = client.baike.v1.file.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("boxbcEcmKiD3SGHvgqWTpvdc7jc") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("boxbcEcmKiD3SGHvgqWTpvdc7jc") \ + .build() - # 发起请求 - response: DownloadFileResponse = await client.baike.v1.file.adownload(request) + # 发起请求 + response: DownloadFileResponse = await client.baike.v1.file.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/extract_entity_sample.py b/samples/api/baike/v1/extract_entity_sample.py index fa4157ca6..4c6bb35f9 100644 --- a/samples/api/baike/v1/extract_entity_sample.py +++ b/samples/api/baike/v1/extract_entity_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ExtractEntityRequest = ExtractEntityRequest.builder() \ - .request_body(ExtractEntityRequestBody.builder() - .text("企业百科是一部高效汇聚企业内各类信息,并可由企业成员参与编辑的在线百科全书") - .build()) \ - .build() + # 构造请求对象 + request: ExtractEntityRequest = ExtractEntityRequest.builder() \ + .request_body(ExtractEntityRequestBody.builder() + .text("企业百科是一部高效汇聚企业内各类信息,并可由企业成员参与编辑的在线百科全书") + .build()) \ + .build() - # 发起请求 - response: ExtractEntityResponse = client.baike.v1.entity.extract(request) + # 发起请求 + response: ExtractEntityResponse = client.baike.v1.entity.extract(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.extract failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.extract failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ExtractEntityRequest = ExtractEntityRequest.builder() \ - .request_body(ExtractEntityRequestBody.builder() - .text("企业百科是一部高效汇聚企业内各类信息,并可由企业成员参与编辑的在线百科全书") - .build()) \ - .build() + # 构造请求对象 + request: ExtractEntityRequest = ExtractEntityRequest.builder() \ + .request_body(ExtractEntityRequestBody.builder() + .text("企业百科是一部高效汇聚企业内各类信息,并可由企业成员参与编辑的在线百科全书") + .build()) \ + .build() - # 发起请求 - response: ExtractEntityResponse = await client.baike.v1.entity.aextract(request) + # 发起请求 + response: ExtractEntityResponse = await client.baike.v1.entity.aextract(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.aextract failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.aextract failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/get_entity_sample.py b/samples/api/baike/v1/get_entity_sample.py index a5fdc057a..dfce33f75 100644 --- a/samples/api/baike/v1/get_entity_sample.py +++ b/samples/api/baike/v1/get_entity_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEntityRequest = GetEntityRequest.builder() \ - .entity_id("enterprise_515879") \ - .provider("星云") \ - .outer_id("12345") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetEntityRequest = GetEntityRequest.builder() \ + .entity_id("enterprise_515879") \ + .provider("星云") \ + .outer_id("12345") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetEntityResponse = client.baike.v1.entity.get(request) + # 发起请求 + response: GetEntityResponse = client.baike.v1.entity.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEntityRequest = GetEntityRequest.builder() \ - .entity_id("enterprise_515879") \ - .provider("星云") \ - .outer_id("12345") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetEntityRequest = GetEntityRequest.builder() \ + .entity_id("enterprise_515879") \ + .provider("星云") \ + .outer_id("12345") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetEntityResponse = await client.baike.v1.entity.aget(request) + # 发起请求 + response: GetEntityResponse = await client.baike.v1.entity.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/highlight_entity_sample.py b/samples/api/baike/v1/highlight_entity_sample.py index 5d8581ce2..9699d50a1 100644 --- a/samples/api/baike/v1/highlight_entity_sample.py +++ b/samples/api/baike/v1/highlight_entity_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: HighlightEntityRequest = HighlightEntityRequest.builder() \ - .request_body(HighlightEntityRequestBody.builder() - .text("企业百科是飞书提供的一款知识管理工具") - .build()) \ - .build() + # 构造请求对象 + request: HighlightEntityRequest = HighlightEntityRequest.builder() \ + .request_body(HighlightEntityRequestBody.builder() + .text("企业百科是飞书提供的一款知识管理工具") + .build()) \ + .build() - # 发起请求 - response: HighlightEntityResponse = client.baike.v1.entity.highlight(request) + # 发起请求 + response: HighlightEntityResponse = client.baike.v1.entity.highlight(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.highlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.highlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: HighlightEntityRequest = HighlightEntityRequest.builder() \ - .request_body(HighlightEntityRequestBody.builder() - .text("企业百科是飞书提供的一款知识管理工具") - .build()) \ - .build() + # 构造请求对象 + request: HighlightEntityRequest = HighlightEntityRequest.builder() \ + .request_body(HighlightEntityRequestBody.builder() + .text("企业百科是飞书提供的一款知识管理工具") + .build()) \ + .build() - # 发起请求 - response: HighlightEntityResponse = await client.baike.v1.entity.ahighlight(request) + # 发起请求 + response: HighlightEntityResponse = await client.baike.v1.entity.ahighlight(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.ahighlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.ahighlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/list_classification_sample.py b/samples/api/baike/v1/list_classification_sample.py index ebc9c1e8d..4b787381a 100644 --- a/samples/api/baike/v1/list_classification_sample.py +++ b/samples/api/baike/v1/list_classification_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListClassificationRequest = ListClassificationRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .build() + # 构造请求对象 + request: ListClassificationRequest = ListClassificationRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .build() - # 发起请求 - response: ListClassificationResponse = client.baike.v1.classification.list(request) + # 发起请求 + response: ListClassificationResponse = client.baike.v1.classification.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.classification.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.classification.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListClassificationRequest = ListClassificationRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .build() + # 构造请求对象 + request: ListClassificationRequest = ListClassificationRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .build() - # 发起请求 - response: ListClassificationResponse = await client.baike.v1.classification.alist(request) + # 发起请求 + response: ListClassificationResponse = await client.baike.v1.classification.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.classification.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.classification.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/list_entity_sample.py b/samples/api/baike/v1/list_entity_sample.py index 0e9ce51d3..7653f3d4b 100644 --- a/samples/api/baike/v1/list_entity_sample.py +++ b/samples/api/baike/v1/list_entity_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEntityRequest = ListEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .provider("星云") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEntityRequest = ListEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .provider("星云") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEntityResponse = client.baike.v1.entity.list(request) + # 发起请求 + response: ListEntityResponse = client.baike.v1.entity.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEntityRequest = ListEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .provider("星云") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEntityRequest = ListEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .provider("星云") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEntityResponse = await client.baike.v1.entity.alist(request) + # 发起请求 + response: ListEntityResponse = await client.baike.v1.entity.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/match_entity_sample.py b/samples/api/baike/v1/match_entity_sample.py index 9e58ac80b..ec9a49081 100644 --- a/samples/api/baike/v1/match_entity_sample.py +++ b/samples/api/baike/v1/match_entity_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchEntityRequest = MatchEntityRequest.builder() \ - .request_body(MatchEntityRequestBody.builder() - .word("企业百科") - .build()) \ - .build() + # 构造请求对象 + request: MatchEntityRequest = MatchEntityRequest.builder() \ + .request_body(MatchEntityRequestBody.builder() + .word("企业百科") + .build()) \ + .build() - # 发起请求 - response: MatchEntityResponse = client.baike.v1.entity.match(request) + # 发起请求 + response: MatchEntityResponse = client.baike.v1.entity.match(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchEntityRequest = MatchEntityRequest.builder() \ - .request_body(MatchEntityRequestBody.builder() - .word("企业百科") - .build()) \ - .build() + # 构造请求对象 + request: MatchEntityRequest = MatchEntityRequest.builder() \ + .request_body(MatchEntityRequestBody.builder() + .word("企业百科") + .build()) \ + .build() - # 发起请求 - response: MatchEntityResponse = await client.baike.v1.entity.amatch(request) + # 发起请求 + response: MatchEntityResponse = await client.baike.v1.entity.amatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/search_entity_sample.py b/samples/api/baike/v1/search_entity_sample.py index da2155cc7..a140b128e 100644 --- a/samples/api/baike/v1/search_entity_sample.py +++ b/samples/api/baike/v1/search_entity_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEntityRequest = SearchEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .user_id_type("user_id") \ - .request_body(SearchEntityRequestBody.builder() - .query("百科") - .classification_filter(ClassificationFilter.builder().build()) - .sources([]) - .creators([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEntityRequest = SearchEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .user_id_type("user_id") \ + .request_body(SearchEntityRequestBody.builder() + .query("百科") + .classification_filter(ClassificationFilter.builder().build()) + .sources([]) + .creators([]) + .build()) \ + .build() - # 发起请求 - response: SearchEntityResponse = client.baike.v1.entity.search(request) + # 发起请求 + response: SearchEntityResponse = client.baike.v1.entity.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEntityRequest = SearchEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .user_id_type("user_id") \ - .request_body(SearchEntityRequestBody.builder() - .query("百科") - .classification_filter(ClassificationFilter.builder().build()) - .sources([]) - .creators([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEntityRequest = SearchEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .user_id_type("user_id") \ + .request_body(SearchEntityRequestBody.builder() + .query("百科") + .classification_filter(ClassificationFilter.builder().build()) + .sources([]) + .creators([]) + .build()) \ + .build() - # 发起请求 - response: SearchEntityResponse = await client.baike.v1.entity.asearch(request) + # 发起请求 + response: SearchEntityResponse = await client.baike.v1.entity.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/update_draft_sample.py b/samples/api/baike/v1/update_draft_sample.py index 692eab633..12b5eaf02 100644 --- a/samples/api/baike/v1/update_draft_sample.py +++ b/samples/api/baike/v1/update_draft_sample.py @@ -5,78 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDraftRequest = UpdateDraftRequest.builder() \ - .draft_id("5347") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateDraftRequest = UpdateDraftRequest.builder() \ + .draft_id("5347") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: UpdateDraftResponse = client.baike.v1.draft.update(request) + # 发起请求 + response: UpdateDraftResponse = client.baike.v1.draft.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.draft.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.draft.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDraftRequest = UpdateDraftRequest.builder() \ - .draft_id("5347") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateDraftRequest = UpdateDraftRequest.builder() \ + .draft_id("5347") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: UpdateDraftResponse = await client.baike.v1.draft.aupdate(request) + # 发起请求 + response: UpdateDraftResponse = await client.baike.v1.draft.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.draft.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.draft.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/update_entity_sample.py b/samples/api/baike/v1/update_entity_sample.py index f6a1ef466..69bdfde52 100644 --- a/samples/api/baike/v1/update_entity_sample.py +++ b/samples/api/baike/v1/update_entity_sample.py @@ -5,78 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .entity_id("enterprise_40217521") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .entity_id("enterprise_40217521") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = client.baike.v1.entity.update(request) + # 发起请求 + response: UpdateEntityResponse = client.baike.v1.entity.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .entity_id("enterprise_40217521") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .entity_id("enterprise_40217521") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = await client.baike.v1.entity.aupdate(request) + # 发起请求 + response: UpdateEntityResponse = await client.baike.v1.entity.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/baike/v1/upload_file_sample.py b/samples/api/baike/v1/upload_file_sample.py index 954672fad..e2bc86864 100644 --- a/samples/api/baike/v1/upload_file_sample.py +++ b/samples/api/baike/v1/upload_file_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .request_body(File.builder() - .name("示例图片.png") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .request_body(File.builder() + .name("示例图片.png") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = client.baike.v1.file.upload(request) + # 发起请求 + response: UploadFileResponse = client.baike.v1.file.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .request_body(File.builder() - .name("示例图片.png") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .request_body(File.builder() + .name("示例图片.png") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = await client.baike.v1.file.aupload(request) + # 发起请求 + response: UploadFileResponse = await client.baike.v1.file.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.baike.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.baike.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_create_app_role_member_sample.py b/samples/api/bitable/v1/batch_create_app_role_member_sample.py index ce56ab550..87d19cb0b 100644 --- a/samples/api/bitable/v1/batch_create_app_role_member_sample.py +++ b/samples/api/bitable/v1/batch_create_app_role_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppRoleMemberRequest = BatchCreateAppRoleMemberRequest.builder() \ - .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ - .role_id("rolNGhPqks") \ - .request_body(BatchCreateAppRoleMemberRequestBody.builder() - .member_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppRoleMemberRequest = BatchCreateAppRoleMemberRequest.builder() \ + .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ + .role_id("rolNGhPqks") \ + .request_body(BatchCreateAppRoleMemberRequestBody.builder() + .member_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppRoleMemberResponse = client.bitable.v1.app_role_member.batch_create(request) + # 发起请求 + response: BatchCreateAppRoleMemberResponse = client.bitable.v1.app_role_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppRoleMemberRequest = BatchCreateAppRoleMemberRequest.builder() \ - .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ - .role_id("rolNGhPqks") \ - .request_body(BatchCreateAppRoleMemberRequestBody.builder() - .member_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppRoleMemberRequest = BatchCreateAppRoleMemberRequest.builder() \ + .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ + .role_id("rolNGhPqks") \ + .request_body(BatchCreateAppRoleMemberRequestBody.builder() + .member_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppRoleMemberResponse = await client.bitable.v1.app_role_member.abatch_create(request) + # 发起请求 + response: BatchCreateAppRoleMemberResponse = await client.bitable.v1.app_role_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_create_app_table_record_sample.py b/samples/api/bitable/v1/batch_create_app_table_record_sample.py index b8e20572f..e921bc33f 100644 --- a/samples/api/bitable/v1/batch_create_app_table_record_sample.py +++ b/samples/api/bitable/v1/batch_create_app_table_record_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppTableRecordRequest = BatchCreateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .user_id_type("user_id") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(BatchCreateAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppTableRecordRequest = BatchCreateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .user_id_type("user_id") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(BatchCreateAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppTableRecordResponse = client.bitable.v1.app_table_record.batch_create(request) + # 发起请求 + response: BatchCreateAppTableRecordResponse = client.bitable.v1.app_table_record.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppTableRecordRequest = BatchCreateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .user_id_type("user_id") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(BatchCreateAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppTableRecordRequest = BatchCreateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .user_id_type("user_id") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(BatchCreateAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_create(request) + # 发起请求 + response: BatchCreateAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_create_app_table_sample.py b/samples/api/bitable/v1/batch_create_app_table_sample.py index 796ab791d..759d34400 100644 --- a/samples/api/bitable/v1/batch_create_app_table_sample.py +++ b/samples/api/bitable/v1/batch_create_app_table_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppTableRequest = BatchCreateAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .user_id_type("user_id") \ - .request_body(BatchCreateAppTableRequestBody.builder() - .tables([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppTableRequest = BatchCreateAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .user_id_type("user_id") \ + .request_body(BatchCreateAppTableRequestBody.builder() + .tables([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppTableResponse = client.bitable.v1.app_table.batch_create(request) + # 发起请求 + response: BatchCreateAppTableResponse = client.bitable.v1.app_table.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateAppTableRequest = BatchCreateAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .user_id_type("user_id") \ - .request_body(BatchCreateAppTableRequestBody.builder() - .tables([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateAppTableRequest = BatchCreateAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .user_id_type("user_id") \ + .request_body(BatchCreateAppTableRequestBody.builder() + .tables([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateAppTableResponse = await client.bitable.v1.app_table.abatch_create(request) + # 发起请求 + response: BatchCreateAppTableResponse = await client.bitable.v1.app_table.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_delete_app_role_member_sample.py b/samples/api/bitable/v1/batch_delete_app_role_member_sample.py index e781a45c9..5740ef89e 100644 --- a/samples/api/bitable/v1/batch_delete_app_role_member_sample.py +++ b/samples/api/bitable/v1/batch_delete_app_role_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppRoleMemberRequest = BatchDeleteAppRoleMemberRequest.builder() \ - .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ - .role_id("rolNGhPqks") \ - .request_body(BatchDeleteAppRoleMemberRequestBody.builder() - .member_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppRoleMemberRequest = BatchDeleteAppRoleMemberRequest.builder() \ + .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ + .role_id("rolNGhPqks") \ + .request_body(BatchDeleteAppRoleMemberRequestBody.builder() + .member_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppRoleMemberResponse = client.bitable.v1.app_role_member.batch_delete(request) + # 发起请求 + response: BatchDeleteAppRoleMemberResponse = client.bitable.v1.app_role_member.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppRoleMemberRequest = BatchDeleteAppRoleMemberRequest.builder() \ - .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ - .role_id("rolNGhPqks") \ - .request_body(BatchDeleteAppRoleMemberRequestBody.builder() - .member_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppRoleMemberRequest = BatchDeleteAppRoleMemberRequest.builder() \ + .app_token("bascnnKKvcoUblgmmhZkYqabcef") \ + .role_id("rolNGhPqks") \ + .request_body(BatchDeleteAppRoleMemberRequestBody.builder() + .member_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppRoleMemberResponse = await client.bitable.v1.app_role_member.abatch_delete(request) + # 发起请求 + response: BatchDeleteAppRoleMemberResponse = await client.bitable.v1.app_role_member.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_delete_app_table_record_sample.py b/samples/api/bitable/v1/batch_delete_app_table_record_sample.py index 142415d63..e8e46b99c 100644 --- a/samples/api/bitable/v1/batch_delete_app_table_record_sample.py +++ b/samples/api/bitable/v1/batch_delete_app_table_record_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppTableRecordRequest = BatchDeleteAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .request_body(BatchDeleteAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppTableRecordRequest = BatchDeleteAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .request_body(BatchDeleteAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppTableRecordResponse = client.bitable.v1.app_table_record.batch_delete(request) + # 发起请求 + response: BatchDeleteAppTableRecordResponse = client.bitable.v1.app_table_record.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppTableRecordRequest = BatchDeleteAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .request_body(BatchDeleteAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppTableRecordRequest = BatchDeleteAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .request_body(BatchDeleteAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_delete(request) + # 发起请求 + response: BatchDeleteAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_delete_app_table_sample.py b/samples/api/bitable/v1/batch_delete_app_table_sample.py index 84db3fbe9..f147bc1de 100644 --- a/samples/api/bitable/v1/batch_delete_app_table_sample.py +++ b/samples/api/bitable/v1/batch_delete_app_table_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppTableRequest = BatchDeleteAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(BatchDeleteAppTableRequestBody.builder() - .table_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppTableRequest = BatchDeleteAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(BatchDeleteAppTableRequestBody.builder() + .table_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppTableResponse = client.bitable.v1.app_table.batch_delete(request) + # 发起请求 + response: BatchDeleteAppTableResponse = client.bitable.v1.app_table.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteAppTableRequest = BatchDeleteAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(BatchDeleteAppTableRequestBody.builder() - .table_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteAppTableRequest = BatchDeleteAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(BatchDeleteAppTableRequestBody.builder() + .table_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteAppTableResponse = await client.bitable.v1.app_table.abatch_delete(request) + # 发起请求 + response: BatchDeleteAppTableResponse = await client.bitable.v1.app_table.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_get_app_table_record_sample.py b/samples/api/bitable/v1/batch_get_app_table_record_sample.py index 533e79e93..25a1dfc18 100644 --- a/samples/api/bitable/v1/batch_get_app_table_record_sample.py +++ b/samples/api/bitable/v1/batch_get_app_table_record_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetAppTableRecordRequest = BatchGetAppTableRecordRequest.builder() \ - .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ - .table_id("tbl0xe5g8PP3U3cS") \ - .request_body(BatchGetAppTableRecordRequestBody.builder() - .record_ids([]) - .user_id_type("open_id") - .with_shared_url(bool) - .automatic_fields(bool) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetAppTableRecordRequest = BatchGetAppTableRecordRequest.builder() \ + .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ + .table_id("tbl0xe5g8PP3U3cS") \ + .request_body(BatchGetAppTableRecordRequestBody.builder() + .record_ids([]) + .user_id_type("open_id") + .with_shared_url(bool) + .automatic_fields(bool) + .build()) \ + .build() - # 发起请求 - response: BatchGetAppTableRecordResponse = client.bitable.v1.app_table_record.batch_get(request) + # 发起请求 + response: BatchGetAppTableRecordResponse = client.bitable.v1.app_table_record.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetAppTableRecordRequest = BatchGetAppTableRecordRequest.builder() \ - .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ - .table_id("tbl0xe5g8PP3U3cS") \ - .request_body(BatchGetAppTableRecordRequestBody.builder() - .record_ids([]) - .user_id_type("open_id") - .with_shared_url(bool) - .automatic_fields(bool) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetAppTableRecordRequest = BatchGetAppTableRecordRequest.builder() \ + .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ + .table_id("tbl0xe5g8PP3U3cS") \ + .request_body(BatchGetAppTableRecordRequestBody.builder() + .record_ids([]) + .user_id_type("open_id") + .with_shared_url(bool) + .automatic_fields(bool) + .build()) \ + .build() - # 发起请求 - response: BatchGetAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_get(request) + # 发起请求 + response: BatchGetAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/batch_update_app_table_record_sample.py b/samples/api/bitable/v1/batch_update_app_table_record_sample.py index 67cc43a3a..1044e404e 100644 --- a/samples/api/bitable/v1/batch_update_app_table_record_sample.py +++ b/samples/api/bitable/v1/batch_update_app_table_record_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateAppTableRecordRequest = BatchUpdateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .user_id_type("user_id") \ - .request_body(BatchUpdateAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateAppTableRecordRequest = BatchUpdateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .user_id_type("user_id") \ + .request_body(BatchUpdateAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateAppTableRecordResponse = client.bitable.v1.app_table_record.batch_update(request) + # 发起请求 + response: BatchUpdateAppTableRecordResponse = client.bitable.v1.app_table_record.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateAppTableRecordRequest = BatchUpdateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .user_id_type("user_id") \ - .request_body(BatchUpdateAppTableRecordRequestBody.builder() - .records([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateAppTableRecordRequest = BatchUpdateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .user_id_type("user_id") \ + .request_body(BatchUpdateAppTableRecordRequestBody.builder() + .records([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_update(request) + # 发起请求 + response: BatchUpdateAppTableRecordResponse = await client.bitable.v1.app_table_record.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/copy_app_dashboard_sample.py b/samples/api/bitable/v1/copy_app_dashboard_sample.py index 2811c1985..59ea521a8 100644 --- a/samples/api/bitable/v1/copy_app_dashboard_sample.py +++ b/samples/api/bitable/v1/copy_app_dashboard_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyAppDashboardRequest = CopyAppDashboardRequest.builder() \ - .app_token("basbcldP5xZeskcHDFZQfeToydb") \ - .block_id("blkEsvEEaNllY2UV") \ - .request_body(CopyAppDashboardRequestBody.builder() - .name("Dashboard") - .build()) \ - .build() + # 构造请求对象 + request: CopyAppDashboardRequest = CopyAppDashboardRequest.builder() \ + .app_token("basbcldP5xZeskcHDFZQfeToydb") \ + .block_id("blkEsvEEaNllY2UV") \ + .request_body(CopyAppDashboardRequestBody.builder() + .name("Dashboard") + .build()) \ + .build() - # 发起请求 - response: CopyAppDashboardResponse = client.bitable.v1.app_dashboard.copy(request) + # 发起请求 + response: CopyAppDashboardResponse = client.bitable.v1.app_dashboard.copy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_dashboard.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_dashboard.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyAppDashboardRequest = CopyAppDashboardRequest.builder() \ - .app_token("basbcldP5xZeskcHDFZQfeToydb") \ - .block_id("blkEsvEEaNllY2UV") \ - .request_body(CopyAppDashboardRequestBody.builder() - .name("Dashboard") - .build()) \ - .build() + # 构造请求对象 + request: CopyAppDashboardRequest = CopyAppDashboardRequest.builder() \ + .app_token("basbcldP5xZeskcHDFZQfeToydb") \ + .block_id("blkEsvEEaNllY2UV") \ + .request_body(CopyAppDashboardRequestBody.builder() + .name("Dashboard") + .build()) \ + .build() - # 发起请求 - response: CopyAppDashboardResponse = await client.bitable.v1.app_dashboard.acopy(request) + # 发起请求 + response: CopyAppDashboardResponse = await client.bitable.v1.app_dashboard.acopy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_dashboard.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_dashboard.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/copy_app_sample.py b/samples/api/bitable/v1/copy_app_sample.py index 91c068eb8..ca844ef6a 100644 --- a/samples/api/bitable/v1/copy_app_sample.py +++ b/samples/api/bitable/v1/copy_app_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyAppRequest = CopyAppRequest.builder() \ - .app_token("S404b*****e9PQsYDWYcNryFn0g") \ - .request_body(CopyAppRequestBody.builder() - .name("一篇新的多维表格") - .folder_token("fldbco*****CIMltVc") - .without_content(False) - .time_zone("Asia/Shanghai") - .build()) \ - .build() + # 构造请求对象 + request: CopyAppRequest = CopyAppRequest.builder() \ + .app_token("S404b*****e9PQsYDWYcNryFn0g") \ + .request_body(CopyAppRequestBody.builder() + .name("一篇新的多维表格") + .folder_token("fldbco*****CIMltVc") + .without_content(False) + .time_zone("Asia/Shanghai") + .build()) \ + .build() - # 发起请求 - response: CopyAppResponse = client.bitable.v1.app.copy(request) + # 发起请求 + response: CopyAppResponse = client.bitable.v1.app.copy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyAppRequest = CopyAppRequest.builder() \ - .app_token("S404b*****e9PQsYDWYcNryFn0g") \ - .request_body(CopyAppRequestBody.builder() - .name("一篇新的多维表格") - .folder_token("fldbco*****CIMltVc") - .without_content(False) - .time_zone("Asia/Shanghai") - .build()) \ - .build() + # 构造请求对象 + request: CopyAppRequest = CopyAppRequest.builder() \ + .app_token("S404b*****e9PQsYDWYcNryFn0g") \ + .request_body(CopyAppRequestBody.builder() + .name("一篇新的多维表格") + .folder_token("fldbco*****CIMltVc") + .without_content(False) + .time_zone("Asia/Shanghai") + .build()) \ + .build() - # 发起请求 - response: CopyAppResponse = await client.bitable.v1.app.acopy(request) + # 发起请求 + response: CopyAppResponse = await client.bitable.v1.app.acopy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_role_member_sample.py b/samples/api/bitable/v1/create_app_role_member_sample.py index 96e84db77..9af172acb 100644 --- a/samples/api/bitable/v1/create_app_role_member_sample.py +++ b/samples/api/bitable/v1/create_app_role_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRoleMemberRequest = CreateAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .member_id_type("open_id") \ - .request_body(AppRoleMember.builder() - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRoleMemberRequest = CreateAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .member_id_type("open_id") \ + .request_body(AppRoleMember.builder() + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .build()) \ + .build() - # 发起请求 - response: CreateAppRoleMemberResponse = client.bitable.v1.app_role_member.create(request) + # 发起请求 + response: CreateAppRoleMemberResponse = client.bitable.v1.app_role_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRoleMemberRequest = CreateAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .member_id_type("open_id") \ - .request_body(AppRoleMember.builder() - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRoleMemberRequest = CreateAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .member_id_type("open_id") \ + .request_body(AppRoleMember.builder() + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .build()) \ + .build() - # 发起请求 - response: CreateAppRoleMemberResponse = await client.bitable.v1.app_role_member.acreate(request) + # 发起请求 + response: CreateAppRoleMemberResponse = await client.bitable.v1.app_role_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_role_sample.py b/samples/api/bitable/v1/create_app_role_sample.py index 9e98db7f1..90159fd1f 100644 --- a/samples/api/bitable/v1/create_app_role_sample.py +++ b/samples/api/bitable/v1/create_app_role_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRoleRequest = CreateAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(AppRole.builder() - .role_name("自定义权限1") - .table_roles([]) - .block_roles([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRoleRequest = CreateAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(AppRole.builder() + .role_name("自定义权限1") + .table_roles([]) + .block_roles([]) + .build()) \ + .build() - # 发起请求 - response: CreateAppRoleResponse = client.bitable.v1.app_role.create(request) + # 发起请求 + response: CreateAppRoleResponse = client.bitable.v1.app_role.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRoleRequest = CreateAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(AppRole.builder() - .role_name("自定义权限1") - .table_roles([]) - .block_roles([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRoleRequest = CreateAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(AppRole.builder() + .role_name("自定义权限1") + .table_roles([]) + .block_roles([]) + .build()) \ + .build() - # 发起请求 - response: CreateAppRoleResponse = await client.bitable.v1.app_role.acreate(request) + # 发起请求 + response: CreateAppRoleResponse = await client.bitable.v1.app_role.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_sample.py b/samples/api/bitable/v1/create_app_sample.py index b27417e74..0d58d14c5 100644 --- a/samples/api/bitable/v1/create_app_sample.py +++ b/samples/api/bitable/v1/create_app_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRequest = CreateAppRequest.builder() \ - .request_body(ReqApp.builder() - .name("一篇新的多维表格") - .folder_token("fldbcoh8O99CIMltVc") - .time_zone("Asia/Macau") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRequest = CreateAppRequest.builder() \ + .request_body(ReqApp.builder() + .name("一篇新的多维表格") + .folder_token("fldbcoh8O99CIMltVc") + .time_zone("Asia/Macau") + .build()) \ + .build() - # 发起请求 - response: CreateAppResponse = client.bitable.v1.app.create(request) + # 发起请求 + response: CreateAppResponse = client.bitable.v1.app.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRequest = CreateAppRequest.builder() \ - .request_body(ReqApp.builder() - .name("一篇新的多维表格") - .folder_token("fldbcoh8O99CIMltVc") - .time_zone("Asia/Macau") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRequest = CreateAppRequest.builder() \ + .request_body(ReqApp.builder() + .name("一篇新的多维表格") + .folder_token("fldbcoh8O99CIMltVc") + .time_zone("Asia/Macau") + .build()) \ + .build() - # 发起请求 - response: CreateAppResponse = await client.bitable.v1.app.acreate(request) + # 发起请求 + response: CreateAppResponse = await client.bitable.v1.app.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_table_field_sample.py b/samples/api/bitable/v1/create_app_table_field_sample.py index c714c7419..415f5f332 100644 --- a/samples/api/bitable/v1/create_app_table_field_sample.py +++ b/samples/api/bitable/v1/create_app_table_field_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableFieldRequest = CreateAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(AppTableField.builder() - .field_name("字段名称") - .type(int) - .property(AppTableFieldProperty.builder().build()) - .description(AppTableFieldDescription.builder().build()) - .ui_type("Progress") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableFieldRequest = CreateAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(AppTableField.builder() + .field_name("字段名称") + .type(int) + .property(AppTableFieldProperty.builder().build()) + .description(AppTableFieldDescription.builder().build()) + .ui_type("Progress") + .build()) \ + .build() - # 发起请求 - response: CreateAppTableFieldResponse = client.bitable.v1.app_table_field.create(request) + # 发起请求 + response: CreateAppTableFieldResponse = client.bitable.v1.app_table_field.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableFieldRequest = CreateAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(AppTableField.builder() - .field_name("字段名称") - .type(int) - .property(AppTableFieldProperty.builder().build()) - .description(AppTableFieldDescription.builder().build()) - .ui_type("Progress") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableFieldRequest = CreateAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(AppTableField.builder() + .field_name("字段名称") + .type(int) + .property(AppTableFieldProperty.builder().build()) + .description(AppTableFieldDescription.builder().build()) + .ui_type("Progress") + .build()) \ + .build() - # 发起请求 - response: CreateAppTableFieldResponse = await client.bitable.v1.app_table_field.acreate(request) + # 发起请求 + response: CreateAppTableFieldResponse = await client.bitable.v1.app_table_field.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_table_record_sample.py b/samples/api/bitable/v1/create_app_table_record_sample.py index 426896c79..7be5c11a1 100644 --- a/samples/api/bitable/v1/create_app_table_record_sample.py +++ b/samples/api/bitable/v1/create_app_table_record_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableRecordRequest = CreateAppTableRecordRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .table_id("tblUa9vcYjWQYJCj") \ - .user_id_type("user_id") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(AppTableRecord.builder() - .fields({}) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableRecordRequest = CreateAppTableRecordRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .table_id("tblUa9vcYjWQYJCj") \ + .user_id_type("user_id") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(AppTableRecord.builder() + .fields({}) + .build()) \ + .build() - # 发起请求 - response: CreateAppTableRecordResponse = client.bitable.v1.app_table_record.create(request) + # 发起请求 + response: CreateAppTableRecordResponse = client.bitable.v1.app_table_record.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableRecordRequest = CreateAppTableRecordRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .table_id("tblUa9vcYjWQYJCj") \ - .user_id_type("user_id") \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(AppTableRecord.builder() - .fields({}) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableRecordRequest = CreateAppTableRecordRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .table_id("tblUa9vcYjWQYJCj") \ + .user_id_type("user_id") \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(AppTableRecord.builder() + .fields({}) + .build()) \ + .build() - # 发起请求 - response: CreateAppTableRecordResponse = await client.bitable.v1.app_table_record.acreate(request) + # 发起请求 + response: CreateAppTableRecordResponse = await client.bitable.v1.app_table_record.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_table_sample.py b/samples/api/bitable/v1/create_app_table_sample.py index 70691dc26..602b3423a 100644 --- a/samples/api/bitable/v1/create_app_table_sample.py +++ b/samples/api/bitable/v1/create_app_table_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableRequest = CreateAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(CreateAppTableRequestBody.builder() - .table(ReqTable.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableRequest = CreateAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(CreateAppTableRequestBody.builder() + .table(ReqTable.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateAppTableResponse = client.bitable.v1.app_table.create(request) + # 发起请求 + response: CreateAppTableResponse = client.bitable.v1.app_table.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableRequest = CreateAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(CreateAppTableRequestBody.builder() - .table(ReqTable.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableRequest = CreateAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(CreateAppTableRequestBody.builder() + .table(ReqTable.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateAppTableResponse = await client.bitable.v1.app_table.acreate(request) + # 发起请求 + response: CreateAppTableResponse = await client.bitable.v1.app_table.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/create_app_table_view_sample.py b/samples/api/bitable/v1/create_app_table_view_sample.py index 245c76040..da9893a98 100644 --- a/samples/api/bitable/v1/create_app_table_view_sample.py +++ b/samples/api/bitable/v1/create_app_table_view_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableViewRequest = CreateAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .request_body(ReqView.builder() - .view_name("表格视图1") - .view_type("grid") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableViewRequest = CreateAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .request_body(ReqView.builder() + .view_name("表格视图1") + .view_type("grid") + .build()) \ + .build() - # 发起请求 - response: CreateAppTableViewResponse = client.bitable.v1.app_table_view.create(request) + # 发起请求 + response: CreateAppTableViewResponse = client.bitable.v1.app_table_view.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppTableViewRequest = CreateAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .request_body(ReqView.builder() - .view_name("表格视图1") - .view_type("grid") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppTableViewRequest = CreateAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .request_body(ReqView.builder() + .view_name("表格视图1") + .view_type("grid") + .build()) \ + .build() - # 发起请求 - response: CreateAppTableViewResponse = await client.bitable.v1.app_table_view.acreate(request) + # 发起请求 + response: CreateAppTableViewResponse = await client.bitable.v1.app_table_view.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_role_member_sample.py b/samples/api/bitable/v1/delete_app_role_member_sample.py index 1fb21dfaf..23ab17390 100644 --- a/samples/api/bitable/v1/delete_app_role_member_sample.py +++ b/samples/api/bitable/v1/delete_app_role_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppRoleMemberRequest = DeleteAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad53uew2") \ - .member_id_type("open_id") \ - .build() + # 构造请求对象 + request: DeleteAppRoleMemberRequest = DeleteAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad53uew2") \ + .member_id_type("open_id") \ + .build() - # 发起请求 - response: DeleteAppRoleMemberResponse = client.bitable.v1.app_role_member.delete(request) + # 发起请求 + response: DeleteAppRoleMemberResponse = client.bitable.v1.app_role_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppRoleMemberRequest = DeleteAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad53uew2") \ - .member_id_type("open_id") \ - .build() + # 构造请求对象 + request: DeleteAppRoleMemberRequest = DeleteAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad53uew2") \ + .member_id_type("open_id") \ + .build() - # 发起请求 - response: DeleteAppRoleMemberResponse = await client.bitable.v1.app_role_member.adelete(request) + # 发起请求 + response: DeleteAppRoleMemberResponse = await client.bitable.v1.app_role_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_role_sample.py b/samples/api/bitable/v1/delete_app_role_sample.py index 5ccedca29..1de954171 100644 --- a/samples/api/bitable/v1/delete_app_role_sample.py +++ b/samples/api/bitable/v1/delete_app_role_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppRoleRequest = DeleteAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .build() + # 构造请求对象 + request: DeleteAppRoleRequest = DeleteAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .build() - # 发起请求 - response: DeleteAppRoleResponse = client.bitable.v1.app_role.delete(request) + # 发起请求 + response: DeleteAppRoleResponse = client.bitable.v1.app_role.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppRoleRequest = DeleteAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .build() + # 构造请求对象 + request: DeleteAppRoleRequest = DeleteAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .build() - # 发起请求 - response: DeleteAppRoleResponse = await client.bitable.v1.app_role.adelete(request) + # 发起请求 + response: DeleteAppRoleResponse = await client.bitable.v1.app_role.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_table_field_sample.py b/samples/api/bitable/v1/delete_app_table_field_sample.py index 8c96f418a..209df5b6c 100644 --- a/samples/api/bitable/v1/delete_app_table_field_sample.py +++ b/samples/api/bitable/v1/delete_app_table_field_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableFieldRequest = DeleteAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .field_id("fldPTb0U2y") \ - .build() + # 构造请求对象 + request: DeleteAppTableFieldRequest = DeleteAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .field_id("fldPTb0U2y") \ + .build() - # 发起请求 - response: DeleteAppTableFieldResponse = client.bitable.v1.app_table_field.delete(request) + # 发起请求 + response: DeleteAppTableFieldResponse = client.bitable.v1.app_table_field.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableFieldRequest = DeleteAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .field_id("fldPTb0U2y") \ - .build() + # 构造请求对象 + request: DeleteAppTableFieldRequest = DeleteAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .field_id("fldPTb0U2y") \ + .build() - # 发起请求 - response: DeleteAppTableFieldResponse = await client.bitable.v1.app_table_field.adelete(request) + # 发起请求 + response: DeleteAppTableFieldResponse = await client.bitable.v1.app_table_field.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_table_record_sample.py b/samples/api/bitable/v1/delete_app_table_record_sample.py index 70d1b0a6b..6ad1b7908 100644 --- a/samples/api/bitable/v1/delete_app_table_record_sample.py +++ b/samples/api/bitable/v1/delete_app_table_record_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableRecordRequest = DeleteAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .record_id("recpCsf4ME") \ - .build() + # 构造请求对象 + request: DeleteAppTableRecordRequest = DeleteAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .record_id("recpCsf4ME") \ + .build() - # 发起请求 - response: DeleteAppTableRecordResponse = client.bitable.v1.app_table_record.delete(request) + # 发起请求 + response: DeleteAppTableRecordResponse = client.bitable.v1.app_table_record.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableRecordRequest = DeleteAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .record_id("recpCsf4ME") \ - .build() + # 构造请求对象 + request: DeleteAppTableRecordRequest = DeleteAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .record_id("recpCsf4ME") \ + .build() - # 发起请求 - response: DeleteAppTableRecordResponse = await client.bitable.v1.app_table_record.adelete(request) + # 发起请求 + response: DeleteAppTableRecordResponse = await client.bitable.v1.app_table_record.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_table_sample.py b/samples/api/bitable/v1/delete_app_table_sample.py index 74b3fcb1a..26d11f1b6 100644 --- a/samples/api/bitable/v1/delete_app_table_sample.py +++ b/samples/api/bitable/v1/delete_app_table_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableRequest = DeleteAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .build() + # 构造请求对象 + request: DeleteAppTableRequest = DeleteAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .build() - # 发起请求 - response: DeleteAppTableResponse = client.bitable.v1.app_table.delete(request) + # 发起请求 + response: DeleteAppTableResponse = client.bitable.v1.app_table.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableRequest = DeleteAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .build() + # 构造请求对象 + request: DeleteAppTableRequest = DeleteAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .build() - # 发起请求 - response: DeleteAppTableResponse = await client.bitable.v1.app_table.adelete(request) + # 发起请求 + response: DeleteAppTableResponse = await client.bitable.v1.app_table.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/delete_app_table_view_sample.py b/samples/api/bitable/v1/delete_app_table_view_sample.py index c3417f4ad..5748338ff 100644 --- a/samples/api/bitable/v1/delete_app_table_view_sample.py +++ b/samples/api/bitable/v1/delete_app_table_view_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableViewRequest = DeleteAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .build() + # 构造请求对象 + request: DeleteAppTableViewRequest = DeleteAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .build() - # 发起请求 - response: DeleteAppTableViewResponse = client.bitable.v1.app_table_view.delete(request) + # 发起请求 + response: DeleteAppTableViewResponse = client.bitable.v1.app_table_view.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppTableViewRequest = DeleteAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .build() + # 构造请求对象 + request: DeleteAppTableViewRequest = DeleteAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .build() - # 发起请求 - response: DeleteAppTableViewResponse = await client.bitable.v1.app_table_view.adelete(request) + # 发起请求 + response: DeleteAppTableViewResponse = await client.bitable.v1.app_table_view.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/get_app_sample.py b/samples/api/bitable/v1/get_app_sample.py index 315e78342..a633ed5a9 100644 --- a/samples/api/bitable/v1/get_app_sample.py +++ b/samples/api/bitable/v1/get_app_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppRequest = GetAppRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .build() + # 构造请求对象 + request: GetAppRequest = GetAppRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .build() - # 发起请求 - response: GetAppResponse = client.bitable.v1.app.get(request) + # 发起请求 + response: GetAppResponse = client.bitable.v1.app.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppRequest = GetAppRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .build() + # 构造请求对象 + request: GetAppRequest = GetAppRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .build() - # 发起请求 - response: GetAppResponse = await client.bitable.v1.app.aget(request) + # 发起请求 + response: GetAppResponse = await client.bitable.v1.app.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/get_app_table_form_sample.py b/samples/api/bitable/v1/get_app_table_form_sample.py index e7b2b3e94..9c2531933 100644 --- a/samples/api/bitable/v1/get_app_table_form_sample.py +++ b/samples/api/bitable/v1/get_app_table_form_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableFormRequest = GetAppTableFormRequest.builder() \ - .app_token("bascnv1jIEppJdTCn3jOosabcef") \ - .table_id("tblz8nadEUdxNMt5") \ - .form_id("vew6oMbAa4") \ - .build() + # 构造请求对象 + request: GetAppTableFormRequest = GetAppTableFormRequest.builder() \ + .app_token("bascnv1jIEppJdTCn3jOosabcef") \ + .table_id("tblz8nadEUdxNMt5") \ + .form_id("vew6oMbAa4") \ + .build() - # 发起请求 - response: GetAppTableFormResponse = client.bitable.v1.app_table_form.get(request) + # 发起请求 + response: GetAppTableFormResponse = client.bitable.v1.app_table_form.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableFormRequest = GetAppTableFormRequest.builder() \ - .app_token("bascnv1jIEppJdTCn3jOosabcef") \ - .table_id("tblz8nadEUdxNMt5") \ - .form_id("vew6oMbAa4") \ - .build() + # 构造请求对象 + request: GetAppTableFormRequest = GetAppTableFormRequest.builder() \ + .app_token("bascnv1jIEppJdTCn3jOosabcef") \ + .table_id("tblz8nadEUdxNMt5") \ + .form_id("vew6oMbAa4") \ + .build() - # 发起请求 - response: GetAppTableFormResponse = await client.bitable.v1.app_table_form.aget(request) + # 发起请求 + response: GetAppTableFormResponse = await client.bitable.v1.app_table_form.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/get_app_table_record_sample.py b/samples/api/bitable/v1/get_app_table_record_sample.py index 2af1822a4..e1ceacf2d 100644 --- a/samples/api/bitable/v1/get_app_table_record_sample.py +++ b/samples/api/bitable/v1/get_app_table_record_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableRecordRequest = GetAppTableRecordRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .record_id("recn0hoyXL") \ - .text_field_as_array(True) \ - .user_id_type("user_id") \ - .display_formula_ref(True) \ - .with_shared_url(bool) \ - .automatic_fields(True) \ - .build() + # 构造请求对象 + request: GetAppTableRecordRequest = GetAppTableRecordRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .record_id("recn0hoyXL") \ + .text_field_as_array(True) \ + .user_id_type("user_id") \ + .display_formula_ref(True) \ + .with_shared_url(bool) \ + .automatic_fields(True) \ + .build() - # 发起请求 - response: GetAppTableRecordResponse = client.bitable.v1.app_table_record.get(request) + # 发起请求 + response: GetAppTableRecordResponse = client.bitable.v1.app_table_record.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableRecordRequest = GetAppTableRecordRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .record_id("recn0hoyXL") \ - .text_field_as_array(True) \ - .user_id_type("user_id") \ - .display_formula_ref(True) \ - .with_shared_url(bool) \ - .automatic_fields(True) \ - .build() + # 构造请求对象 + request: GetAppTableRecordRequest = GetAppTableRecordRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .record_id("recn0hoyXL") \ + .text_field_as_array(True) \ + .user_id_type("user_id") \ + .display_formula_ref(True) \ + .with_shared_url(bool) \ + .automatic_fields(True) \ + .build() - # 发起请求 - response: GetAppTableRecordResponse = await client.bitable.v1.app_table_record.aget(request) + # 发起请求 + response: GetAppTableRecordResponse = await client.bitable.v1.app_table_record.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/get_app_table_view_sample.py b/samples/api/bitable/v1/get_app_table_view_sample.py index c9ef86805..0f28af4d8 100644 --- a/samples/api/bitable/v1/get_app_table_view_sample.py +++ b/samples/api/bitable/v1/get_app_table_view_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableViewRequest = GetAppTableViewRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .build() + # 构造请求对象 + request: GetAppTableViewRequest = GetAppTableViewRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .build() - # 发起请求 - response: GetAppTableViewResponse = client.bitable.v1.app_table_view.get(request) + # 发起请求 + response: GetAppTableViewResponse = client.bitable.v1.app_table_view.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAppTableViewRequest = GetAppTableViewRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .build() + # 构造请求对象 + request: GetAppTableViewRequest = GetAppTableViewRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .build() - # 发起请求 - response: GetAppTableViewResponse = await client.bitable.v1.app_table_view.aget(request) + # 发起请求 + response: GetAppTableViewResponse = await client.bitable.v1.app_table_view.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_dashboard_sample.py b/samples/api/bitable/v1/list_app_dashboard_sample.py index 227216fc6..2a25c9292 100644 --- a/samples/api/bitable/v1/list_app_dashboard_sample.py +++ b/samples/api/bitable/v1/list_app_dashboard_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppDashboardRequest = ListAppDashboardRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .page_size(10) \ - .page_token("blknkqrP3RqUkcAW") \ - .build() + # 构造请求对象 + request: ListAppDashboardRequest = ListAppDashboardRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .page_size(10) \ + .page_token("blknkqrP3RqUkcAW") \ + .build() - # 发起请求 - response: ListAppDashboardResponse = client.bitable.v1.app_dashboard.list(request) + # 发起请求 + response: ListAppDashboardResponse = client.bitable.v1.app_dashboard.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_dashboard.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_dashboard.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppDashboardRequest = ListAppDashboardRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .page_size(10) \ - .page_token("blknkqrP3RqUkcAW") \ - .build() + # 构造请求对象 + request: ListAppDashboardRequest = ListAppDashboardRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .page_size(10) \ + .page_token("blknkqrP3RqUkcAW") \ + .build() - # 发起请求 - response: ListAppDashboardResponse = await client.bitable.v1.app_dashboard.alist(request) + # 发起请求 + response: ListAppDashboardResponse = await client.bitable.v1.app_dashboard.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_dashboard.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_dashboard.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_role_member_sample.py b/samples/api/bitable/v1/list_app_role_member_sample.py index 7819ed566..65af9fd80 100644 --- a/samples/api/bitable/v1/list_app_role_member_sample.py +++ b/samples/api/bitable/v1/list_app_role_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRoleMemberRequest = ListAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .page_size(100) \ - .page_token("xxxxx") \ - .build() + # 构造请求对象 + request: ListAppRoleMemberRequest = ListAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .page_size(100) \ + .page_token("xxxxx") \ + .build() - # 发起请求 - response: ListAppRoleMemberResponse = client.bitable.v1.app_role_member.list(request) + # 发起请求 + response: ListAppRoleMemberResponse = client.bitable.v1.app_role_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRoleMemberRequest = ListAppRoleMemberRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .page_size(100) \ - .page_token("xxxxx") \ - .build() + # 构造请求对象 + request: ListAppRoleMemberRequest = ListAppRoleMemberRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .page_size(100) \ + .page_token("xxxxx") \ + .build() - # 发起请求 - response: ListAppRoleMemberResponse = await client.bitable.v1.app_role_member.alist(request) + # 发起请求 + response: ListAppRoleMemberResponse = await client.bitable.v1.app_role_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_role_sample.py b/samples/api/bitable/v1/list_app_role_sample.py index e2630dc90..efbf3ad73 100644 --- a/samples/api/bitable/v1/list_app_role_sample.py +++ b/samples/api/bitable/v1/list_app_role_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRoleRequest = ListAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .page_size(10) \ - .page_token("roljRpwIUt") \ - .build() + # 构造请求对象 + request: ListAppRoleRequest = ListAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .page_size(10) \ + .page_token("roljRpwIUt") \ + .build() - # 发起请求 - response: ListAppRoleResponse = client.bitable.v1.app_role.list(request) + # 发起请求 + response: ListAppRoleResponse = client.bitable.v1.app_role.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppRoleRequest = ListAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .page_size(10) \ - .page_token("roljRpwIUt") \ - .build() + # 构造请求对象 + request: ListAppRoleRequest = ListAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .page_size(10) \ + .page_token("roljRpwIUt") \ + .build() - # 发起请求 - response: ListAppRoleResponse = await client.bitable.v1.app_role.alist(request) + # 发起请求 + response: ListAppRoleResponse = await client.bitable.v1.app_role.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_table_field_sample.py b/samples/api/bitable/v1/list_app_table_field_sample.py index c267fc9a0..948a22d55 100644 --- a/samples/api/bitable/v1/list_app_table_field_sample.py +++ b/samples/api/bitable/v1/list_app_table_field_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableFieldRequest = ListAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewOVMEXPF") \ - .text_field_as_array(True) \ - .page_token("fldwJ4YrtB") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableFieldRequest = ListAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewOVMEXPF") \ + .text_field_as_array(True) \ + .page_token("fldwJ4YrtB") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableFieldResponse = client.bitable.v1.app_table_field.list(request) + # 发起请求 + response: ListAppTableFieldResponse = client.bitable.v1.app_table_field.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableFieldRequest = ListAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewOVMEXPF") \ - .text_field_as_array(True) \ - .page_token("fldwJ4YrtB") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableFieldRequest = ListAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewOVMEXPF") \ + .text_field_as_array(True) \ + .page_token("fldwJ4YrtB") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableFieldResponse = await client.bitable.v1.app_table_field.alist(request) + # 发起请求 + response: ListAppTableFieldResponse = await client.bitable.v1.app_table_field.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_table_form_field_sample.py b/samples/api/bitable/v1/list_app_table_form_field_sample.py index 3af54e646..21a05c057 100644 --- a/samples/api/bitable/v1/list_app_table_form_field_sample.py +++ b/samples/api/bitable/v1/list_app_table_form_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableFormFieldRequest = ListAppTableFormFieldRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .form_id("vewTpR1urY") \ - .page_size(10) \ - .page_token("vewTpR1urY") \ - .build() + # 构造请求对象 + request: ListAppTableFormFieldRequest = ListAppTableFormFieldRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .form_id("vewTpR1urY") \ + .page_size(10) \ + .page_token("vewTpR1urY") \ + .build() - # 发起请求 - response: ListAppTableFormFieldResponse = client.bitable.v1.app_table_form_field.list(request) + # 发起请求 + response: ListAppTableFormFieldResponse = client.bitable.v1.app_table_form_field.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableFormFieldRequest = ListAppTableFormFieldRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .form_id("vewTpR1urY") \ - .page_size(10) \ - .page_token("vewTpR1urY") \ - .build() + # 构造请求对象 + request: ListAppTableFormFieldRequest = ListAppTableFormFieldRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .form_id("vewTpR1urY") \ + .page_size(10) \ + .page_token("vewTpR1urY") \ + .build() - # 发起请求 - response: ListAppTableFormFieldResponse = await client.bitable.v1.app_table_form_field.alist(request) + # 发起请求 + response: ListAppTableFormFieldResponse = await client.bitable.v1.app_table_form_field.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_table_record_sample.py b/samples/api/bitable/v1/list_app_table_record_sample.py index b100d4d2c..dffc86db4 100644 --- a/samples/api/bitable/v1/list_app_table_record_sample.py +++ b/samples/api/bitable/v1/list_app_table_record_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableRecordRequest = ListAppTableRecordRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .view_id("vewqhz51lk") \ - .filter("AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)") \ - .sort("") \ - .field_names("") \ - .text_field_as_array(True) \ - .user_id_type("user_id") \ - .display_formula_ref(True) \ - .automatic_fields(True) \ - .page_token("recn0hoyXL") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableRecordRequest = ListAppTableRecordRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .view_id("vewqhz51lk") \ + .filter("AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)") \ + .sort("") \ + .field_names("") \ + .text_field_as_array(True) \ + .user_id_type("user_id") \ + .display_formula_ref(True) \ + .automatic_fields(True) \ + .page_token("recn0hoyXL") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableRecordResponse = client.bitable.v1.app_table_record.list(request) + # 发起请求 + response: ListAppTableRecordResponse = client.bitable.v1.app_table_record.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableRecordRequest = ListAppTableRecordRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblxI2tWaxP5dG7p") \ - .view_id("vewqhz51lk") \ - .filter("AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)") \ - .sort("") \ - .field_names("") \ - .text_field_as_array(True) \ - .user_id_type("user_id") \ - .display_formula_ref(True) \ - .automatic_fields(True) \ - .page_token("recn0hoyXL") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableRecordRequest = ListAppTableRecordRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblxI2tWaxP5dG7p") \ + .view_id("vewqhz51lk") \ + .filter("AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)") \ + .sort("") \ + .field_names("") \ + .text_field_as_array(True) \ + .user_id_type("user_id") \ + .display_formula_ref(True) \ + .automatic_fields(True) \ + .page_token("recn0hoyXL") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableRecordResponse = await client.bitable.v1.app_table_record.alist(request) + # 发起请求 + response: ListAppTableRecordResponse = await client.bitable.v1.app_table_record.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_table_sample.py b/samples/api/bitable/v1/list_app_table_sample.py index a25b3754c..2995dab46 100644 --- a/samples/api/bitable/v1/list_app_table_sample.py +++ b/samples/api/bitable/v1/list_app_table_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableRequest = ListAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .page_token("tblsRc9GRRXKqhvW") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableRequest = ListAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .page_token("tblsRc9GRRXKqhvW") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableResponse = client.bitable.v1.app_table.list(request) + # 发起请求 + response: ListAppTableResponse = client.bitable.v1.app_table.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableRequest = ListAppTableRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .page_token("tblsRc9GRRXKqhvW") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListAppTableRequest = ListAppTableRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .page_token("tblsRc9GRRXKqhvW") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListAppTableResponse = await client.bitable.v1.app_table.alist(request) + # 发起请求 + response: ListAppTableResponse = await client.bitable.v1.app_table.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/list_app_table_view_sample.py b/samples/api/bitable/v1/list_app_table_view_sample.py index 0902b5338..4decd12e6 100644 --- a/samples/api/bitable/v1/list_app_table_view_sample.py +++ b/samples/api/bitable/v1/list_app_table_view_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableViewRequest = ListAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .page_size(10) \ - .page_token("vewTpR1urY") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAppTableViewRequest = ListAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .page_size(10) \ + .page_token("vewTpR1urY") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAppTableViewResponse = client.bitable.v1.app_table_view.list(request) + # 发起请求 + response: ListAppTableViewResponse = client.bitable.v1.app_table_view.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAppTableViewRequest = ListAppTableViewRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .page_size(10) \ - .page_token("vewTpR1urY") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListAppTableViewRequest = ListAppTableViewRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .page_size(10) \ + .page_token("vewTpR1urY") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListAppTableViewResponse = await client.bitable.v1.app_table_view.alist(request) + # 发起请求 + response: ListAppTableViewResponse = await client.bitable.v1.app_table_view.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/patch_app_table_form_field_sample.py b/samples/api/bitable/v1/patch_app_table_form_field_sample.py index b270840f2..4356c1027 100644 --- a/samples/api/bitable/v1/patch_app_table_form_field_sample.py +++ b/samples/api/bitable/v1/patch_app_table_form_field_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableFormFieldRequest = PatchAppTableFormFieldRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblsRc9GRRXKqhvW") \ - .form_id("vewTpR1urY") \ - .field_id("fldjX7dUj5") \ - .request_body(AppTableFormPatchedField.builder() - .pre_field_id("str") - .title("str") - .description("str") - .required(bool) - .visible(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableFormFieldRequest = PatchAppTableFormFieldRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblsRc9GRRXKqhvW") \ + .form_id("vewTpR1urY") \ + .field_id("fldjX7dUj5") \ + .request_body(AppTableFormPatchedField.builder() + .pre_field_id("str") + .title("str") + .description("str") + .required(bool) + .visible(bool) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableFormFieldResponse = client.bitable.v1.app_table_form_field.patch(request) + # 发起请求 + response: PatchAppTableFormFieldResponse = client.bitable.v1.app_table_form_field.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableFormFieldRequest = PatchAppTableFormFieldRequest.builder() \ - .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ - .table_id("tblsRc9GRRXKqhvW") \ - .form_id("vewTpR1urY") \ - .field_id("fldjX7dUj5") \ - .request_body(AppTableFormPatchedField.builder() - .pre_field_id("str") - .title("str") - .description("str") - .required(bool) - .visible(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableFormFieldRequest = PatchAppTableFormFieldRequest.builder() \ + .app_token("bascnCMII2ORej2RItqpZZUNMIe") \ + .table_id("tblsRc9GRRXKqhvW") \ + .form_id("vewTpR1urY") \ + .field_id("fldjX7dUj5") \ + .request_body(AppTableFormPatchedField.builder() + .pre_field_id("str") + .title("str") + .description("str") + .required(bool) + .visible(bool) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableFormFieldResponse = await client.bitable.v1.app_table_form_field.apatch(request) + # 发起请求 + response: PatchAppTableFormFieldResponse = await client.bitable.v1.app_table_form_field.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/patch_app_table_form_sample.py b/samples/api/bitable/v1/patch_app_table_form_sample.py index 6f6134108..1370b527e 100644 --- a/samples/api/bitable/v1/patch_app_table_form_sample.py +++ b/samples/api/bitable/v1/patch_app_table_form_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableFormRequest = PatchAppTableFormRequest.builder() \ - .app_token("bascnv1jIEppJdTCn3jOosabcef") \ - .table_id("tblz8nadEUdxNMt5") \ - .form_id("vew6oMbAa4") \ - .request_body(AppTableForm.builder() - .name("str") - .description("str") - .shared(bool) - .shared_limit("off") - .submit_limit_once(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableFormRequest = PatchAppTableFormRequest.builder() \ + .app_token("bascnv1jIEppJdTCn3jOosabcef") \ + .table_id("tblz8nadEUdxNMt5") \ + .form_id("vew6oMbAa4") \ + .request_body(AppTableForm.builder() + .name("str") + .description("str") + .shared(bool) + .shared_limit("off") + .submit_limit_once(bool) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableFormResponse = client.bitable.v1.app_table_form.patch(request) + # 发起请求 + response: PatchAppTableFormResponse = client.bitable.v1.app_table_form.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableFormRequest = PatchAppTableFormRequest.builder() \ - .app_token("bascnv1jIEppJdTCn3jOosabcef") \ - .table_id("tblz8nadEUdxNMt5") \ - .form_id("vew6oMbAa4") \ - .request_body(AppTableForm.builder() - .name("str") - .description("str") - .shared(bool) - .shared_limit("off") - .submit_limit_once(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableFormRequest = PatchAppTableFormRequest.builder() \ + .app_token("bascnv1jIEppJdTCn3jOosabcef") \ + .table_id("tblz8nadEUdxNMt5") \ + .form_id("vew6oMbAa4") \ + .request_body(AppTableForm.builder() + .name("str") + .description("str") + .shared(bool) + .shared_limit("off") + .submit_limit_once(bool) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableFormResponse = await client.bitable.v1.app_table_form.apatch(request) + # 发起请求 + response: PatchAppTableFormResponse = await client.bitable.v1.app_table_form.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_form.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_form.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/patch_app_table_sample.py b/samples/api/bitable/v1/patch_app_table_sample.py index 8ca8a46dc..bb33e3524 100644 --- a/samples/api/bitable/v1/patch_app_table_sample.py +++ b/samples/api/bitable/v1/patch_app_table_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableRequest = PatchAppTableRequest.builder() \ - .app_token("str") \ - .table_id("str") \ - .request_body(PatchAppTableRequestBody.builder() - .name("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableRequest = PatchAppTableRequest.builder() \ + .app_token("str") \ + .table_id("str") \ + .request_body(PatchAppTableRequestBody.builder() + .name("str") + .build()) \ + .build() - # 发起请求 - response: PatchAppTableResponse = client.bitable.v1.app_table.patch(request) + # 发起请求 + response: PatchAppTableResponse = client.bitable.v1.app_table.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableRequest = PatchAppTableRequest.builder() \ - .app_token("str") \ - .table_id("str") \ - .request_body(PatchAppTableRequestBody.builder() - .name("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableRequest = PatchAppTableRequest.builder() \ + .app_token("str") \ + .table_id("str") \ + .request_body(PatchAppTableRequestBody.builder() + .name("str") + .build()) \ + .build() - # 发起请求 - response: PatchAppTableResponse = await client.bitable.v1.app_table.apatch(request) + # 发起请求 + response: PatchAppTableResponse = await client.bitable.v1.app_table.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/patch_app_table_view_sample.py b/samples/api/bitable/v1/patch_app_table_view_sample.py index 8607a3670..1e87e3098 100644 --- a/samples/api/bitable/v1/patch_app_table_view_sample.py +++ b/samples/api/bitable/v1/patch_app_table_view_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableViewRequest = PatchAppTableViewRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .request_body(PatchAppTableViewRequestBody.builder() - .view_name("grid") - .property(AppTableViewProperty.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableViewRequest = PatchAppTableViewRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .request_body(PatchAppTableViewRequestBody.builder() + .view_name("grid") + .property(AppTableViewProperty.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableViewResponse = client.bitable.v1.app_table_view.patch(request) + # 发起请求 + response: PatchAppTableViewResponse = client.bitable.v1.app_table_view.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAppTableViewRequest = PatchAppTableViewRequest.builder() \ - .app_token("bascng7vrxcxpig7geggXiCtadY") \ - .table_id("tblsRc9GRRXKqhvW") \ - .view_id("vewTpR1urY") \ - .request_body(PatchAppTableViewRequestBody.builder() - .view_name("grid") - .property(AppTableViewProperty.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAppTableViewRequest = PatchAppTableViewRequest.builder() \ + .app_token("bascng7vrxcxpig7geggXiCtadY") \ + .table_id("tblsRc9GRRXKqhvW") \ + .view_id("vewTpR1urY") \ + .request_body(PatchAppTableViewRequestBody.builder() + .view_name("grid") + .property(AppTableViewProperty.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAppTableViewResponse = await client.bitable.v1.app_table_view.apatch(request) + # 发起请求 + response: PatchAppTableViewResponse = await client.bitable.v1.app_table_view.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_view.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_view.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/search_app_table_record_sample.py b/samples/api/bitable/v1/search_app_table_record_sample.py index d5b246956..74e1d6365 100644 --- a/samples/api/bitable/v1/search_app_table_record_sample.py +++ b/samples/api/bitable/v1/search_app_table_record_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchAppTableRecordRequest = SearchAppTableRecordRequest.builder() \ - .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ - .table_id("tbl0xe5g8PP3U3cS") \ - .user_id_type("open_id") \ - .page_token("str") \ - .page_size(20) \ - .request_body(SearchAppTableRecordRequestBody.builder() - .view_id("viex") - .field_names([]) - .sort([]) - .filter(FilterInfo.builder().build()) - .automatic_fields(bool) - .build()) \ - .build() + # 构造请求对象 + request: SearchAppTableRecordRequest = SearchAppTableRecordRequest.builder() \ + .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ + .table_id("tbl0xe5g8PP3U3cS") \ + .user_id_type("open_id") \ + .page_token("str") \ + .page_size(20) \ + .request_body(SearchAppTableRecordRequestBody.builder() + .view_id("viex") + .field_names([]) + .sort([]) + .filter(FilterInfo.builder().build()) + .automatic_fields(bool) + .build()) \ + .build() - # 发起请求 - response: SearchAppTableRecordResponse = client.bitable.v1.app_table_record.search(request) + # 发起请求 + response: SearchAppTableRecordResponse = client.bitable.v1.app_table_record.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchAppTableRecordRequest = SearchAppTableRecordRequest.builder() \ - .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ - .table_id("tbl0xe5g8PP3U3cS") \ - .user_id_type("open_id") \ - .page_token("str") \ - .page_size(20) \ - .request_body(SearchAppTableRecordRequestBody.builder() - .view_id("viex") - .field_names([]) - .sort([]) - .filter(FilterInfo.builder().build()) - .automatic_fields(bool) - .build()) \ - .build() + # 构造请求对象 + request: SearchAppTableRecordRequest = SearchAppTableRecordRequest.builder() \ + .app_token("NQRxbRkBMa6OnZsjtERcxhNWnNh") \ + .table_id("tbl0xe5g8PP3U3cS") \ + .user_id_type("open_id") \ + .page_token("str") \ + .page_size(20) \ + .request_body(SearchAppTableRecordRequestBody.builder() + .view_id("viex") + .field_names([]) + .sort([]) + .filter(FilterInfo.builder().build()) + .automatic_fields(bool) + .build()) \ + .build() - # 发起请求 - response: SearchAppTableRecordResponse = await client.bitable.v1.app_table_record.asearch(request) + # 发起请求 + response: SearchAppTableRecordResponse = await client.bitable.v1.app_table_record.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/update_app_role_sample.py b/samples/api/bitable/v1/update_app_role_sample.py index 93228ac93..347db68f4 100644 --- a/samples/api/bitable/v1/update_app_role_sample.py +++ b/samples/api/bitable/v1/update_app_role_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppRoleRequest = UpdateAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .request_body(AppRole.builder() - .role_name("自定义权限1") - .table_roles([]) - .block_roles([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppRoleRequest = UpdateAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .request_body(AppRole.builder() + .role_name("自定义权限1") + .table_roles([]) + .block_roles([]) + .build()) \ + .build() - # 发起请求 - response: UpdateAppRoleResponse = client.bitable.v1.app_role.update(request) + # 发起请求 + response: UpdateAppRoleResponse = client.bitable.v1.app_role.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppRoleRequest = UpdateAppRoleRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .role_id("roljRpwIUt") \ - .request_body(AppRole.builder() - .role_name("自定义权限1") - .table_roles([]) - .block_roles([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppRoleRequest = UpdateAppRoleRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .role_id("roljRpwIUt") \ + .request_body(AppRole.builder() + .role_name("自定义权限1") + .table_roles([]) + .block_roles([]) + .build()) \ + .build() - # 发起请求 - response: UpdateAppRoleResponse = await client.bitable.v1.app_role.aupdate(request) + # 发起请求 + response: UpdateAppRoleResponse = await client.bitable.v1.app_role.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_role.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_role.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/update_app_sample.py b/samples/api/bitable/v1/update_app_sample.py index b48795cc1..ba5769737 100644 --- a/samples/api/bitable/v1/update_app_sample.py +++ b/samples/api/bitable/v1/update_app_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppRequest = UpdateAppRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(UpdateAppRequestBody.builder() - .name("新的多维表格名字") - .is_advanced(True) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppRequest = UpdateAppRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(UpdateAppRequestBody.builder() + .name("新的多维表格名字") + .is_advanced(True) + .build()) \ + .build() - # 发起请求 - response: UpdateAppResponse = client.bitable.v1.app.update(request) + # 发起请求 + response: UpdateAppResponse = client.bitable.v1.app.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppRequest = UpdateAppRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .request_body(UpdateAppRequestBody.builder() - .name("新的多维表格名字") - .is_advanced(True) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppRequest = UpdateAppRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .request_body(UpdateAppRequestBody.builder() + .name("新的多维表格名字") + .is_advanced(True) + .build()) \ + .build() - # 发起请求 - response: UpdateAppResponse = await client.bitable.v1.app.aupdate(request) + # 发起请求 + response: UpdateAppResponse = await client.bitable.v1.app.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/update_app_table_field_sample.py b/samples/api/bitable/v1/update_app_table_field_sample.py index ddbda2290..914823699 100644 --- a/samples/api/bitable/v1/update_app_table_field_sample.py +++ b/samples/api/bitable/v1/update_app_table_field_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppTableFieldRequest = UpdateAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .field_id("fldPTb0U2y") \ - .request_body(AppTableField.builder() - .field_name("字段名称") - .type(int) - .property(AppTableFieldProperty.builder().build()) - .description(AppTableFieldDescription.builder().build()) - .ui_type("Progress") - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppTableFieldRequest = UpdateAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .field_id("fldPTb0U2y") \ + .request_body(AppTableField.builder() + .field_name("字段名称") + .type(int) + .property(AppTableFieldProperty.builder().build()) + .description(AppTableFieldDescription.builder().build()) + .ui_type("Progress") + .build()) \ + .build() - # 发起请求 - response: UpdateAppTableFieldResponse = client.bitable.v1.app_table_field.update(request) + # 发起请求 + response: UpdateAppTableFieldResponse = client.bitable.v1.app_table_field.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppTableFieldRequest = UpdateAppTableFieldRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .field_id("fldPTb0U2y") \ - .request_body(AppTableField.builder() - .field_name("字段名称") - .type(int) - .property(AppTableFieldProperty.builder().build()) - .description(AppTableFieldDescription.builder().build()) - .ui_type("Progress") - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppTableFieldRequest = UpdateAppTableFieldRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .field_id("fldPTb0U2y") \ + .request_body(AppTableField.builder() + .field_name("字段名称") + .type(int) + .property(AppTableFieldProperty.builder().build()) + .description(AppTableFieldDescription.builder().build()) + .ui_type("Progress") + .build()) \ + .build() - # 发起请求 - response: UpdateAppTableFieldResponse = await client.bitable.v1.app_table_field.aupdate(request) + # 发起请求 + response: UpdateAppTableFieldResponse = await client.bitable.v1.app_table_field.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_field.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_field.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/bitable/v1/update_app_table_record_sample.py b/samples/api/bitable/v1/update_app_table_record_sample.py index 4ed1fe8e0..49b04d4d8 100644 --- a/samples/api/bitable/v1/update_app_table_record_sample.py +++ b/samples/api/bitable/v1/update_app_table_record_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppTableRecordRequest = UpdateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .record_id("recqwIwhc6") \ - .user_id_type("user_id") \ - .request_body(AppTableRecord.builder() - .fields({}) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppTableRecordRequest = UpdateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .record_id("recqwIwhc6") \ + .user_id_type("user_id") \ + .request_body(AppTableRecord.builder() + .fields({}) + .build()) \ + .build() - # 发起请求 - response: UpdateAppTableRecordResponse = client.bitable.v1.app_table_record.update(request) + # 发起请求 + response: UpdateAppTableRecordResponse = client.bitable.v1.app_table_record.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppTableRecordRequest = UpdateAppTableRecordRequest.builder() \ - .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ - .table_id("tblsRc9GRRXKqhvW") \ - .record_id("recqwIwhc6") \ - .user_id_type("user_id") \ - .request_body(AppTableRecord.builder() - .fields({}) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppTableRecordRequest = UpdateAppTableRecordRequest.builder() \ + .app_token("appbcbWCzen6D8dezhoCH2RpMAh") \ + .table_id("tblsRc9GRRXKqhvW") \ + .record_id("recqwIwhc6") \ + .user_id_type("user_id") \ + .request_body(AppTableRecord.builder() + .fields({}) + .build()) \ + .build() - # 发起请求 - response: UpdateAppTableRecordResponse = await client.bitable.v1.app_table_record.aupdate(request) + # 发起请求 + response: UpdateAppTableRecordResponse = await client.bitable.v1.app_table_record.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.bitable.v1.app_table_record.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.bitable.v1.app_table_record.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/block/v2/create_entity_sample.py b/samples/api/block/v2/create_entity_sample.py index f5e19ae49..990246895 100644 --- a/samples/api/block/v2/create_entity_sample.py +++ b/samples/api/block/v2/create_entity_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .request_body(CreateEntityRequestBody.builder() - .title("已阅block") - .block_type_id("blk_614c1c952f800014b27f87d6") - .source_data("") - .source_meta("") - .version("1") - .source_link("") - .owner("ou_fa7aa170f92d1615de63371ac425a767") - .extra("{}") - .i18n_summary("") - .i18n_preview("") - .summary("") - .preview("") - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .request_body(CreateEntityRequestBody.builder() + .title("已阅block") + .block_type_id("blk_614c1c952f800014b27f87d6") + .source_data("") + .source_meta("") + .version("1") + .source_link("") + .owner("ou_fa7aa170f92d1615de63371ac425a767") + .extra("{}") + .i18n_summary("") + .i18n_preview("") + .summary("") + .preview("") + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = client.block.v2.entity.create(request) + # 发起请求 + response: CreateEntityResponse = client.block.v2.entity.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .request_body(CreateEntityRequestBody.builder() - .title("已阅block") - .block_type_id("blk_614c1c952f800014b27f87d6") - .source_data("") - .source_meta("") - .version("1") - .source_link("") - .owner("ou_fa7aa170f92d1615de63371ac425a767") - .extra("{}") - .i18n_summary("") - .i18n_preview("") - .summary("") - .preview("") - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .request_body(CreateEntityRequestBody.builder() + .title("已阅block") + .block_type_id("blk_614c1c952f800014b27f87d6") + .source_data("") + .source_meta("") + .version("1") + .source_link("") + .owner("ou_fa7aa170f92d1615de63371ac425a767") + .extra("{}") + .i18n_summary("") + .i18n_preview("") + .summary("") + .preview("") + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = await client.block.v2.entity.acreate(request) + # 发起请求 + response: CreateEntityResponse = await client.block.v2.entity.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/block/v2/create_message_sample.py b/samples/api/block/v2/create_message_sample.py index d5d270cbd..3ab68343d 100644 --- a/samples/api/block/v2/create_message_sample.py +++ b/samples/api/block/v2/create_message_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .request_body(Message.builder() - .body("") - .version("1637565292196") - .block_id("8116040162664047375") - .resource("read_block") - .open_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .request_body(Message.builder() + .body("") + .version("1637565292196") + .block_id("8116040162664047375") + .resource("read_block") + .open_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = client.block.v2.message.create(request) + # 发起请求 + response: CreateMessageResponse = client.block.v2.message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .request_body(Message.builder() - .body("") - .version("1637565292196") - .block_id("8116040162664047375") - .resource("read_block") - .open_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .request_body(Message.builder() + .body("") + .version("1637565292196") + .block_id("8116040162664047375") + .resource("read_block") + .open_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = await client.block.v2.message.acreate(request) + # 发起请求 + response: CreateMessageResponse = await client.block.v2.message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/block/v2/update_entity_sample.py b/samples/api/block/v2/update_entity_sample.py index 1de82377c..91883de4a 100644 --- a/samples/api/block/v2/update_entity_sample.py +++ b/samples/api/block/v2/update_entity_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .block_id("7794641623571830467") \ - .request_body(Entity.builder() - .title("已阅block") - .block_type_id("blk_6204893fee000013739f5359") - .source_data("") - .source_meta("") - .version("1651716489253602") - .source_link("str") - .summary("") - .preview("") - .i18n_summay("") - .i18n_preview("") - .owner("ou_fa7aa170f92d1615de63371ac425a767") - .extra("{}") - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .block_id("7794641623571830467") \ + .request_body(Entity.builder() + .title("已阅block") + .block_type_id("blk_6204893fee000013739f5359") + .source_data("") + .source_meta("") + .version("1651716489253602") + .source_link("str") + .summary("") + .preview("") + .i18n_summay("") + .i18n_preview("") + .owner("ou_fa7aa170f92d1615de63371ac425a767") + .extra("{}") + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = client.block.v2.entity.update(request) + # 发起请求 + response: UpdateEntityResponse = client.block.v2.entity.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .block_id("7794641623571830467") \ - .request_body(Entity.builder() - .title("已阅block") - .block_type_id("blk_6204893fee000013739f5359") - .source_data("") - .source_meta("") - .version("1651716489253602") - .source_link("str") - .summary("") - .preview("") - .i18n_summay("") - .i18n_preview("") - .owner("ou_fa7aa170f92d1615de63371ac425a767") - .extra("{}") - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .block_id("7794641623571830467") \ + .request_body(Entity.builder() + .title("已阅block") + .block_type_id("blk_6204893fee000013739f5359") + .source_data("") + .source_meta("") + .version("1651716489253602") + .source_link("str") + .summary("") + .preview("") + .i18n_summay("") + .i18n_preview("") + .owner("ou_fa7aa170f92d1615de63371ac425a767") + .extra("{}") + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = await client.block.v2.entity.aupdate(request) + # 发起请求 + response: UpdateEntityResponse = await client.block.v2.entity.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.block.v2.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.block.v2.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/board/v1/download_as_image_whiteboard_sample.py b/samples/api/board/v1/download_as_image_whiteboard_sample.py index 47721ea9a..08fa0bd45 100644 --- a/samples/api/board/v1/download_as_image_whiteboard_sample.py +++ b/samples/api/board/v1/download_as_image_whiteboard_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadAsImageWhiteboardRequest = DownloadAsImageWhiteboardRequest.builder() \ - .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ - .build() + # 构造请求对象 + request: DownloadAsImageWhiteboardRequest = DownloadAsImageWhiteboardRequest.builder() \ + .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ + .build() - # 发起请求 - response: DownloadAsImageWhiteboardResponse = client.board.v1.whiteboard.download_as_image(request) + # 发起请求 + response: DownloadAsImageWhiteboardResponse = client.board.v1.whiteboard.download_as_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.board.v1.whiteboard.download_as_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.board.v1.whiteboard.download_as_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadAsImageWhiteboardRequest = DownloadAsImageWhiteboardRequest.builder() \ - .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ - .build() + # 构造请求对象 + request: DownloadAsImageWhiteboardRequest = DownloadAsImageWhiteboardRequest.builder() \ + .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ + .build() - # 发起请求 - response: DownloadAsImageWhiteboardResponse = await client.board.v1.whiteboard.adownload_as_image(request) + # 发起请求 + response: DownloadAsImageWhiteboardResponse = await client.board.v1.whiteboard.adownload_as_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.board.v1.whiteboard.adownload_as_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.board.v1.whiteboard.adownload_as_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/board/v1/list_whiteboard_node_sample.py b/samples/api/board/v1/list_whiteboard_node_sample.py index 080819b5c..b0c031fce 100644 --- a/samples/api/board/v1/list_whiteboard_node_sample.py +++ b/samples/api/board/v1/list_whiteboard_node_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWhiteboardNodeRequest = ListWhiteboardNodeRequest.builder() \ - .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ - .build() + # 构造请求对象 + request: ListWhiteboardNodeRequest = ListWhiteboardNodeRequest.builder() \ + .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ + .build() - # 发起请求 - response: ListWhiteboardNodeResponse = client.board.v1.whiteboard_node.list(request) + # 发起请求 + response: ListWhiteboardNodeResponse = client.board.v1.whiteboard_node.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.board.v1.whiteboard_node.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.board.v1.whiteboard_node.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWhiteboardNodeRequest = ListWhiteboardNodeRequest.builder() \ - .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ - .build() + # 构造请求对象 + request: ListWhiteboardNodeRequest = ListWhiteboardNodeRequest.builder() \ + .whiteboard_id("Ru8nwrWFOhEmaFbEU2VbPRsHcxb") \ + .build() - # 发起请求 - response: ListWhiteboardNodeResponse = await client.board.v1.whiteboard_node.alist(request) + # 发起请求 + response: ListWhiteboardNodeResponse = await client.board.v1.whiteboard_node.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.board.v1.whiteboard_node.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.board.v1.whiteboard_node.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/batch_delete_calendar_event_attendee_sample.py b/samples/api/calendar/v4/batch_delete_calendar_event_attendee_sample.py index 72bb442d8..ec9e62cbe 100644 --- a/samples/api/calendar/v4/batch_delete_calendar_event_attendee_sample.py +++ b/samples/api/calendar/v4/batch_delete_calendar_event_attendee_sample.py @@ -5,78 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteCalendarEventAttendeeRequest = BatchDeleteCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .request_body(BatchDeleteCalendarEventAttendeeRequestBody.builder() - .attendee_ids([]) - .delete_ids([]) - .need_notification(False) - .instance_start_time_admin("1647320400") - .is_enable_admin(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteCalendarEventAttendeeRequest = BatchDeleteCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .request_body(BatchDeleteCalendarEventAttendeeRequestBody.builder() + .attendee_ids([]) + .delete_ids([]) + .need_notification(False) + .instance_start_time_admin("1647320400") + .is_enable_admin(False) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.batch_delete( - request) + # 发起请求 + response: BatchDeleteCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteCalendarEventAttendeeRequest = BatchDeleteCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .request_body(BatchDeleteCalendarEventAttendeeRequestBody.builder() - .attendee_ids([]) - .delete_ids([]) - .need_notification(False) - .instance_start_time_admin("1647320400") - .is_enable_admin(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteCalendarEventAttendeeRequest = BatchDeleteCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .request_body(BatchDeleteCalendarEventAttendeeRequestBody.builder() + .attendee_ids([]) + .delete_ids([]) + .need_notification(False) + .instance_start_time_admin("1647320400") + .is_enable_admin(False) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.abatch_delete( - request) + # 发起请求 + response: BatchDeleteCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_acl_sample.py b/samples/api/calendar/v4/create_calendar_acl_sample.py index b22ff9c6e..ded9581f0 100644 --- a/samples/api/calendar/v4/create_calendar_acl_sample.py +++ b/samples/api/calendar/v4/create_calendar_acl_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarAclRequest = CreateCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .request_body(CalendarAcl.builder() - .role("unknown") - .scope(AclScope.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarAclRequest = CreateCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .request_body(CalendarAcl.builder() + .role("unknown") + .scope(AclScope.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarAclResponse = client.calendar.v4.calendar_acl.create(request) + # 发起请求 + response: CreateCalendarAclResponse = client.calendar.v4.calendar_acl.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarAclRequest = CreateCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .request_body(CalendarAcl.builder() - .role("unknown") - .scope(AclScope.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarAclRequest = CreateCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .request_body(CalendarAcl.builder() + .role("unknown") + .scope(AclScope.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarAclResponse = await client.calendar.v4.calendar_acl.acreate(request) + # 发起请求 + response: CreateCalendarAclResponse = await client.calendar.v4.calendar_acl.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_event_attendee_sample.py b/samples/api/calendar/v4/create_calendar_event_attendee_sample.py index 77e93d830..e52aa45ab 100644 --- a/samples/api/calendar/v4/create_calendar_event_attendee_sample.py +++ b/samples/api/calendar/v4/create_calendar_event_attendee_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventAttendeeRequest = CreateCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .request_body(CreateCalendarEventAttendeeRequestBody.builder() - .attendees([]) - .need_notification(False) - .instance_start_time_admin("1647320400") - .is_enable_admin(False) - .add_operator_to_attendee(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarEventAttendeeRequest = CreateCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .request_body(CreateCalendarEventAttendeeRequestBody.builder() + .attendees([]) + .need_notification(False) + .instance_start_time_admin("1647320400") + .is_enable_admin(False) + .add_operator_to_attendee(False) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.create(request) + # 发起请求 + response: CreateCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventAttendeeRequest = CreateCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .request_body(CreateCalendarEventAttendeeRequestBody.builder() - .attendees([]) - .need_notification(False) - .instance_start_time_admin("1647320400") - .is_enable_admin(False) - .add_operator_to_attendee(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarEventAttendeeRequest = CreateCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .request_body(CreateCalendarEventAttendeeRequestBody.builder() + .attendees([]) + .need_notification(False) + .instance_start_time_admin("1647320400") + .is_enable_admin(False) + .add_operator_to_attendee(False) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.acreate(request) + # 发起请求 + response: CreateCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_event_meeting_chat_sample.py b/samples/api/calendar/v4/create_calendar_event_meeting_chat_sample.py index 273d6f61e..a53be0ddb 100644 --- a/samples/api/calendar/v4/create_calendar_event_meeting_chat_sample.py +++ b/samples/api/calendar/v4/create_calendar_event_meeting_chat_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventMeetingChatRequest = CreateCalendarEventMeetingChatRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .build() + # 构造请求对象 + request: CreateCalendarEventMeetingChatRequest = CreateCalendarEventMeetingChatRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .build() - # 发起请求 - response: CreateCalendarEventMeetingChatResponse = client.calendar.v4.calendar_event_meeting_chat.create(request) + # 发起请求 + response: CreateCalendarEventMeetingChatResponse = client.calendar.v4.calendar_event_meeting_chat.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_chat.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_chat.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventMeetingChatRequest = CreateCalendarEventMeetingChatRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .build() + # 构造请求对象 + request: CreateCalendarEventMeetingChatRequest = CreateCalendarEventMeetingChatRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .build() - # 发起请求 - response: CreateCalendarEventMeetingChatResponse = await client.calendar.v4.calendar_event_meeting_chat.acreate( - request) + # 发起请求 + response: CreateCalendarEventMeetingChatResponse = await client.calendar.v4.calendar_event_meeting_chat.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_chat.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_chat.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_event_meeting_minute_sample.py b/samples/api/calendar/v4/create_calendar_event_meeting_minute_sample.py index ba964a12e..40876632b 100644 --- a/samples/api/calendar/v4/create_calendar_event_meeting_minute_sample.py +++ b/samples/api/calendar/v4/create_calendar_event_meeting_minute_sample.py @@ -5,62 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventMeetingMinuteRequest = CreateCalendarEventMeetingMinuteRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .build() + # 构造请求对象 + request: CreateCalendarEventMeetingMinuteRequest = CreateCalendarEventMeetingMinuteRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .build() - # 发起请求 - response: CreateCalendarEventMeetingMinuteResponse = client.calendar.v4.calendar_event_meeting_minute.create( - request) + # 发起请求 + response: CreateCalendarEventMeetingMinuteResponse = client.calendar.v4.calendar_event_meeting_minute.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_minute.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_minute.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventMeetingMinuteRequest = CreateCalendarEventMeetingMinuteRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .build() + # 构造请求对象 + request: CreateCalendarEventMeetingMinuteRequest = CreateCalendarEventMeetingMinuteRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .build() - # 发起请求 - response: CreateCalendarEventMeetingMinuteResponse = await client.calendar.v4.calendar_event_meeting_minute.acreate( - request) + # 发起请求 + response: CreateCalendarEventMeetingMinuteResponse = await client.calendar.v4.calendar_event_meeting_minute.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_minute.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_minute.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_event_sample.py b/samples/api/calendar/v4/create_calendar_event_sample.py index b91138877..7875e38f4 100644 --- a/samples/api/calendar/v4/create_calendar_event_sample.py +++ b/samples/api/calendar/v4/create_calendar_event_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventRequest = CreateCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .idempotency_key("25fdf41b-8c80-2ce1-e94c-de8b5e7aa7e6") \ - .user_id_type("user_id") \ - .request_body(CalendarEvent.builder() - .summary("日程标题") - .description("日程描述") - .need_notification(False) - .start_time(TimeInfo.builder().build()) - .end_time(TimeInfo.builder().build()) - .vchat(Vchat.builder().build()) - .visibility("default") - .attendee_ability("none") - .free_busy_status("busy") - .location(EventLocation.builder().build()) - .color(0) - .reminders([]) - .recurrence("FREQ=DAILY;INTERVAL=1") - .schemas([]) - .attachments([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarEventRequest = CreateCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .idempotency_key("25fdf41b-8c80-2ce1-e94c-de8b5e7aa7e6") \ + .user_id_type("user_id") \ + .request_body(CalendarEvent.builder() + .summary("日程标题") + .description("日程描述") + .need_notification(False) + .start_time(TimeInfo.builder().build()) + .end_time(TimeInfo.builder().build()) + .vchat(Vchat.builder().build()) + .visibility("default") + .attendee_ability("none") + .free_busy_status("busy") + .location(EventLocation.builder().build()) + .color(0) + .reminders([]) + .recurrence("FREQ=DAILY;INTERVAL=1") + .schemas([]) + .attachments([]) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarEventResponse = client.calendar.v4.calendar_event.create(request) + # 发起请求 + response: CreateCalendarEventResponse = client.calendar.v4.calendar_event.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarEventRequest = CreateCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .idempotency_key("25fdf41b-8c80-2ce1-e94c-de8b5e7aa7e6") \ - .user_id_type("user_id") \ - .request_body(CalendarEvent.builder() - .summary("日程标题") - .description("日程描述") - .need_notification(False) - .start_time(TimeInfo.builder().build()) - .end_time(TimeInfo.builder().build()) - .vchat(Vchat.builder().build()) - .visibility("default") - .attendee_ability("none") - .free_busy_status("busy") - .location(EventLocation.builder().build()) - .color(0) - .reminders([]) - .recurrence("FREQ=DAILY;INTERVAL=1") - .schemas([]) - .attachments([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarEventRequest = CreateCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .idempotency_key("25fdf41b-8c80-2ce1-e94c-de8b5e7aa7e6") \ + .user_id_type("user_id") \ + .request_body(CalendarEvent.builder() + .summary("日程标题") + .description("日程描述") + .need_notification(False) + .start_time(TimeInfo.builder().build()) + .end_time(TimeInfo.builder().build()) + .vchat(Vchat.builder().build()) + .visibility("default") + .attendee_ability("none") + .free_busy_status("busy") + .location(EventLocation.builder().build()) + .color(0) + .reminders([]) + .recurrence("FREQ=DAILY;INTERVAL=1") + .schemas([]) + .attachments([]) + .build()) \ + .build() - # 发起请求 - response: CreateCalendarEventResponse = await client.calendar.v4.calendar_event.acreate(request) + # 发起请求 + response: CreateCalendarEventResponse = await client.calendar.v4.calendar_event.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_calendar_sample.py b/samples/api/calendar/v4/create_calendar_sample.py index 2e10cf70b..781c2b84c 100644 --- a/samples/api/calendar/v4/create_calendar_sample.py +++ b/samples/api/calendar/v4/create_calendar_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarRequest = CreateCalendarRequest.builder() \ - .request_body(Calendar.builder() - .summary("summary") - .description("description") - .permissions("private") - .color(11034625) - .summary_alias("xxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarRequest = CreateCalendarRequest.builder() \ + .request_body(Calendar.builder() + .summary("summary") + .description("description") + .permissions("private") + .color(11034625) + .summary_alias("xxx") + .build()) \ + .build() - # 发起请求 - response: CreateCalendarResponse = client.calendar.v4.calendar.create(request) + # 发起请求 + response: CreateCalendarResponse = client.calendar.v4.calendar.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCalendarRequest = CreateCalendarRequest.builder() \ - .request_body(Calendar.builder() - .summary("summary") - .description("description") - .permissions("private") - .color(11034625) - .summary_alias("xxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateCalendarRequest = CreateCalendarRequest.builder() \ + .request_body(Calendar.builder() + .summary("summary") + .description("description") + .permissions("private") + .color(11034625) + .summary_alias("xxx") + .build()) \ + .build() - # 发起请求 - response: CreateCalendarResponse = await client.calendar.v4.calendar.acreate(request) + # 发起请求 + response: CreateCalendarResponse = await client.calendar.v4.calendar.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_exchange_binding_sample.py b/samples/api/calendar/v4/create_exchange_binding_sample.py index ec8c7245b..02fb8f08d 100644 --- a/samples/api/calendar/v4/create_exchange_binding_sample.py +++ b/samples/api/calendar/v4/create_exchange_binding_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExchangeBindingRequest = CreateExchangeBindingRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ExchangeBinding.builder() - .admin_account("email_admin_example@outlook.com") - .exchange_account("email_account_example@outlook.com") - .user_id("ou_xxxxxxxxxxxxxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateExchangeBindingRequest = CreateExchangeBindingRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ExchangeBinding.builder() + .admin_account("email_admin_example@outlook.com") + .exchange_account("email_account_example@outlook.com") + .user_id("ou_xxxxxxxxxxxxxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateExchangeBindingResponse = client.calendar.v4.exchange_binding.create(request) + # 发起请求 + response: CreateExchangeBindingResponse = client.calendar.v4.exchange_binding.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExchangeBindingRequest = CreateExchangeBindingRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ExchangeBinding.builder() - .admin_account("email_admin_example@outlook.com") - .exchange_account("email_account_example@outlook.com") - .user_id("ou_xxxxxxxxxxxxxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateExchangeBindingRequest = CreateExchangeBindingRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ExchangeBinding.builder() + .admin_account("email_admin_example@outlook.com") + .exchange_account("email_account_example@outlook.com") + .user_id("ou_xxxxxxxxxxxxxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateExchangeBindingResponse = await client.calendar.v4.exchange_binding.acreate(request) + # 发起请求 + response: CreateExchangeBindingResponse = await client.calendar.v4.exchange_binding.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/create_timeoff_event_sample.py b/samples/api/calendar/v4/create_timeoff_event_sample.py index 2d18535c9..c433ae5be 100644 --- a/samples/api/calendar/v4/create_timeoff_event_sample.py +++ b/samples/api/calendar/v4/create_timeoff_event_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTimeoffEventRequest = CreateTimeoffEventRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TimeoffEvent.builder() - .user_id("ou_XXXXXXXXXX") - .timezone("Asia/Shanghai") - .start_time("2021-01-01") - .end_time("2021-01-02") - .title("请假日程标题") - .description("请假日程描述") - .build()) \ - .build() + # 构造请求对象 + request: CreateTimeoffEventRequest = CreateTimeoffEventRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TimeoffEvent.builder() + .user_id("ou_XXXXXXXXXX") + .timezone("Asia/Shanghai") + .start_time("2021-01-01") + .end_time("2021-01-02") + .title("请假日程标题") + .description("请假日程描述") + .build()) \ + .build() - # 发起请求 - response: CreateTimeoffEventResponse = client.calendar.v4.timeoff_event.create(request) + # 发起请求 + response: CreateTimeoffEventResponse = client.calendar.v4.timeoff_event.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.timeoff_event.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.timeoff_event.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTimeoffEventRequest = CreateTimeoffEventRequest.builder() \ - .user_id_type("user_id") \ - .request_body(TimeoffEvent.builder() - .user_id("ou_XXXXXXXXXX") - .timezone("Asia/Shanghai") - .start_time("2021-01-01") - .end_time("2021-01-02") - .title("请假日程标题") - .description("请假日程描述") - .build()) \ - .build() + # 构造请求对象 + request: CreateTimeoffEventRequest = CreateTimeoffEventRequest.builder() \ + .user_id_type("user_id") \ + .request_body(TimeoffEvent.builder() + .user_id("ou_XXXXXXXXXX") + .timezone("Asia/Shanghai") + .start_time("2021-01-01") + .end_time("2021-01-02") + .title("请假日程标题") + .description("请假日程描述") + .build()) \ + .build() - # 发起请求 - response: CreateTimeoffEventResponse = await client.calendar.v4.timeoff_event.acreate(request) + # 发起请求 + response: CreateTimeoffEventResponse = await client.calendar.v4.timeoff_event.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.timeoff_event.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.timeoff_event.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_calendar_acl_sample.py b/samples/api/calendar/v4/delete_calendar_acl_sample.py index 2abcf88c8..f017f0fb6 100644 --- a/samples/api/calendar/v4/delete_calendar_acl_sample.py +++ b/samples/api/calendar/v4/delete_calendar_acl_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarAclRequest = DeleteCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .acl_id("user_xxxxxx") \ - .build() + # 构造请求对象 + request: DeleteCalendarAclRequest = DeleteCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .acl_id("user_xxxxxx") \ + .build() - # 发起请求 - response: DeleteCalendarAclResponse = client.calendar.v4.calendar_acl.delete(request) + # 发起请求 + response: DeleteCalendarAclResponse = client.calendar.v4.calendar_acl.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarAclRequest = DeleteCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .acl_id("user_xxxxxx") \ - .build() + # 构造请求对象 + request: DeleteCalendarAclRequest = DeleteCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .acl_id("user_xxxxxx") \ + .build() - # 发起请求 - response: DeleteCalendarAclResponse = await client.calendar.v4.calendar_acl.adelete(request) + # 发起请求 + response: DeleteCalendarAclResponse = await client.calendar.v4.calendar_acl.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_calendar_event_meeting_chat_sample.py b/samples/api/calendar/v4/delete_calendar_event_meeting_chat_sample.py index aab799d10..ab8cd7ee3 100644 --- a/samples/api/calendar/v4/delete_calendar_event_meeting_chat_sample.py +++ b/samples/api/calendar/v4/delete_calendar_event_meeting_chat_sample.py @@ -5,63 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarEventMeetingChatRequest = DeleteCalendarEventMeetingChatRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .meeting_chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: DeleteCalendarEventMeetingChatRequest = DeleteCalendarEventMeetingChatRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .meeting_chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: DeleteCalendarEventMeetingChatResponse = client.calendar.v4.calendar_event_meeting_chat.delete(request) + # 发起请求 + response: DeleteCalendarEventMeetingChatResponse = client.calendar.v4.calendar_event_meeting_chat.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_chat.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_chat.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarEventMeetingChatRequest = DeleteCalendarEventMeetingChatRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .meeting_chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: DeleteCalendarEventMeetingChatRequest = DeleteCalendarEventMeetingChatRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .meeting_chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: DeleteCalendarEventMeetingChatResponse = await client.calendar.v4.calendar_event_meeting_chat.adelete( - request) + # 发起请求 + response: DeleteCalendarEventMeetingChatResponse = await client.calendar.v4.calendar_event_meeting_chat.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_meeting_chat.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_meeting_chat.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_calendar_event_sample.py b/samples/api/calendar/v4/delete_calendar_event_sample.py index d42f2828a..908f1eae8 100644 --- a/samples/api/calendar/v4/delete_calendar_event_sample.py +++ b/samples/api/calendar/v4/delete_calendar_event_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarEventRequest = DeleteCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .need_notification("true") \ - .build() + # 构造请求对象 + request: DeleteCalendarEventRequest = DeleteCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .need_notification("true") \ + .build() - # 发起请求 - response: DeleteCalendarEventResponse = client.calendar.v4.calendar_event.delete(request) + # 发起请求 + response: DeleteCalendarEventResponse = client.calendar.v4.calendar_event.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarEventRequest = DeleteCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .need_notification("true") \ - .build() + # 构造请求对象 + request: DeleteCalendarEventRequest = DeleteCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .need_notification("true") \ + .build() - # 发起请求 - response: DeleteCalendarEventResponse = await client.calendar.v4.calendar_event.adelete(request) + # 发起请求 + response: DeleteCalendarEventResponse = await client.calendar.v4.calendar_event.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_calendar_sample.py b/samples/api/calendar/v4/delete_calendar_sample.py index 75ad33085..8a0f2fa3e 100644 --- a/samples/api/calendar/v4/delete_calendar_sample.py +++ b/samples/api/calendar/v4/delete_calendar_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarRequest = DeleteCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: DeleteCalendarRequest = DeleteCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: DeleteCalendarResponse = client.calendar.v4.calendar.delete(request) + # 发起请求 + response: DeleteCalendarResponse = client.calendar.v4.calendar.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCalendarRequest = DeleteCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: DeleteCalendarRequest = DeleteCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: DeleteCalendarResponse = await client.calendar.v4.calendar.adelete(request) + # 发起请求 + response: DeleteCalendarResponse = await client.calendar.v4.calendar.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_exchange_binding_sample.py b/samples/api/calendar/v4/delete_exchange_binding_sample.py index f9f5c7f09..23521b0b9 100644 --- a/samples/api/calendar/v4/delete_exchange_binding_sample.py +++ b/samples/api/calendar/v4/delete_exchange_binding_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExchangeBindingRequest = DeleteExchangeBindingRequest.builder() \ - .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ - .build() + # 构造请求对象 + request: DeleteExchangeBindingRequest = DeleteExchangeBindingRequest.builder() \ + .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ + .build() - # 发起请求 - response: DeleteExchangeBindingResponse = client.calendar.v4.exchange_binding.delete(request) + # 发起请求 + response: DeleteExchangeBindingResponse = client.calendar.v4.exchange_binding.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExchangeBindingRequest = DeleteExchangeBindingRequest.builder() \ - .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ - .build() + # 构造请求对象 + request: DeleteExchangeBindingRequest = DeleteExchangeBindingRequest.builder() \ + .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ + .build() - # 发起请求 - response: DeleteExchangeBindingResponse = await client.calendar.v4.exchange_binding.adelete(request) + # 发起请求 + response: DeleteExchangeBindingResponse = await client.calendar.v4.exchange_binding.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/delete_timeoff_event_sample.py b/samples/api/calendar/v4/delete_timeoff_event_sample.py index 174c7d04e..cba9e3e83 100644 --- a/samples/api/calendar/v4/delete_timeoff_event_sample.py +++ b/samples/api/calendar/v4/delete_timeoff_event_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTimeoffEventRequest = DeleteTimeoffEventRequest.builder() \ - .timeoff_event_id("timeoff:XXXXXX-XXXX-0917-1623-aa493d591a39") \ - .build() + # 构造请求对象 + request: DeleteTimeoffEventRequest = DeleteTimeoffEventRequest.builder() \ + .timeoff_event_id("timeoff:XXXXXX-XXXX-0917-1623-aa493d591a39") \ + .build() - # 发起请求 - response: DeleteTimeoffEventResponse = client.calendar.v4.timeoff_event.delete(request) + # 发起请求 + response: DeleteTimeoffEventResponse = client.calendar.v4.timeoff_event.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.timeoff_event.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.timeoff_event.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTimeoffEventRequest = DeleteTimeoffEventRequest.builder() \ - .timeoff_event_id("timeoff:XXXXXX-XXXX-0917-1623-aa493d591a39") \ - .build() + # 构造请求对象 + request: DeleteTimeoffEventRequest = DeleteTimeoffEventRequest.builder() \ + .timeoff_event_id("timeoff:XXXXXX-XXXX-0917-1623-aa493d591a39") \ + .build() - # 发起请求 - response: DeleteTimeoffEventResponse = await client.calendar.v4.timeoff_event.adelete(request) + # 发起请求 + response: DeleteTimeoffEventResponse = await client.calendar.v4.timeoff_event.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.timeoff_event.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.timeoff_event.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/generate_caldav_conf_setting_sample.py b/samples/api/calendar/v4/generate_caldav_conf_setting_sample.py index 5fa82b064..7f9791d29 100644 --- a/samples/api/calendar/v4/generate_caldav_conf_setting_sample.py +++ b/samples/api/calendar/v4/generate_caldav_conf_setting_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GenerateCaldavConfSettingRequest = GenerateCaldavConfSettingRequest.builder() \ - .request_body(GenerateCaldavConfSettingRequestBody.builder() - .device_name("iPhone") - .build()) \ - .build() + # 构造请求对象 + request: GenerateCaldavConfSettingRequest = GenerateCaldavConfSettingRequest.builder() \ + .request_body(GenerateCaldavConfSettingRequestBody.builder() + .device_name("iPhone") + .build()) \ + .build() - # 发起请求 - response: GenerateCaldavConfSettingResponse = client.calendar.v4.setting.generate_caldav_conf(request) + # 发起请求 + response: GenerateCaldavConfSettingResponse = client.calendar.v4.setting.generate_caldav_conf(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.setting.generate_caldav_conf failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.setting.generate_caldav_conf failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GenerateCaldavConfSettingRequest = GenerateCaldavConfSettingRequest.builder() \ - .request_body(GenerateCaldavConfSettingRequestBody.builder() - .device_name("iPhone") - .build()) \ - .build() + # 构造请求对象 + request: GenerateCaldavConfSettingRequest = GenerateCaldavConfSettingRequest.builder() \ + .request_body(GenerateCaldavConfSettingRequestBody.builder() + .device_name("iPhone") + .build()) \ + .build() - # 发起请求 - response: GenerateCaldavConfSettingResponse = await client.calendar.v4.setting.agenerate_caldav_conf(request) + # 发起请求 + response: GenerateCaldavConfSettingResponse = await client.calendar.v4.setting.agenerate_caldav_conf(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.setting.agenerate_caldav_conf failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.setting.agenerate_caldav_conf failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/get_calendar_event_sample.py b/samples/api/calendar/v4/get_calendar_event_sample.py index 4fa8a8c13..a38ef9565 100644 --- a/samples/api/calendar/v4/get_calendar_event_sample.py +++ b/samples/api/calendar/v4/get_calendar_event_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCalendarEventRequest = GetCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .need_meeting_settings(False) \ - .need_attendee(False) \ - .max_attendee_num(10) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetCalendarEventRequest = GetCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .need_meeting_settings(False) \ + .need_attendee(False) \ + .max_attendee_num(10) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetCalendarEventResponse = client.calendar.v4.calendar_event.get(request) + # 发起请求 + response: GetCalendarEventResponse = client.calendar.v4.calendar_event.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCalendarEventRequest = GetCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .need_meeting_settings(False) \ - .need_attendee(False) \ - .max_attendee_num(10) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetCalendarEventRequest = GetCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .need_meeting_settings(False) \ + .need_attendee(False) \ + .max_attendee_num(10) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetCalendarEventResponse = await client.calendar.v4.calendar_event.aget(request) + # 发起请求 + response: GetCalendarEventResponse = await client.calendar.v4.calendar_event.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/get_calendar_sample.py b/samples/api/calendar/v4/get_calendar_sample.py index 3d7854931..138963b87 100644 --- a/samples/api/calendar/v4/get_calendar_sample.py +++ b/samples/api/calendar/v4/get_calendar_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCalendarRequest = GetCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: GetCalendarRequest = GetCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: GetCalendarResponse = client.calendar.v4.calendar.get(request) + # 发起请求 + response: GetCalendarResponse = client.calendar.v4.calendar.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCalendarRequest = GetCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: GetCalendarRequest = GetCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: GetCalendarResponse = await client.calendar.v4.calendar.aget(request) + # 发起请求 + response: GetCalendarResponse = await client.calendar.v4.calendar.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/get_exchange_binding_sample.py b/samples/api/calendar/v4/get_exchange_binding_sample.py index d05f0cf68..92594a754 100644 --- a/samples/api/calendar/v4/get_exchange_binding_sample.py +++ b/samples/api/calendar/v4/get_exchange_binding_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExchangeBindingRequest = GetExchangeBindingRequest.builder() \ - .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetExchangeBindingRequest = GetExchangeBindingRequest.builder() \ + .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetExchangeBindingResponse = client.calendar.v4.exchange_binding.get(request) + # 发起请求 + response: GetExchangeBindingResponse = client.calendar.v4.exchange_binding.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExchangeBindingRequest = GetExchangeBindingRequest.builder() \ - .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetExchangeBindingRequest = GetExchangeBindingRequest.builder() \ + .exchange_binding_id("ZW1haWxfYWRtaW5fZXhhbXBsZUBvdXRsb29rLmNvbSBlbWFpbF9hY2NvdW50X2V4YW1wbGVAb3V0bG9vay5jb20=") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetExchangeBindingResponse = await client.calendar.v4.exchange_binding.aget(request) + # 发起请求 + response: GetExchangeBindingResponse = await client.calendar.v4.exchange_binding.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.exchange_binding.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.exchange_binding.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/instance_view_calendar_event_sample.py b/samples/api/calendar/v4/instance_view_calendar_event_sample.py index c722ed78e..982b1e654 100644 --- a/samples/api/calendar/v4/instance_view_calendar_event_sample.py +++ b/samples/api/calendar/v4/instance_view_calendar_event_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InstanceViewCalendarEventRequest = InstanceViewCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: InstanceViewCalendarEventRequest = InstanceViewCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: InstanceViewCalendarEventResponse = client.calendar.v4.calendar_event.instance_view(request) + # 发起请求 + response: InstanceViewCalendarEventResponse = client.calendar.v4.calendar_event.instance_view(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.instance_view failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.instance_view failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InstanceViewCalendarEventRequest = InstanceViewCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: InstanceViewCalendarEventRequest = InstanceViewCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: InstanceViewCalendarEventResponse = await client.calendar.v4.calendar_event.ainstance_view(request) + # 发起请求 + response: InstanceViewCalendarEventResponse = await client.calendar.v4.calendar_event.ainstance_view(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.ainstance_view failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.ainstance_view failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/instances_calendar_event_sample.py b/samples/api/calendar/v4/instances_calendar_event_sample.py index 78b061227..dd61d5fc8 100644 --- a/samples/api/calendar/v4/instances_calendar_event_sample.py +++ b/samples/api/calendar/v4/instances_calendar_event_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InstancesCalendarEventRequest = InstancesCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .page_size(50) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: InstancesCalendarEventRequest = InstancesCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .page_size(50) \ + .page_token("str") \ + .build() - # 发起请求 - response: InstancesCalendarEventResponse = client.calendar.v4.calendar_event.instances(request) + # 发起请求 + response: InstancesCalendarEventResponse = client.calendar.v4.calendar_event.instances(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.instances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.instances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InstancesCalendarEventRequest = InstancesCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .page_size(50) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: InstancesCalendarEventRequest = InstancesCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .page_size(50) \ + .page_token("str") \ + .build() - # 发起请求 - response: InstancesCalendarEventResponse = await client.calendar.v4.calendar_event.ainstances(request) + # 发起请求 + response: InstancesCalendarEventResponse = await client.calendar.v4.calendar_event.ainstances(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.ainstances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.ainstances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_calendar_acl_sample.py b/samples/api/calendar/v4/list_calendar_acl_sample.py index 628cf2fe6..4404a2d0e 100644 --- a/samples/api/calendar/v4/list_calendar_acl_sample.py +++ b/samples/api/calendar/v4/list_calendar_acl_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarAclRequest = ListCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListCalendarAclRequest = ListCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListCalendarAclResponse = client.calendar.v4.calendar_acl.list(request) + # 发起请求 + response: ListCalendarAclResponse = client.calendar.v4.calendar_acl.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarAclRequest = ListCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListCalendarAclRequest = ListCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListCalendarAclResponse = await client.calendar.v4.calendar_acl.alist(request) + # 发起请求 + response: ListCalendarAclResponse = await client.calendar.v4.calendar_acl.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_calendar_event_attendee_chat_member_sample.py b/samples/api/calendar/v4/list_calendar_event_attendee_chat_member_sample.py index 2c2f88eff..a8d86a1c3 100644 --- a/samples/api/calendar/v4/list_calendar_event_attendee_chat_member_sample.py +++ b/samples/api/calendar/v4/list_calendar_event_attendee_chat_member_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventAttendeeChatMemberRequest = ListCalendarEventAttendeeChatMemberRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .attendee_id("chat_xxxxxx") \ - .page_token("23jhysaxxxxsysy") \ - .page_size(20) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListCalendarEventAttendeeChatMemberRequest = ListCalendarEventAttendeeChatMemberRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .attendee_id("chat_xxxxxx") \ + .page_token("23jhysaxxxxsysy") \ + .page_size(20) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListCalendarEventAttendeeChatMemberResponse = client.calendar.v4.calendar_event_attendee_chat_member.list( - request) + # 发起请求 + response: ListCalendarEventAttendeeChatMemberResponse = client.calendar.v4.calendar_event_attendee_chat_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee_chat_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee_chat_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventAttendeeChatMemberRequest = ListCalendarEventAttendeeChatMemberRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .attendee_id("chat_xxxxxx") \ - .page_token("23jhysaxxxxsysy") \ - .page_size(20) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListCalendarEventAttendeeChatMemberRequest = ListCalendarEventAttendeeChatMemberRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .attendee_id("chat_xxxxxx") \ + .page_token("23jhysaxxxxsysy") \ + .page_size(20) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListCalendarEventAttendeeChatMemberResponse = await client.calendar.v4.calendar_event_attendee_chat_member.alist( - request) + # 发起请求 + response: ListCalendarEventAttendeeChatMemberResponse = await client.calendar.v4.calendar_event_attendee_chat_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee_chat_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee_chat_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_calendar_event_attendee_sample.py b/samples/api/calendar/v4/list_calendar_event_attendee_sample.py index 124749d20..c8ca63b49 100644 --- a/samples/api/calendar/v4/list_calendar_event_attendee_sample.py +++ b/samples/api/calendar/v4/list_calendar_event_attendee_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventAttendeeRequest = ListCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .need_resource_customization(True) \ - .page_token("780TRhwXXXXX") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListCalendarEventAttendeeRequest = ListCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .need_resource_customization(True) \ + .page_token("780TRhwXXXXX") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.list(request) + # 发起请求 + response: ListCalendarEventAttendeeResponse = client.calendar.v4.calendar_event_attendee.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventAttendeeRequest = ListCalendarEventAttendeeRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("xxxxxxxxx_0") \ - .user_id_type("user_id") \ - .need_resource_customization(True) \ - .page_token("780TRhwXXXXX") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListCalendarEventAttendeeRequest = ListCalendarEventAttendeeRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("xxxxxxxxx_0") \ + .user_id_type("user_id") \ + .need_resource_customization(True) \ + .page_token("780TRhwXXXXX") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.alist(request) + # 发起请求 + response: ListCalendarEventAttendeeResponse = await client.calendar.v4.calendar_event_attendee.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event_attendee.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event_attendee.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_calendar_event_sample.py b/samples/api/calendar/v4/list_calendar_event_sample.py index 126590070..84c9530be 100644 --- a/samples/api/calendar/v4/list_calendar_event_sample.py +++ b/samples/api/calendar/v4/list_calendar_event_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventRequest = ListCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .page_size(500) \ - .anchor_time("1609430400") \ - .page_token("ListCalendarsPageToken_1632452910_1632539310") \ - .sync_token("ListCalendarsSyncToken_1632452910") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListCalendarEventRequest = ListCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .page_size(500) \ + .anchor_time("1609430400") \ + .page_token("ListCalendarsPageToken_1632452910_1632539310") \ + .sync_token("ListCalendarsSyncToken_1632452910") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListCalendarEventResponse = client.calendar.v4.calendar_event.list(request) + # 发起请求 + response: ListCalendarEventResponse = client.calendar.v4.calendar_event.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarEventRequest = ListCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .page_size(500) \ - .anchor_time("1609430400") \ - .page_token("ListCalendarsPageToken_1632452910_1632539310") \ - .sync_token("ListCalendarsSyncToken_1632452910") \ - .start_time("1631777271") \ - .end_time("1631777271") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListCalendarEventRequest = ListCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .page_size(500) \ + .anchor_time("1609430400") \ + .page_token("ListCalendarsPageToken_1632452910_1632539310") \ + .sync_token("ListCalendarsSyncToken_1632452910") \ + .start_time("1631777271") \ + .end_time("1631777271") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListCalendarEventResponse = await client.calendar.v4.calendar_event.alist(request) + # 发起请求 + response: ListCalendarEventResponse = await client.calendar.v4.calendar_event.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_calendar_sample.py b/samples/api/calendar/v4/list_calendar_sample.py index d2d8d23db..39e476cf0 100644 --- a/samples/api/calendar/v4/list_calendar_sample.py +++ b/samples/api/calendar/v4/list_calendar_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarRequest = ListCalendarRequest.builder() \ - .page_size(500) \ - .page_token("ListCalendarsPageToken_xxx") \ - .sync_token("ListCalendarsSyncToken_xxx") \ - .build() + # 构造请求对象 + request: ListCalendarRequest = ListCalendarRequest.builder() \ + .page_size(500) \ + .page_token("ListCalendarsPageToken_xxx") \ + .sync_token("ListCalendarsSyncToken_xxx") \ + .build() - # 发起请求 - response: ListCalendarResponse = client.calendar.v4.calendar.list(request) + # 发起请求 + response: ListCalendarResponse = client.calendar.v4.calendar.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCalendarRequest = ListCalendarRequest.builder() \ - .page_size(500) \ - .page_token("ListCalendarsPageToken_xxx") \ - .sync_token("ListCalendarsSyncToken_xxx") \ - .build() + # 构造请求对象 + request: ListCalendarRequest = ListCalendarRequest.builder() \ + .page_size(500) \ + .page_token("ListCalendarsPageToken_xxx") \ + .sync_token("ListCalendarsSyncToken_xxx") \ + .build() - # 发起请求 - response: ListCalendarResponse = await client.calendar.v4.calendar.alist(request) + # 发起请求 + response: ListCalendarResponse = await client.calendar.v4.calendar.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/list_freebusy_sample.py b/samples/api/calendar/v4/list_freebusy_sample.py index c023b06ea..3f92bf648 100644 --- a/samples/api/calendar/v4/list_freebusy_sample.py +++ b/samples/api/calendar/v4/list_freebusy_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFreebusyRequest = ListFreebusyRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ListFreebusyRequestBody.builder() - .time_min("2020-10-28T12:00:00+08:00") - .time_max("2020-12-28T12:00:00+08:00") - .user_id("ou_xxxxxxxxxx") - .room_id("omm_xxxxxxxxxx") - .include_external_calendar(True) - .only_busy(True) - .build()) \ - .build() + # 构造请求对象 + request: ListFreebusyRequest = ListFreebusyRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ListFreebusyRequestBody.builder() + .time_min("2020-10-28T12:00:00+08:00") + .time_max("2020-12-28T12:00:00+08:00") + .user_id("ou_xxxxxxxxxx") + .room_id("omm_xxxxxxxxxx") + .include_external_calendar(True) + .only_busy(True) + .build()) \ + .build() - # 发起请求 - response: ListFreebusyResponse = client.calendar.v4.freebusy.list(request) + # 发起请求 + response: ListFreebusyResponse = client.calendar.v4.freebusy.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.freebusy.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.freebusy.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFreebusyRequest = ListFreebusyRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ListFreebusyRequestBody.builder() - .time_min("2020-10-28T12:00:00+08:00") - .time_max("2020-12-28T12:00:00+08:00") - .user_id("ou_xxxxxxxxxx") - .room_id("omm_xxxxxxxxxx") - .include_external_calendar(True) - .only_busy(True) - .build()) \ - .build() + # 构造请求对象 + request: ListFreebusyRequest = ListFreebusyRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ListFreebusyRequestBody.builder() + .time_min("2020-10-28T12:00:00+08:00") + .time_max("2020-12-28T12:00:00+08:00") + .user_id("ou_xxxxxxxxxx") + .room_id("omm_xxxxxxxxxx") + .include_external_calendar(True) + .only_busy(True) + .build()) \ + .build() - # 发起请求 - response: ListFreebusyResponse = await client.calendar.v4.freebusy.alist(request) + # 发起请求 + response: ListFreebusyResponse = await client.calendar.v4.freebusy.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.freebusy.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.freebusy.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/patch_calendar_event_sample.py b/samples/api/calendar/v4/patch_calendar_event_sample.py index 795994f34..a26d5b249 100644 --- a/samples/api/calendar/v4/patch_calendar_event_sample.py +++ b/samples/api/calendar/v4/patch_calendar_event_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCalendarEventRequest = PatchCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("00592a0e-7edf-4678-bc9d-1b77383ef08e_0") \ - .user_id_type("user_id") \ - .request_body(CalendarEvent.builder() - .summary("日程标题") - .description("日程描述") - .need_notification(False) - .start_time(TimeInfo.builder().build()) - .end_time(TimeInfo.builder().build()) - .vchat(Vchat.builder().build()) - .visibility("default") - .attendee_ability("none") - .free_busy_status("busy") - .location(EventLocation.builder().build()) - .color(0) - .reminders([]) - .recurrence("FREQ=DAILY;INTERVAL=1") - .schemas([]) - .attachments([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCalendarEventRequest = PatchCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("00592a0e-7edf-4678-bc9d-1b77383ef08e_0") \ + .user_id_type("user_id") \ + .request_body(CalendarEvent.builder() + .summary("日程标题") + .description("日程描述") + .need_notification(False) + .start_time(TimeInfo.builder().build()) + .end_time(TimeInfo.builder().build()) + .vchat(Vchat.builder().build()) + .visibility("default") + .attendee_ability("none") + .free_busy_status("busy") + .location(EventLocation.builder().build()) + .color(0) + .reminders([]) + .recurrence("FREQ=DAILY;INTERVAL=1") + .schemas([]) + .attachments([]) + .build()) \ + .build() - # 发起请求 - response: PatchCalendarEventResponse = client.calendar.v4.calendar_event.patch(request) + # 发起请求 + response: PatchCalendarEventResponse = client.calendar.v4.calendar_event.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCalendarEventRequest = PatchCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .event_id("00592a0e-7edf-4678-bc9d-1b77383ef08e_0") \ - .user_id_type("user_id") \ - .request_body(CalendarEvent.builder() - .summary("日程标题") - .description("日程描述") - .need_notification(False) - .start_time(TimeInfo.builder().build()) - .end_time(TimeInfo.builder().build()) - .vchat(Vchat.builder().build()) - .visibility("default") - .attendee_ability("none") - .free_busy_status("busy") - .location(EventLocation.builder().build()) - .color(0) - .reminders([]) - .recurrence("FREQ=DAILY;INTERVAL=1") - .schemas([]) - .attachments([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCalendarEventRequest = PatchCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .event_id("00592a0e-7edf-4678-bc9d-1b77383ef08e_0") \ + .user_id_type("user_id") \ + .request_body(CalendarEvent.builder() + .summary("日程标题") + .description("日程描述") + .need_notification(False) + .start_time(TimeInfo.builder().build()) + .end_time(TimeInfo.builder().build()) + .vchat(Vchat.builder().build()) + .visibility("default") + .attendee_ability("none") + .free_busy_status("busy") + .location(EventLocation.builder().build()) + .color(0) + .reminders([]) + .recurrence("FREQ=DAILY;INTERVAL=1") + .schemas([]) + .attachments([]) + .build()) \ + .build() - # 发起请求 - response: PatchCalendarEventResponse = await client.calendar.v4.calendar_event.apatch(request) + # 发起请求 + response: PatchCalendarEventResponse = await client.calendar.v4.calendar_event.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/patch_calendar_sample.py b/samples/api/calendar/v4/patch_calendar_sample.py index 77479cebb..b85b799b6 100644 --- a/samples/api/calendar/v4/patch_calendar_sample.py +++ b/samples/api/calendar/v4/patch_calendar_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCalendarRequest = PatchCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .request_body(Calendar.builder() - .summary("summary") - .description("description") - .permissions("private") - .color(11034625) - .summary_alias("xxx") - .build()) \ - .build() + # 构造请求对象 + request: PatchCalendarRequest = PatchCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .request_body(Calendar.builder() + .summary("summary") + .description("description") + .permissions("private") + .color(11034625) + .summary_alias("xxx") + .build()) \ + .build() - # 发起请求 - response: PatchCalendarResponse = client.calendar.v4.calendar.patch(request) + # 发起请求 + response: PatchCalendarResponse = client.calendar.v4.calendar.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCalendarRequest = PatchCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .request_body(Calendar.builder() - .summary("summary") - .description("description") - .permissions("private") - .color(11034625) - .summary_alias("xxx") - .build()) \ - .build() + # 构造请求对象 + request: PatchCalendarRequest = PatchCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .request_body(Calendar.builder() + .summary("summary") + .description("description") + .permissions("private") + .color(11034625) + .summary_alias("xxx") + .build()) \ + .build() - # 发起请求 - response: PatchCalendarResponse = await client.calendar.v4.calendar.apatch(request) + # 发起请求 + response: PatchCalendarResponse = await client.calendar.v4.calendar.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/primary_calendar_sample.py b/samples/api/calendar/v4/primary_calendar_sample.py index 60f7d97b8..b685e4cfe 100644 --- a/samples/api/calendar/v4/primary_calendar_sample.py +++ b/samples/api/calendar/v4/primary_calendar_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PrimaryCalendarRequest = PrimaryCalendarRequest.builder() \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: PrimaryCalendarRequest = PrimaryCalendarRequest.builder() \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: PrimaryCalendarResponse = client.calendar.v4.calendar.primary(request) + # 发起请求 + response: PrimaryCalendarResponse = client.calendar.v4.calendar.primary(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.primary failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.primary failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PrimaryCalendarRequest = PrimaryCalendarRequest.builder() \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: PrimaryCalendarRequest = PrimaryCalendarRequest.builder() \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: PrimaryCalendarResponse = await client.calendar.v4.calendar.aprimary(request) + # 发起请求 + response: PrimaryCalendarResponse = await client.calendar.v4.calendar.aprimary(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.aprimary failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.aprimary failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/reply_calendar_event_sample.py b/samples/api/calendar/v4/reply_calendar_event_sample.py index fd31e4ae9..7668e3212 100644 --- a/samples/api/calendar/v4/reply_calendar_event_sample.py +++ b/samples/api/calendar/v4/reply_calendar_event_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplyCalendarEventRequest = ReplyCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .request_body(ReplyCalendarEventRequestBody.builder() - .rsvp_status("accept") - .build()) \ - .build() + # 构造请求对象 + request: ReplyCalendarEventRequest = ReplyCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .request_body(ReplyCalendarEventRequestBody.builder() + .rsvp_status("accept") + .build()) \ + .build() - # 发起请求 - response: ReplyCalendarEventResponse = client.calendar.v4.calendar_event.reply(request) + # 发起请求 + response: ReplyCalendarEventResponse = client.calendar.v4.calendar_event.reply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.reply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.reply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplyCalendarEventRequest = ReplyCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ - .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ - .request_body(ReplyCalendarEventRequestBody.builder() - .rsvp_status("accept") - .build()) \ - .build() + # 构造请求对象 + request: ReplyCalendarEventRequest = ReplyCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn") \ + .event_id("75d28f9b-e35c-4230-8a83-4a661497db54_0") \ + .request_body(ReplyCalendarEventRequestBody.builder() + .rsvp_status("accept") + .build()) \ + .build() - # 发起请求 - response: ReplyCalendarEventResponse = await client.calendar.v4.calendar_event.areply(request) + # 发起请求 + response: ReplyCalendarEventResponse = await client.calendar.v4.calendar_event.areply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.areply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.areply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/search_calendar_event_sample.py b/samples/api/calendar/v4/search_calendar_event_sample.py index a0c9a60ab..fe8e9cfa3 100644 --- a/samples/api/calendar/v4/search_calendar_event_sample.py +++ b/samples/api/calendar/v4/search_calendar_event_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCalendarEventRequest = SearchCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .page_token("xxxxx") \ - .page_size(20) \ - .request_body(SearchCalendarEventRequestBody.builder() - .query("query words") - .filter(EventSearchFilter.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SearchCalendarEventRequest = SearchCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .page_token("xxxxx") \ + .page_size(20) \ + .request_body(SearchCalendarEventRequestBody.builder() + .query("query words") + .filter(EventSearchFilter.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SearchCalendarEventResponse = client.calendar.v4.calendar_event.search(request) + # 发起请求 + response: SearchCalendarEventResponse = client.calendar.v4.calendar_event.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCalendarEventRequest = SearchCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .user_id_type("user_id") \ - .page_token("xxxxx") \ - .page_size(20) \ - .request_body(SearchCalendarEventRequestBody.builder() - .query("query words") - .filter(EventSearchFilter.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SearchCalendarEventRequest = SearchCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .user_id_type("user_id") \ + .page_token("xxxxx") \ + .page_size(20) \ + .request_body(SearchCalendarEventRequestBody.builder() + .query("query words") + .filter(EventSearchFilter.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SearchCalendarEventResponse = await client.calendar.v4.calendar_event.asearch(request) + # 发起请求 + response: SearchCalendarEventResponse = await client.calendar.v4.calendar_event.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/search_calendar_sample.py b/samples/api/calendar/v4/search_calendar_sample.py index 5919f6f51..1fe9872d6 100644 --- a/samples/api/calendar/v4/search_calendar_sample.py +++ b/samples/api/calendar/v4/search_calendar_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCalendarRequest = SearchCalendarRequest.builder() \ - .page_token("10") \ - .page_size(20) \ - .request_body(SearchCalendarRequestBody.builder() - .query("query words") - .build()) \ - .build() + # 构造请求对象 + request: SearchCalendarRequest = SearchCalendarRequest.builder() \ + .page_token("10") \ + .page_size(20) \ + .request_body(SearchCalendarRequestBody.builder() + .query("query words") + .build()) \ + .build() - # 发起请求 - response: SearchCalendarResponse = client.calendar.v4.calendar.search(request) + # 发起请求 + response: SearchCalendarResponse = client.calendar.v4.calendar.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCalendarRequest = SearchCalendarRequest.builder() \ - .page_token("10") \ - .page_size(20) \ - .request_body(SearchCalendarRequestBody.builder() - .query("query words") - .build()) \ - .build() + # 构造请求对象 + request: SearchCalendarRequest = SearchCalendarRequest.builder() \ + .page_token("10") \ + .page_size(20) \ + .request_body(SearchCalendarRequestBody.builder() + .query("query words") + .build()) \ + .build() - # 发起请求 - response: SearchCalendarResponse = await client.calendar.v4.calendar.asearch(request) + # 发起请求 + response: SearchCalendarResponse = await client.calendar.v4.calendar.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/subscribe_calendar_sample.py b/samples/api/calendar/v4/subscribe_calendar_sample.py index e5f72c5e7..1699cc131 100644 --- a/samples/api/calendar/v4/subscribe_calendar_sample.py +++ b/samples/api/calendar/v4/subscribe_calendar_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeCalendarRequest = SubscribeCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscribeCalendarRequest = SubscribeCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscribeCalendarResponse = client.calendar.v4.calendar.subscribe(request) + # 发起请求 + response: SubscribeCalendarResponse = client.calendar.v4.calendar.subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeCalendarRequest = SubscribeCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscribeCalendarRequest = SubscribeCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscribeCalendarResponse = await client.calendar.v4.calendar.asubscribe(request) + # 发起请求 + response: SubscribeCalendarResponse = await client.calendar.v4.calendar.asubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/subscription_calendar_acl_sample.py b/samples/api/calendar/v4/subscription_calendar_acl_sample.py index 8ef0475d3..fb9d048e2 100644 --- a/samples/api/calendar/v4/subscription_calendar_acl_sample.py +++ b/samples/api/calendar/v4/subscription_calendar_acl_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarAclRequest = SubscriptionCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscriptionCalendarAclRequest = SubscriptionCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscriptionCalendarAclResponse = client.calendar.v4.calendar_acl.subscription(request) + # 发起请求 + response: SubscriptionCalendarAclResponse = client.calendar.v4.calendar_acl.subscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarAclRequest = SubscriptionCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscriptionCalendarAclRequest = SubscriptionCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscriptionCalendarAclResponse = await client.calendar.v4.calendar_acl.asubscription(request) + # 发起请求 + response: SubscriptionCalendarAclResponse = await client.calendar.v4.calendar_acl.asubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/subscription_calendar_event_sample.py b/samples/api/calendar/v4/subscription_calendar_event_sample.py index 50d1f2a01..e4234f516 100644 --- a/samples/api/calendar/v4/subscription_calendar_event_sample.py +++ b/samples/api/calendar/v4/subscription_calendar_event_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarEventRequest = SubscriptionCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscriptionCalendarEventRequest = SubscriptionCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscriptionCalendarEventResponse = client.calendar.v4.calendar_event.subscription(request) + # 发起请求 + response: SubscriptionCalendarEventResponse = client.calendar.v4.calendar_event.subscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarEventRequest = SubscriptionCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: SubscriptionCalendarEventRequest = SubscriptionCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: SubscriptionCalendarEventResponse = await client.calendar.v4.calendar_event.asubscription(request) + # 发起请求 + response: SubscriptionCalendarEventResponse = await client.calendar.v4.calendar_event.asubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/subscription_calendar_sample.py b/samples/api/calendar/v4/subscription_calendar_sample.py index b61233b48..5766c5ff9 100644 --- a/samples/api/calendar/v4/subscription_calendar_sample.py +++ b/samples/api/calendar/v4/subscription_calendar_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarRequest = SubscriptionCalendarRequest.builder() \ - .build() + # 构造请求对象 + request: SubscriptionCalendarRequest = SubscriptionCalendarRequest.builder() \ + .build() - # 发起请求 - response: SubscriptionCalendarResponse = client.calendar.v4.calendar.subscription(request) + # 发起请求 + response: SubscriptionCalendarResponse = client.calendar.v4.calendar.subscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.subscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscriptionCalendarRequest = SubscriptionCalendarRequest.builder() \ - .build() + # 构造请求对象 + request: SubscriptionCalendarRequest = SubscriptionCalendarRequest.builder() \ + .build() - # 发起请求 - response: SubscriptionCalendarResponse = await client.calendar.v4.calendar.asubscription(request) + # 发起请求 + response: SubscriptionCalendarResponse = await client.calendar.v4.calendar.asubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.asubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/unsubscribe_calendar_sample.py b/samples/api/calendar/v4/unsubscribe_calendar_sample.py index 0123da4c1..b06cbea6a 100644 --- a/samples/api/calendar/v4/unsubscribe_calendar_sample.py +++ b/samples/api/calendar/v4/unsubscribe_calendar_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeCalendarRequest = UnsubscribeCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscribeCalendarRequest = UnsubscribeCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscribeCalendarResponse = client.calendar.v4.calendar.unsubscribe(request) + # 发起请求 + response: UnsubscribeCalendarResponse = client.calendar.v4.calendar.unsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeCalendarRequest = UnsubscribeCalendarRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscribeCalendarRequest = UnsubscribeCalendarRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscribeCalendarResponse = await client.calendar.v4.calendar.aunsubscribe(request) + # 发起请求 + response: UnsubscribeCalendarResponse = await client.calendar.v4.calendar.aunsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/unsubscription_calendar_acl_sample.py b/samples/api/calendar/v4/unsubscription_calendar_acl_sample.py index 46d3d6ef1..7ac2b3b8b 100644 --- a/samples/api/calendar/v4/unsubscription_calendar_acl_sample.py +++ b/samples/api/calendar/v4/unsubscription_calendar_acl_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarAclRequest = UnsubscriptionCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarAclRequest = UnsubscriptionCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscriptionCalendarAclResponse = client.calendar.v4.calendar_acl.unsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarAclResponse = client.calendar.v4.calendar_acl.unsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarAclRequest = UnsubscriptionCalendarAclRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarAclRequest = UnsubscriptionCalendarAclRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscriptionCalendarAclResponse = await client.calendar.v4.calendar_acl.aunsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarAclResponse = await client.calendar.v4.calendar_acl.aunsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_acl.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_acl.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/unsubscription_calendar_event_sample.py b/samples/api/calendar/v4/unsubscription_calendar_event_sample.py index 8e027f77a..3e47f4ccb 100644 --- a/samples/api/calendar/v4/unsubscription_calendar_event_sample.py +++ b/samples/api/calendar/v4/unsubscription_calendar_event_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarEventRequest = UnsubscriptionCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarEventRequest = UnsubscriptionCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscriptionCalendarEventResponse = client.calendar.v4.calendar_event.unsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarEventResponse = client.calendar.v4.calendar_event.unsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarEventRequest = UnsubscriptionCalendarEventRequest.builder() \ - .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarEventRequest = UnsubscriptionCalendarEventRequest.builder() \ + .calendar_id("feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn") \ + .build() - # 发起请求 - response: UnsubscriptionCalendarEventResponse = await client.calendar.v4.calendar_event.aunsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarEventResponse = await client.calendar.v4.calendar_event.aunsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar_event.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar_event.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/calendar/v4/unsubscription_calendar_sample.py b/samples/api/calendar/v4/unsubscription_calendar_sample.py index e0411508f..bd3df98ad 100644 --- a/samples/api/calendar/v4/unsubscription_calendar_sample.py +++ b/samples/api/calendar/v4/unsubscription_calendar_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarRequest = UnsubscriptionCalendarRequest.builder() \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarRequest = UnsubscriptionCalendarRequest.builder() \ + .build() - # 发起请求 - response: UnsubscriptionCalendarResponse = client.calendar.v4.calendar.unsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarResponse = client.calendar.v4.calendar.unsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.unsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscriptionCalendarRequest = UnsubscriptionCalendarRequest.builder() \ - .build() + # 构造请求对象 + request: UnsubscriptionCalendarRequest = UnsubscriptionCalendarRequest.builder() \ + .build() - # 发起请求 - response: UnsubscriptionCalendarResponse = await client.calendar.v4.calendar.aunsubscription(request) + # 发起请求 + response: UnsubscriptionCalendarResponse = await client.calendar.v4.calendar.aunsubscription(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.calendar.v4.calendar.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.calendar.v4.calendar.aunsubscription failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/list_change_reason_sample.py b/samples/api/compensation/v1/list_change_reason_sample.py index 73f487d32..c528ca151 100644 --- a/samples/api/compensation/v1/list_change_reason_sample.py +++ b/samples/api/compensation/v1/list_change_reason_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListChangeReasonRequest = ListChangeReasonRequest.builder() \ - .page_size(100) \ - .page_token("12314342") \ - .build() + # 构造请求对象 + request: ListChangeReasonRequest = ListChangeReasonRequest.builder() \ + .page_size(100) \ + .page_token("12314342") \ + .build() - # 发起请求 - response: ListChangeReasonResponse = client.compensation.v1.change_reason.list(request) + # 发起请求 + response: ListChangeReasonResponse = client.compensation.v1.change_reason.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.change_reason.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.change_reason.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListChangeReasonRequest = ListChangeReasonRequest.builder() \ - .page_size(100) \ - .page_token("12314342") \ - .build() + # 构造请求对象 + request: ListChangeReasonRequest = ListChangeReasonRequest.builder() \ + .page_size(100) \ + .page_token("12314342") \ + .build() - # 发起请求 - response: ListChangeReasonResponse = await client.compensation.v1.change_reason.alist(request) + # 发起请求 + response: ListChangeReasonResponse = await client.compensation.v1.change_reason.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.change_reason.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.change_reason.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/list_indicator_sample.py b/samples/api/compensation/v1/list_indicator_sample.py index 8ce3d22b3..be023f614 100644 --- a/samples/api/compensation/v1/list_indicator_sample.py +++ b/samples/api/compensation/v1/list_indicator_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListIndicatorRequest = ListIndicatorRequest.builder() \ - .page_size(100) \ - .page_token("123423321") \ - .build() + # 构造请求对象 + request: ListIndicatorRequest = ListIndicatorRequest.builder() \ + .page_size(100) \ + .page_token("123423321") \ + .build() - # 发起请求 - response: ListIndicatorResponse = client.compensation.v1.indicator.list(request) + # 发起请求 + response: ListIndicatorResponse = client.compensation.v1.indicator.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.indicator.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.indicator.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListIndicatorRequest = ListIndicatorRequest.builder() \ - .page_size(100) \ - .page_token("123423321") \ - .build() + # 构造请求对象 + request: ListIndicatorRequest = ListIndicatorRequest.builder() \ + .page_size(100) \ + .page_token("123423321") \ + .build() - # 发起请求 - response: ListIndicatorResponse = await client.compensation.v1.indicator.alist(request) + # 发起请求 + response: ListIndicatorResponse = await client.compensation.v1.indicator.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.indicator.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.indicator.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/list_item_category_sample.py b/samples/api/compensation/v1/list_item_category_sample.py index 4f98c0182..cd5492b16 100644 --- a/samples/api/compensation/v1/list_item_category_sample.py +++ b/samples/api/compensation/v1/list_item_category_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListItemCategoryRequest = ListItemCategoryRequest.builder() \ - .page_size(100) \ - .page_token("231412341234") \ - .build() + # 构造请求对象 + request: ListItemCategoryRequest = ListItemCategoryRequest.builder() \ + .page_size(100) \ + .page_token("231412341234") \ + .build() - # 发起请求 - response: ListItemCategoryResponse = client.compensation.v1.item_category.list(request) + # 发起请求 + response: ListItemCategoryResponse = client.compensation.v1.item_category.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.item_category.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.item_category.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListItemCategoryRequest = ListItemCategoryRequest.builder() \ - .page_size(100) \ - .page_token("231412341234") \ - .build() + # 构造请求对象 + request: ListItemCategoryRequest = ListItemCategoryRequest.builder() \ + .page_size(100) \ + .page_token("231412341234") \ + .build() - # 发起请求 - response: ListItemCategoryResponse = await client.compensation.v1.item_category.alist(request) + # 发起请求 + response: ListItemCategoryResponse = await client.compensation.v1.item_category.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.item_category.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.item_category.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/list_item_sample.py b/samples/api/compensation/v1/list_item_sample.py index 8672ff956..e6dbd7a32 100644 --- a/samples/api/compensation/v1/list_item_sample.py +++ b/samples/api/compensation/v1/list_item_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListItemRequest = ListItemRequest.builder() \ - .page_size(100) \ - .page_token("5234233214") \ - .build() + # 构造请求对象 + request: ListItemRequest = ListItemRequest.builder() \ + .page_size(100) \ + .page_token("5234233214") \ + .build() - # 发起请求 - response: ListItemResponse = client.compensation.v1.item.list(request) + # 发起请求 + response: ListItemResponse = client.compensation.v1.item.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.item.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.item.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListItemRequest = ListItemRequest.builder() \ - .page_size(100) \ - .page_token("5234233214") \ - .build() + # 构造请求对象 + request: ListItemRequest = ListItemRequest.builder() \ + .page_size(100) \ + .page_token("5234233214") \ + .build() - # 发起请求 - response: ListItemResponse = await client.compensation.v1.item.alist(request) + # 发起请求 + response: ListItemResponse = await client.compensation.v1.item.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.item.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.item.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/list_plan_sample.py b/samples/api/compensation/v1/list_plan_sample.py index 34d71f2d8..fb07e9c32 100644 --- a/samples/api/compensation/v1/list_plan_sample.py +++ b/samples/api/compensation/v1/list_plan_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPlanRequest = ListPlanRequest.builder() \ - .page_size(100) \ - .page_token("213432123") \ - .build() + # 构造请求对象 + request: ListPlanRequest = ListPlanRequest.builder() \ + .page_size(100) \ + .page_token("213432123") \ + .build() - # 发起请求 - response: ListPlanResponse = client.compensation.v1.plan.list(request) + # 发起请求 + response: ListPlanResponse = client.compensation.v1.plan.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.plan.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.plan.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPlanRequest = ListPlanRequest.builder() \ - .page_size(100) \ - .page_token("213432123") \ - .build() + # 构造请求对象 + request: ListPlanRequest = ListPlanRequest.builder() \ + .page_size(100) \ + .page_token("213432123") \ + .build() - # 发起请求 - response: ListPlanResponse = await client.compensation.v1.plan.alist(request) + # 发起请求 + response: ListPlanResponse = await client.compensation.v1.plan.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.plan.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.plan.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/compensation/v1/query_archive_sample.py b/samples/api/compensation/v1/query_archive_sample.py index b3e3d2cee..d1ca7e448 100644 --- a/samples/api/compensation/v1/query_archive_sample.py +++ b/samples/api/compensation/v1/query_archive_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryArchiveRequest = QueryArchiveRequest.builder() \ - .page_size(100) \ - .page_token("231432433") \ - .user_id_type("open_id") \ - .request_body(QueryArchiveRequestBody.builder() - .user_id_list([]) - .effective_start_date("2022-05-10") - .effective_end_date("2023-05-15") - .build()) \ - .build() + # 构造请求对象 + request: QueryArchiveRequest = QueryArchiveRequest.builder() \ + .page_size(100) \ + .page_token("231432433") \ + .user_id_type("open_id") \ + .request_body(QueryArchiveRequestBody.builder() + .user_id_list([]) + .effective_start_date("2022-05-10") + .effective_end_date("2023-05-15") + .build()) \ + .build() - # 发起请求 - response: QueryArchiveResponse = client.compensation.v1.archive.query(request) + # 发起请求 + response: QueryArchiveResponse = client.compensation.v1.archive.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.archive.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.archive.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryArchiveRequest = QueryArchiveRequest.builder() \ - .page_size(100) \ - .page_token("231432433") \ - .user_id_type("open_id") \ - .request_body(QueryArchiveRequestBody.builder() - .user_id_list([]) - .effective_start_date("2022-05-10") - .effective_end_date("2023-05-15") - .build()) \ - .build() + # 构造请求对象 + request: QueryArchiveRequest = QueryArchiveRequest.builder() \ + .page_size(100) \ + .page_token("231432433") \ + .user_id_type("open_id") \ + .request_body(QueryArchiveRequestBody.builder() + .user_id_list([]) + .effective_start_date("2022-05-10") + .effective_end_date("2023-05-15") + .build()) \ + .build() - # 发起请求 - response: QueryArchiveResponse = await client.compensation.v1.archive.aquery(request) + # 发起请求 + response: QueryArchiveResponse = await client.compensation.v1.archive.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.compensation.v1.archive.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.compensation.v1.archive.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/add_group_member_sample.py b/samples/api/contact/v3/add_group_member_sample.py index cb83adfbc..bfeaad12f 100644 --- a/samples/api/contact/v3/add_group_member_sample.py +++ b/samples/api/contact/v3/add_group_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddGroupMemberRequest = AddGroupMemberRequest.builder() \ - .group_id("g281721") \ - .request_body(AddGroupMemberRequestBody.builder() - .member_type("user") - .member_id_type("open_id") - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .build()) \ - .build() + # 构造请求对象 + request: AddGroupMemberRequest = AddGroupMemberRequest.builder() \ + .group_id("g281721") \ + .request_body(AddGroupMemberRequestBody.builder() + .member_type("user") + .member_id_type("open_id") + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .build()) \ + .build() - # 发起请求 - response: AddGroupMemberResponse = client.contact.v3.group_member.add(request) + # 发起请求 + response: AddGroupMemberResponse = client.contact.v3.group_member.add(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddGroupMemberRequest = AddGroupMemberRequest.builder() \ - .group_id("g281721") \ - .request_body(AddGroupMemberRequestBody.builder() - .member_type("user") - .member_id_type("open_id") - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .build()) \ - .build() + # 构造请求对象 + request: AddGroupMemberRequest = AddGroupMemberRequest.builder() \ + .group_id("g281721") \ + .request_body(AddGroupMemberRequestBody.builder() + .member_type("user") + .member_id_type("open_id") + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .build()) \ + .build() - # 发起请求 - response: AddGroupMemberResponse = await client.contact.v3.group_member.aadd(request) + # 发起请求 + response: AddGroupMemberResponse = await client.contact.v3.group_member.aadd(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.aadd failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.aadd failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_add_group_member_sample.py b/samples/api/contact/v3/batch_add_group_member_sample.py index 5165ec0a3..66413788e 100644 --- a/samples/api/contact/v3/batch_add_group_member_sample.py +++ b/samples/api/contact/v3/batch_add_group_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchAddGroupMemberRequest = BatchAddGroupMemberRequest.builder() \ - .group_id("test_group") \ - .request_body(BatchAddGroupMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchAddGroupMemberRequest = BatchAddGroupMemberRequest.builder() \ + .group_id("test_group") \ + .request_body(BatchAddGroupMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchAddGroupMemberResponse = client.contact.v3.group_member.batch_add(request) + # 发起请求 + response: BatchAddGroupMemberResponse = client.contact.v3.group_member.batch_add(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.batch_add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.batch_add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchAddGroupMemberRequest = BatchAddGroupMemberRequest.builder() \ - .group_id("test_group") \ - .request_body(BatchAddGroupMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchAddGroupMemberRequest = BatchAddGroupMemberRequest.builder() \ + .group_id("test_group") \ + .request_body(BatchAddGroupMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchAddGroupMemberResponse = await client.contact.v3.group_member.abatch_add(request) + # 发起请求 + response: BatchAddGroupMemberResponse = await client.contact.v3.group_member.abatch_add(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.abatch_add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.abatch_add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_create_functional_role_member_sample.py b/samples/api/contact/v3/batch_create_functional_role_member_sample.py index eeb77e3c6..b02676c60 100644 --- a/samples/api/contact/v3/batch_create_functional_role_member_sample.py +++ b/samples/api/contact/v3/batch_create_functional_role_member_sample.py @@ -5,67 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateFunctionalRoleMemberRequest = BatchCreateFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .request_body(BatchCreateFunctionalRoleMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateFunctionalRoleMemberRequest = BatchCreateFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .request_body(BatchCreateFunctionalRoleMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.batch_create(request) + # 发起请求 + response: BatchCreateFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateFunctionalRoleMemberRequest = BatchCreateFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .request_body(BatchCreateFunctionalRoleMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateFunctionalRoleMemberRequest = BatchCreateFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .request_body(BatchCreateFunctionalRoleMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.abatch_create( - request) + # 发起请求 + response: BatchCreateFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_delete_functional_role_member_sample.py b/samples/api/contact/v3/batch_delete_functional_role_member_sample.py index 01d2ed9e1..683e2f8df 100644 --- a/samples/api/contact/v3/batch_delete_functional_role_member_sample.py +++ b/samples/api/contact/v3/batch_delete_functional_role_member_sample.py @@ -5,67 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteFunctionalRoleMemberRequest = BatchDeleteFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .request_body(BatchDeleteFunctionalRoleMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteFunctionalRoleMemberRequest = BatchDeleteFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .request_body(BatchDeleteFunctionalRoleMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.batch_delete(request) + # 发起请求 + response: BatchDeleteFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteFunctionalRoleMemberRequest = BatchDeleteFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .request_body(BatchDeleteFunctionalRoleMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteFunctionalRoleMemberRequest = BatchDeleteFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .request_body(BatchDeleteFunctionalRoleMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.abatch_delete( - request) + # 发起请求 + response: BatchDeleteFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_department_sample.py b/samples/api/contact/v3/batch_department_sample.py index f45aef3f8..b5df30875 100644 --- a/samples/api/contact/v3/batch_department_sample.py +++ b/samples/api/contact/v3/batch_department_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDepartmentRequest = BatchDepartmentRequest.builder() \ - .department_ids([]) \ - .department_id_type("open_department_id") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: BatchDepartmentRequest = BatchDepartmentRequest.builder() \ + .department_ids([]) \ + .department_id_type("open_department_id") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: BatchDepartmentResponse = client.contact.v3.department.batch(request) + # 发起请求 + response: BatchDepartmentResponse = client.contact.v3.department.batch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.batch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.batch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDepartmentRequest = BatchDepartmentRequest.builder() \ - .department_ids([]) \ - .department_id_type("open_department_id") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: BatchDepartmentRequest = BatchDepartmentRequest.builder() \ + .department_ids([]) \ + .department_id_type("open_department_id") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: BatchDepartmentResponse = await client.contact.v3.department.abatch(request) + # 发起请求 + response: BatchDepartmentResponse = await client.contact.v3.department.abatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.abatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.abatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_get_id_user_sample.py b/samples/api/contact/v3/batch_get_id_user_sample.py index 7542ed492..92a071371 100644 --- a/samples/api/contact/v3/batch_get_id_user_sample.py +++ b/samples/api/contact/v3/batch_get_id_user_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetIdUserRequest = BatchGetIdUserRequest.builder() \ - .user_id_type("open_id") \ - .request_body(BatchGetIdUserRequestBody.builder() - .emails([]) - .mobiles([]) - .include_resigned(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetIdUserRequest = BatchGetIdUserRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BatchGetIdUserRequestBody.builder() + .emails([]) + .mobiles([]) + .include_resigned(False) + .build()) \ + .build() - # 发起请求 - response: BatchGetIdUserResponse = client.contact.v3.user.batch_get_id(request) + # 发起请求 + response: BatchGetIdUserResponse = client.contact.v3.user.batch_get_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.batch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.batch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetIdUserRequest = BatchGetIdUserRequest.builder() \ - .user_id_type("open_id") \ - .request_body(BatchGetIdUserRequestBody.builder() - .emails([]) - .mobiles([]) - .include_resigned(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetIdUserRequest = BatchGetIdUserRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BatchGetIdUserRequestBody.builder() + .emails([]) + .mobiles([]) + .include_resigned(False) + .build()) \ + .build() - # 发起请求 - response: BatchGetIdUserResponse = await client.contact.v3.user.abatch_get_id(request) + # 发起请求 + response: BatchGetIdUserResponse = await client.contact.v3.user.abatch_get_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.abatch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.abatch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_remove_group_member_sample.py b/samples/api/contact/v3/batch_remove_group_member_sample.py index 23709ddaf..4081cf3c2 100644 --- a/samples/api/contact/v3/batch_remove_group_member_sample.py +++ b/samples/api/contact/v3/batch_remove_group_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchRemoveGroupMemberRequest = BatchRemoveGroupMemberRequest.builder() \ - .group_id("test_group") \ - .request_body(BatchRemoveGroupMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchRemoveGroupMemberRequest = BatchRemoveGroupMemberRequest.builder() \ + .group_id("test_group") \ + .request_body(BatchRemoveGroupMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchRemoveGroupMemberResponse = client.contact.v3.group_member.batch_remove(request) + # 发起请求 + response: BatchRemoveGroupMemberResponse = client.contact.v3.group_member.batch_remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.batch_remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.batch_remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchRemoveGroupMemberRequest = BatchRemoveGroupMemberRequest.builder() \ - .group_id("test_group") \ - .request_body(BatchRemoveGroupMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchRemoveGroupMemberRequest = BatchRemoveGroupMemberRequest.builder() \ + .group_id("test_group") \ + .request_body(BatchRemoveGroupMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchRemoveGroupMemberResponse = await client.contact.v3.group_member.abatch_remove(request) + # 发起请求 + response: BatchRemoveGroupMemberResponse = await client.contact.v3.group_member.abatch_remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.abatch_remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.abatch_remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/batch_user_sample.py b/samples/api/contact/v3/batch_user_sample.py index 604146a97..27597c60a 100644 --- a/samples/api/contact/v3/batch_user_sample.py +++ b/samples/api/contact/v3/batch_user_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUserRequest = BatchUserRequest.builder() \ - .user_ids([]) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: BatchUserRequest = BatchUserRequest.builder() \ + .user_ids([]) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: BatchUserResponse = client.contact.v3.user.batch(request) + # 发起请求 + response: BatchUserResponse = client.contact.v3.user.batch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.batch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.batch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUserRequest = BatchUserRequest.builder() \ - .user_ids([]) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: BatchUserRequest = BatchUserRequest.builder() \ + .user_ids([]) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: BatchUserResponse = await client.contact.v3.user.abatch(request) + # 发起请求 + response: BatchUserResponse = await client.contact.v3.user.abatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.abatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.abatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/bind_department_unit_sample.py b/samples/api/contact/v3/bind_department_unit_sample.py index 3cc42b025..98b77c35b 100644 --- a/samples/api/contact/v3/bind_department_unit_sample.py +++ b/samples/api/contact/v3/bind_department_unit_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BindDepartmentUnitRequest = BindDepartmentUnitRequest.builder() \ - .request_body(BindDepartmentUnitRequestBody.builder() - .unit_id("BU121") - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .department_id_type("open_department_id") - .build()) \ - .build() + # 构造请求对象 + request: BindDepartmentUnitRequest = BindDepartmentUnitRequest.builder() \ + .request_body(BindDepartmentUnitRequestBody.builder() + .unit_id("BU121") + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .department_id_type("open_department_id") + .build()) \ + .build() - # 发起请求 - response: BindDepartmentUnitResponse = client.contact.v3.unit.bind_department(request) + # 发起请求 + response: BindDepartmentUnitResponse = client.contact.v3.unit.bind_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.bind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.bind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BindDepartmentUnitRequest = BindDepartmentUnitRequest.builder() \ - .request_body(BindDepartmentUnitRequestBody.builder() - .unit_id("BU121") - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .department_id_type("open_department_id") - .build()) \ - .build() + # 构造请求对象 + request: BindDepartmentUnitRequest = BindDepartmentUnitRequest.builder() \ + .request_body(BindDepartmentUnitRequestBody.builder() + .unit_id("BU121") + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .department_id_type("open_department_id") + .build()) \ + .build() - # 发起请求 - response: BindDepartmentUnitResponse = await client.contact.v3.unit.abind_department(request) + # 发起请求 + response: BindDepartmentUnitResponse = await client.contact.v3.unit.abind_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.abind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.abind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/children_department_sample.py b/samples/api/contact/v3/children_department_sample.py index d9d367657..408a745ce 100644 --- a/samples/api/contact/v3/children_department_sample.py +++ b/samples/api/contact/v3/children_department_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ChildrenDepartmentRequest = ChildrenDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .fetch_child(False) \ - .page_size(10) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .build() + # 构造请求对象 + request: ChildrenDepartmentRequest = ChildrenDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .fetch_child(False) \ + .page_size(10) \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .build() - # 发起请求 - response: ChildrenDepartmentResponse = client.contact.v3.department.children(request) + # 发起请求 + response: ChildrenDepartmentResponse = client.contact.v3.department.children(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.children failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.children failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ChildrenDepartmentRequest = ChildrenDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .fetch_child(False) \ - .page_size(10) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .build() + # 构造请求对象 + request: ChildrenDepartmentRequest = ChildrenDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .fetch_child(False) \ + .page_size(10) \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .build() - # 发起请求 - response: ChildrenDepartmentResponse = await client.contact.v3.department.achildren(request) + # 发起请求 + response: ChildrenDepartmentResponse = await client.contact.v3.department.achildren(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.achildren failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.achildren failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_department_sample.py b/samples/api/contact/v3/create_department_sample.py index 1ffb8fd4f..446a2895b 100644 --- a/samples/api/contact/v3/create_department_sample.py +++ b/samples/api/contact/v3/create_department_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .client_token("473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .department_id("str") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .department_hrbps([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .client_token("473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .department_id("str") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .department_hrbps([]) + .build()) \ + .build() - # 发起请求 - response: CreateDepartmentResponse = client.contact.v3.department.create(request) + # 发起请求 + response: CreateDepartmentResponse = client.contact.v3.department.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .client_token("473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .department_id("str") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .department_hrbps([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .client_token("473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .department_id("str") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .department_hrbps([]) + .build()) \ + .build() - # 发起请求 - response: CreateDepartmentResponse = await client.contact.v3.department.acreate(request) + # 发起请求 + response: CreateDepartmentResponse = await client.contact.v3.department.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_employee_type_enum_sample.py b/samples/api/contact/v3/create_employee_type_enum_sample.py index 2bf114e10..7588f29c6 100644 --- a/samples/api/contact/v3/create_employee_type_enum_sample.py +++ b/samples/api/contact/v3/create_employee_type_enum_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeTypeEnumRequest = CreateEmployeeTypeEnumRequest.builder() \ - .request_body(EmployeeTypeEnum.builder() - .content("str") - .enum_type(1) - .enum_status(1) - .i18n_content([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeTypeEnumRequest = CreateEmployeeTypeEnumRequest.builder() \ + .request_body(EmployeeTypeEnum.builder() + .content("str") + .enum_type(1) + .enum_status(1) + .i18n_content([]) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.create(request) + # 发起请求 + response: CreateEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeTypeEnumRequest = CreateEmployeeTypeEnumRequest.builder() \ - .request_body(EmployeeTypeEnum.builder() - .content("str") - .enum_type(1) - .enum_status(1) - .i18n_content([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeTypeEnumRequest = CreateEmployeeTypeEnumRequest.builder() \ + .request_body(EmployeeTypeEnum.builder() + .content("str") + .enum_type(1) + .enum_status(1) + .i18n_content([]) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.acreate(request) + # 发起请求 + response: CreateEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_functional_role_sample.py b/samples/api/contact/v3/create_functional_role_sample.py index b6011efc6..21d56c465 100644 --- a/samples/api/contact/v3/create_functional_role_sample.py +++ b/samples/api/contact/v3/create_functional_role_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFunctionalRoleRequest = CreateFunctionalRoleRequest.builder() \ - .request_body(CreateFunctionalRoleRequestBody.builder() - .role_name("考勤管理员") - .build()) \ - .build() + # 构造请求对象 + request: CreateFunctionalRoleRequest = CreateFunctionalRoleRequest.builder() \ + .request_body(CreateFunctionalRoleRequestBody.builder() + .role_name("考勤管理员") + .build()) \ + .build() - # 发起请求 - response: CreateFunctionalRoleResponse = client.contact.v3.functional_role.create(request) + # 发起请求 + response: CreateFunctionalRoleResponse = client.contact.v3.functional_role.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFunctionalRoleRequest = CreateFunctionalRoleRequest.builder() \ - .request_body(CreateFunctionalRoleRequestBody.builder() - .role_name("考勤管理员") - .build()) \ - .build() + # 构造请求对象 + request: CreateFunctionalRoleRequest = CreateFunctionalRoleRequest.builder() \ + .request_body(CreateFunctionalRoleRequestBody.builder() + .role_name("考勤管理员") + .build()) \ + .build() - # 发起请求 - response: CreateFunctionalRoleResponse = await client.contact.v3.functional_role.acreate(request) + # 发起请求 + response: CreateFunctionalRoleResponse = await client.contact.v3.functional_role.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_group_sample.py b/samples/api/contact/v3/create_group_sample.py index 34412dfa1..956fe5dce 100644 --- a/samples/api/contact/v3/create_group_sample.py +++ b/samples/api/contact/v3/create_group_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateGroupRequest = CreateGroupRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Group.builder() - .name("IT 外包组") - .description("IT服务人员的集合") - .type(1) - .group_id("g122817") - .build()) \ - .build() + # 构造请求对象 + request: CreateGroupRequest = CreateGroupRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Group.builder() + .name("IT 外包组") + .description("IT服务人员的集合") + .type(1) + .group_id("g122817") + .build()) \ + .build() - # 发起请求 - response: CreateGroupResponse = client.contact.v3.group.create(request) + # 发起请求 + response: CreateGroupResponse = client.contact.v3.group.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateGroupRequest = CreateGroupRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Group.builder() - .name("IT 外包组") - .description("IT服务人员的集合") - .type(1) - .group_id("g122817") - .build()) \ - .build() + # 构造请求对象 + request: CreateGroupRequest = CreateGroupRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Group.builder() + .name("IT 外包组") + .description("IT服务人员的集合") + .type(1) + .group_id("g122817") + .build()) \ + .build() - # 发起请求 - response: CreateGroupResponse = await client.contact.v3.group.acreate(request) + # 发起请求 + response: CreateGroupResponse = await client.contact.v3.group.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_job_family_sample.py b/samples/api/contact/v3/create_job_family_sample.py index 79daa9644..6f527f2d8 100644 --- a/samples/api/contact/v3/create_job_family_sample.py +++ b/samples/api/contact/v3/create_job_family_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ - .request_body(JobFamily.builder() - .name("产品") - .description("负责产品策略制定的相关工作") - .parent_job_family_id("mga5oa8ayjlp9rb") - .status(False) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ + .request_body(JobFamily.builder() + .name("产品") + .description("负责产品策略制定的相关工作") + .parent_job_family_id("mga5oa8ayjlp9rb") + .status(False) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobFamilyResponse = client.contact.v3.job_family.create(request) + # 发起请求 + response: CreateJobFamilyResponse = client.contact.v3.job_family.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ - .request_body(JobFamily.builder() - .name("产品") - .description("负责产品策略制定的相关工作") - .parent_job_family_id("mga5oa8ayjlp9rb") - .status(False) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ + .request_body(JobFamily.builder() + .name("产品") + .description("负责产品策略制定的相关工作") + .parent_job_family_id("mga5oa8ayjlp9rb") + .status(False) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobFamilyResponse = await client.contact.v3.job_family.acreate(request) + # 发起请求 + response: CreateJobFamilyResponse = await client.contact.v3.job_family.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_job_level_sample.py b/samples/api/contact/v3/create_job_level_sample.py index 2d7437ae4..8fa6dbafc 100644 --- a/samples/api/contact/v3/create_job_level_sample.py +++ b/samples/api/contact/v3/create_job_level_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ - .request_body(JobLevel.builder() - .name("高级专家") - .description("公司内部中高级职称,有一定专业技术能力的人员") - .order(200) - .status(True) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ + .request_body(JobLevel.builder() + .name("高级专家") + .description("公司内部中高级职称,有一定专业技术能力的人员") + .order(200) + .status(True) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobLevelResponse = client.contact.v3.job_level.create(request) + # 发起请求 + response: CreateJobLevelResponse = client.contact.v3.job_level.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ - .request_body(JobLevel.builder() - .name("高级专家") - .description("公司内部中高级职称,有一定专业技术能力的人员") - .order(200) - .status(True) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ + .request_body(JobLevel.builder() + .name("高级专家") + .description("公司内部中高级职称,有一定专业技术能力的人员") + .order(200) + .status(True) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobLevelResponse = await client.contact.v3.job_level.acreate(request) + # 发起请求 + response: CreateJobLevelResponse = await client.contact.v3.job_level.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_unit_sample.py b/samples/api/contact/v3/create_unit_sample.py index 2f803d318..03c878b98 100644 --- a/samples/api/contact/v3/create_unit_sample.py +++ b/samples/api/contact/v3/create_unit_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUnitRequest = CreateUnitRequest.builder() \ - .request_body(CreateUnitRequestBody.builder() - .unit_id("BU121") - .name("消费者事业部") - .unit_type("子公司") - .build()) \ - .build() + # 构造请求对象 + request: CreateUnitRequest = CreateUnitRequest.builder() \ + .request_body(CreateUnitRequestBody.builder() + .unit_id("BU121") + .name("消费者事业部") + .unit_type("子公司") + .build()) \ + .build() - # 发起请求 - response: CreateUnitResponse = client.contact.v3.unit.create(request) + # 发起请求 + response: CreateUnitResponse = client.contact.v3.unit.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUnitRequest = CreateUnitRequest.builder() \ - .request_body(CreateUnitRequestBody.builder() - .unit_id("BU121") - .name("消费者事业部") - .unit_type("子公司") - .build()) \ - .build() + # 构造请求对象 + request: CreateUnitRequest = CreateUnitRequest.builder() \ + .request_body(CreateUnitRequestBody.builder() + .unit_id("BU121") + .name("消费者事业部") + .unit_type("子公司") + .build()) \ + .build() - # 发起请求 - response: CreateUnitResponse = await client.contact.v3.unit.acreate(request) + # 发起请求 + response: CreateUnitResponse = await client.contact.v3.unit.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/create_user_sample.py b/samples/api/contact/v3/create_user_sample.py index f353e2942..59361215d 100644 --- a/samples/api/contact/v3/create_user_sample.py +++ b/samples/api/contact/v3/create_user_sample.py @@ -5,118 +5,118 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserRequest = CreateUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .client_token("xxxx-xxxxx-xxx") \ - .request_body(User.builder() - .user_id("str") - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .geo("cn") - .job_level_id("mga5oa8ayjlp9rb") - .job_family_id("mga5oa8ayjlp9rb") - .subscription_ids([]) - .dotted_line_leader_user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateUserRequest = CreateUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .client_token("xxxx-xxxxx-xxx") \ + .request_body(User.builder() + .user_id("str") + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .geo("cn") + .job_level_id("mga5oa8ayjlp9rb") + .job_family_id("mga5oa8ayjlp9rb") + .subscription_ids([]) + .dotted_line_leader_user_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateUserResponse = client.contact.v3.user.create(request) + # 发起请求 + response: CreateUserResponse = client.contact.v3.user.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserRequest = CreateUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .client_token("xxxx-xxxxx-xxx") \ - .request_body(User.builder() - .user_id("str") - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .geo("cn") - .job_level_id("mga5oa8ayjlp9rb") - .job_family_id("mga5oa8ayjlp9rb") - .subscription_ids([]) - .dotted_line_leader_user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateUserRequest = CreateUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .client_token("xxxx-xxxxx-xxx") \ + .request_body(User.builder() + .user_id("str") + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .geo("cn") + .job_level_id("mga5oa8ayjlp9rb") + .job_family_id("mga5oa8ayjlp9rb") + .subscription_ids([]) + .dotted_line_leader_user_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateUserResponse = await client.contact.v3.user.acreate(request) + # 发起请求 + response: CreateUserResponse = await client.contact.v3.user.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_department_sample.py b/samples/api/contact/v3/delete_department_sample.py index 4b3c57135..dfe130bdb 100644 --- a/samples/api/contact/v3/delete_department_sample.py +++ b/samples/api/contact/v3/delete_department_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ - .department_id("D096") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("D096") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: DeleteDepartmentResponse = client.contact.v3.department.delete(request) + # 发起请求 + response: DeleteDepartmentResponse = client.contact.v3.department.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ - .department_id("D096") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("D096") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: DeleteDepartmentResponse = await client.contact.v3.department.adelete(request) + # 发起请求 + response: DeleteDepartmentResponse = await client.contact.v3.department.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_employee_type_enum_sample.py b/samples/api/contact/v3/delete_employee_type_enum_sample.py index ad345207a..101336df0 100644 --- a/samples/api/contact/v3/delete_employee_type_enum_sample.py +++ b/samples/api/contact/v3/delete_employee_type_enum_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmployeeTypeEnumRequest = DeleteEmployeeTypeEnumRequest.builder() \ - .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ - .build() + # 构造请求对象 + request: DeleteEmployeeTypeEnumRequest = DeleteEmployeeTypeEnumRequest.builder() \ + .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ + .build() - # 发起请求 - response: DeleteEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.delete(request) + # 发起请求 + response: DeleteEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmployeeTypeEnumRequest = DeleteEmployeeTypeEnumRequest.builder() \ - .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ - .build() + # 构造请求对象 + request: DeleteEmployeeTypeEnumRequest = DeleteEmployeeTypeEnumRequest.builder() \ + .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ + .build() - # 发起请求 - response: DeleteEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.adelete(request) + # 发起请求 + response: DeleteEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_functional_role_sample.py b/samples/api/contact/v3/delete_functional_role_sample.py index 44984dec1..459f9fcf5 100644 --- a/samples/api/contact/v3/delete_functional_role_sample.py +++ b/samples/api/contact/v3/delete_functional_role_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFunctionalRoleRequest = DeleteFunctionalRoleRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .build() + # 构造请求对象 + request: DeleteFunctionalRoleRequest = DeleteFunctionalRoleRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .build() - # 发起请求 - response: DeleteFunctionalRoleResponse = client.contact.v3.functional_role.delete(request) + # 发起请求 + response: DeleteFunctionalRoleResponse = client.contact.v3.functional_role.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFunctionalRoleRequest = DeleteFunctionalRoleRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .build() + # 构造请求对象 + request: DeleteFunctionalRoleRequest = DeleteFunctionalRoleRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .build() - # 发起请求 - response: DeleteFunctionalRoleResponse = await client.contact.v3.functional_role.adelete(request) + # 发起请求 + response: DeleteFunctionalRoleResponse = await client.contact.v3.functional_role.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_group_sample.py b/samples/api/contact/v3/delete_group_sample.py index e141c5a7d..94f8948fa 100644 --- a/samples/api/contact/v3/delete_group_sample.py +++ b/samples/api/contact/v3/delete_group_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteGroupRequest = DeleteGroupRequest.builder() \ - .group_id("g1837191") \ - .build() + # 构造请求对象 + request: DeleteGroupRequest = DeleteGroupRequest.builder() \ + .group_id("g1837191") \ + .build() - # 发起请求 - response: DeleteGroupResponse = client.contact.v3.group.delete(request) + # 发起请求 + response: DeleteGroupResponse = client.contact.v3.group.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteGroupRequest = DeleteGroupRequest.builder() \ - .group_id("g1837191") \ - .build() + # 构造请求对象 + request: DeleteGroupRequest = DeleteGroupRequest.builder() \ + .group_id("g1837191") \ + .build() - # 发起请求 - response: DeleteGroupResponse = await client.contact.v3.group.adelete(request) + # 发起请求 + response: DeleteGroupResponse = await client.contact.v3.group.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_job_family_sample.py b/samples/api/contact/v3/delete_job_family_sample.py index 985927000..b0b438597 100644 --- a/samples/api/contact/v3/delete_job_family_sample.py +++ b/samples/api/contact/v3/delete_job_family_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: DeleteJobFamilyResponse = client.contact.v3.job_family.delete(request) + # 发起请求 + response: DeleteJobFamilyResponse = client.contact.v3.job_family.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: DeleteJobFamilyResponse = await client.contact.v3.job_family.adelete(request) + # 发起请求 + response: DeleteJobFamilyResponse = await client.contact.v3.job_family.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_job_level_sample.py b/samples/api/contact/v3/delete_job_level_sample.py index 9dc39de3b..c2251f05b 100644 --- a/samples/api/contact/v3/delete_job_level_sample.py +++ b/samples/api/contact/v3/delete_job_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: DeleteJobLevelResponse = client.contact.v3.job_level.delete(request) + # 发起请求 + response: DeleteJobLevelResponse = client.contact.v3.job_level.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: DeleteJobLevelResponse = await client.contact.v3.job_level.adelete(request) + # 发起请求 + response: DeleteJobLevelResponse = await client.contact.v3.job_level.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_unit_sample.py b/samples/api/contact/v3/delete_unit_sample.py index d64a8f6d4..6f8319385 100644 --- a/samples/api/contact/v3/delete_unit_sample.py +++ b/samples/api/contact/v3/delete_unit_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUnitRequest = DeleteUnitRequest.builder() \ - .unit_id("BU121") \ - .build() + # 构造请求对象 + request: DeleteUnitRequest = DeleteUnitRequest.builder() \ + .unit_id("BU121") \ + .build() - # 发起请求 - response: DeleteUnitResponse = client.contact.v3.unit.delete(request) + # 发起请求 + response: DeleteUnitResponse = client.contact.v3.unit.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUnitRequest = DeleteUnitRequest.builder() \ - .unit_id("BU121") \ - .build() + # 构造请求对象 + request: DeleteUnitRequest = DeleteUnitRequest.builder() \ + .unit_id("BU121") \ + .build() - # 发起请求 - response: DeleteUnitResponse = await client.contact.v3.unit.adelete(request) + # 发起请求 + response: DeleteUnitResponse = await client.contact.v3.unit.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/delete_user_sample.py b/samples/api/contact/v3/delete_user_sample.py index a56fe2bae..42c3966a7 100644 --- a/samples/api/contact/v3/delete_user_sample.py +++ b/samples/api/contact/v3/delete_user_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserRequest = DeleteUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .request_body(DeleteUserRequestBody.builder() - .department_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .external_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .docs_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .calendar_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .application_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .minutes_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .survey_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .email_acceptor(ResourceAcceptor.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: DeleteUserRequest = DeleteUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .request_body(DeleteUserRequestBody.builder() + .department_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .external_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .docs_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .calendar_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .application_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .minutes_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .survey_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .email_acceptor(ResourceAcceptor.builder().build()) + .build()) \ + .build() - # 发起请求 - response: DeleteUserResponse = client.contact.v3.user.delete(request) + # 发起请求 + response: DeleteUserResponse = client.contact.v3.user.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserRequest = DeleteUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .request_body(DeleteUserRequestBody.builder() - .department_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .external_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .docs_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .calendar_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .application_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .minutes_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .survey_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .email_acceptor(ResourceAcceptor.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: DeleteUserRequest = DeleteUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .request_body(DeleteUserRequestBody.builder() + .department_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .external_chat_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .docs_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .calendar_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .application_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .minutes_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .survey_acceptor_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .email_acceptor(ResourceAcceptor.builder().build()) + .build()) \ + .build() - # 发起请求 - response: DeleteUserResponse = await client.contact.v3.user.adelete(request) + # 发起请求 + response: DeleteUserResponse = await client.contact.v3.user.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/find_by_department_user_sample.py b/samples/api/contact/v3/find_by_department_user_sample.py index 3d04c614e..c425a2d0f 100644 --- a/samples/api/contact/v3/find_by_department_user_sample.py +++ b/samples/api/contact/v3/find_by_department_user_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FindByDepartmentUserRequest = FindByDepartmentUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .department_id("od-xxxxxxxxxxxxx") \ - .page_size(10) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: FindByDepartmentUserRequest = FindByDepartmentUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .department_id("od-xxxxxxxxxxxxx") \ + .page_size(10) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: FindByDepartmentUserResponse = client.contact.v3.user.find_by_department(request) + # 发起请求 + response: FindByDepartmentUserResponse = client.contact.v3.user.find_by_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.find_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.find_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FindByDepartmentUserRequest = FindByDepartmentUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .department_id("od-xxxxxxxxxxxxx") \ - .page_size(10) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: FindByDepartmentUserRequest = FindByDepartmentUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .department_id("od-xxxxxxxxxxxxx") \ + .page_size(10) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: FindByDepartmentUserResponse = await client.contact.v3.user.afind_by_department(request) + # 发起请求 + response: FindByDepartmentUserResponse = await client.contact.v3.user.afind_by_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.afind_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.afind_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_department_sample.py b/samples/api/contact/v3/get_department_sample.py index 609ced0f1..d07872d84 100644 --- a/samples/api/contact/v3/get_department_sample.py +++ b/samples/api/contact/v3/get_department_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDepartmentRequest = GetDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetDepartmentRequest = GetDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetDepartmentResponse = client.contact.v3.department.get(request) + # 发起请求 + response: GetDepartmentResponse = client.contact.v3.department.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDepartmentRequest = GetDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetDepartmentRequest = GetDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetDepartmentResponse = await client.contact.v3.department.aget(request) + # 发起请求 + response: GetDepartmentResponse = await client.contact.v3.department.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_functional_role_member_sample.py b/samples/api/contact/v3/get_functional_role_member_sample.py index 6cac3b140..89889024b 100644 --- a/samples/api/contact/v3/get_functional_role_member_sample.py +++ b/samples/api/contact/v3/get_functional_role_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFunctionalRoleMemberRequest = GetFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .member_id("od-123456") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetFunctionalRoleMemberRequest = GetFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .member_id("od-123456") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.get(request) + # 发起请求 + response: GetFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFunctionalRoleMemberRequest = GetFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .member_id("od-123456") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetFunctionalRoleMemberRequest = GetFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .member_id("od-123456") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.aget(request) + # 发起请求 + response: GetFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_group_sample.py b/samples/api/contact/v3/get_group_sample.py index 2a63bda95..1ac465e0e 100644 --- a/samples/api/contact/v3/get_group_sample.py +++ b/samples/api/contact/v3/get_group_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetGroupRequest = GetGroupRequest.builder() \ - .group_id("g193821") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetGroupRequest = GetGroupRequest.builder() \ + .group_id("g193821") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetGroupResponse = client.contact.v3.group.get(request) + # 发起请求 + response: GetGroupResponse = client.contact.v3.group.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetGroupRequest = GetGroupRequest.builder() \ - .group_id("g193821") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetGroupRequest = GetGroupRequest.builder() \ + .group_id("g193821") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetGroupResponse = await client.contact.v3.group.aget(request) + # 发起请求 + response: GetGroupResponse = await client.contact.v3.group.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_job_family_sample.py b/samples/api/contact/v3/get_job_family_sample.py index 1c89a29d1..127de530e 100644 --- a/samples/api/contact/v3/get_job_family_sample.py +++ b/samples/api/contact/v3/get_job_family_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: GetJobFamilyResponse = client.contact.v3.job_family.get(request) + # 发起请求 + response: GetJobFamilyResponse = client.contact.v3.job_family.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: GetJobFamilyResponse = await client.contact.v3.job_family.aget(request) + # 发起请求 + response: GetJobFamilyResponse = await client.contact.v3.job_family.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_job_level_sample.py b/samples/api/contact/v3/get_job_level_sample.py index e8cd6b869..a85c3108c 100644 --- a/samples/api/contact/v3/get_job_level_sample.py +++ b/samples/api/contact/v3/get_job_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobLevelRequest = GetJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: GetJobLevelRequest = GetJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: GetJobLevelResponse = client.contact.v3.job_level.get(request) + # 发起请求 + response: GetJobLevelResponse = client.contact.v3.job_level.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobLevelRequest = GetJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .build() + # 构造请求对象 + request: GetJobLevelRequest = GetJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .build() - # 发起请求 - response: GetJobLevelResponse = await client.contact.v3.job_level.aget(request) + # 发起请求 + response: GetJobLevelResponse = await client.contact.v3.job_level.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_job_title_sample.py b/samples/api/contact/v3/get_job_title_sample.py index 01a561624..b27a15ae7 100644 --- a/samples/api/contact/v3/get_job_title_sample.py +++ b/samples/api/contact/v3/get_job_title_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobTitleRequest = GetJobTitleRequest.builder() \ - .job_title_id("dd39369b19b9") \ - .build() + # 构造请求对象 + request: GetJobTitleRequest = GetJobTitleRequest.builder() \ + .job_title_id("dd39369b19b9") \ + .build() - # 发起请求 - response: GetJobTitleResponse = client.contact.v3.job_title.get(request) + # 发起请求 + response: GetJobTitleResponse = client.contact.v3.job_title.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_title.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_title.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobTitleRequest = GetJobTitleRequest.builder() \ - .job_title_id("dd39369b19b9") \ - .build() + # 构造请求对象 + request: GetJobTitleRequest = GetJobTitleRequest.builder() \ + .job_title_id("dd39369b19b9") \ + .build() - # 发起请求 - response: GetJobTitleResponse = await client.contact.v3.job_title.aget(request) + # 发起请求 + response: GetJobTitleResponse = await client.contact.v3.job_title.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_title.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_title.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_unit_sample.py b/samples/api/contact/v3/get_unit_sample.py index 96894170f..8a0258cf9 100644 --- a/samples/api/contact/v3/get_unit_sample.py +++ b/samples/api/contact/v3/get_unit_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUnitRequest = GetUnitRequest.builder() \ - .unit_id("BU121") \ - .build() + # 构造请求对象 + request: GetUnitRequest = GetUnitRequest.builder() \ + .unit_id("BU121") \ + .build() - # 发起请求 - response: GetUnitResponse = client.contact.v3.unit.get(request) + # 发起请求 + response: GetUnitResponse = client.contact.v3.unit.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUnitRequest = GetUnitRequest.builder() \ - .unit_id("BU121") \ - .build() + # 构造请求对象 + request: GetUnitRequest = GetUnitRequest.builder() \ + .unit_id("BU121") \ + .build() - # 发起请求 - response: GetUnitResponse = await client.contact.v3.unit.aget(request) + # 发起请求 + response: GetUnitResponse = await client.contact.v3.unit.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_user_sample.py b/samples/api/contact/v3/get_user_sample.py index e2c58c25f..1ff83ba73 100644 --- a/samples/api/contact/v3/get_user_sample.py +++ b/samples/api/contact/v3/get_user_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserRequest = GetUserRequest.builder() \ - .user_id("7be5fg9a") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetUserRequest = GetUserRequest.builder() \ + .user_id("7be5fg9a") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetUserResponse = client.contact.v3.user.get(request) + # 发起请求 + response: GetUserResponse = client.contact.v3.user.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetUserRequest = GetUserRequest.builder() \ - .user_id("7be5fg9a") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetUserRequest = GetUserRequest.builder() \ + .user_id("7be5fg9a") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetUserResponse = await client.contact.v3.user.aget(request) + # 发起请求 + response: GetUserResponse = await client.contact.v3.user.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/get_work_city_sample.py b/samples/api/contact/v3/get_work_city_sample.py index 9a8ed4bdc..d2cb61c4f 100644 --- a/samples/api/contact/v3/get_work_city_sample.py +++ b/samples/api/contact/v3/get_work_city_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWorkCityRequest = GetWorkCityRequest.builder() \ - .work_city_id("dd39369b19b9") \ - .build() + # 构造请求对象 + request: GetWorkCityRequest = GetWorkCityRequest.builder() \ + .work_city_id("dd39369b19b9") \ + .build() - # 发起请求 - response: GetWorkCityResponse = client.contact.v3.work_city.get(request) + # 发起请求 + response: GetWorkCityResponse = client.contact.v3.work_city.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.work_city.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.work_city.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWorkCityRequest = GetWorkCityRequest.builder() \ - .work_city_id("dd39369b19b9") \ - .build() + # 构造请求对象 + request: GetWorkCityRequest = GetWorkCityRequest.builder() \ + .work_city_id("dd39369b19b9") \ + .build() - # 发起请求 - response: GetWorkCityResponse = await client.contact.v3.work_city.aget(request) + # 发起请求 + response: GetWorkCityResponse = await client.contact.v3.work_city.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.work_city.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.work_city.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_custom_attr_sample.py b/samples/api/contact/v3/list_custom_attr_sample.py index a4c753fea..bedeec85d 100644 --- a/samples/api/contact/v3/list_custom_attr_sample.py +++ b/samples/api/contact/v3/list_custom_attr_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCustomAttrRequest = ListCustomAttrRequest.builder() \ - .page_size(20) \ - .page_token("AQD9/Rn9eij9Pm39ED40/RYU5lvOM4s6zgbeeNNaWd%2BVKwAsoreeRWk0J2noGvJy") \ - .build() + # 构造请求对象 + request: ListCustomAttrRequest = ListCustomAttrRequest.builder() \ + .page_size(20) \ + .page_token("AQD9/Rn9eij9Pm39ED40/RYU5lvOM4s6zgbeeNNaWd%2BVKwAsoreeRWk0J2noGvJy") \ + .build() - # 发起请求 - response: ListCustomAttrResponse = client.contact.v3.custom_attr.list(request) + # 发起请求 + response: ListCustomAttrResponse = client.contact.v3.custom_attr.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.custom_attr.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.custom_attr.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCustomAttrRequest = ListCustomAttrRequest.builder() \ - .page_size(20) \ - .page_token("AQD9/Rn9eij9Pm39ED40/RYU5lvOM4s6zgbeeNNaWd%2BVKwAsoreeRWk0J2noGvJy") \ - .build() + # 构造请求对象 + request: ListCustomAttrRequest = ListCustomAttrRequest.builder() \ + .page_size(20) \ + .page_token("AQD9/Rn9eij9Pm39ED40/RYU5lvOM4s6zgbeeNNaWd%2BVKwAsoreeRWk0J2noGvJy") \ + .build() - # 发起请求 - response: ListCustomAttrResponse = await client.contact.v3.custom_attr.alist(request) + # 发起请求 + response: ListCustomAttrResponse = await client.contact.v3.custom_attr.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.custom_attr.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.custom_attr.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_department_sample.py b/samples/api/contact/v3/list_department_sample.py index 9df479150..626f35ed2 100644 --- a/samples/api/contact/v3/list_department_sample.py +++ b/samples/api/contact/v3/list_department_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentRequest = ListDepartmentRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .parent_department_id("od-80884c92e43e") \ - .fetch_child(False) \ - .page_size(10) \ - .page_token("5bc498db4617") \ - .build() + # 构造请求对象 + request: ListDepartmentRequest = ListDepartmentRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .parent_department_id("od-80884c92e43e") \ + .fetch_child(False) \ + .page_size(10) \ + .page_token("5bc498db4617") \ + .build() - # 发起请求 - response: ListDepartmentResponse = client.contact.v3.department.list(request) + # 发起请求 + response: ListDepartmentResponse = client.contact.v3.department.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentRequest = ListDepartmentRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .parent_department_id("od-80884c92e43e") \ - .fetch_child(False) \ - .page_size(10) \ - .page_token("5bc498db4617") \ - .build() + # 构造请求对象 + request: ListDepartmentRequest = ListDepartmentRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .parent_department_id("od-80884c92e43e") \ + .fetch_child(False) \ + .page_size(10) \ + .page_token("5bc498db4617") \ + .build() - # 发起请求 - response: ListDepartmentResponse = await client.contact.v3.department.alist(request) + # 发起请求 + response: ListDepartmentResponse = await client.contact.v3.department.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_department_unit_sample.py b/samples/api/contact/v3/list_department_unit_sample.py index 63a50c7f5..0d6543139 100644 --- a/samples/api/contact/v3/list_department_unit_sample.py +++ b/samples/api/contact/v3/list_department_unit_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentUnitRequest = ListDepartmentUnitRequest.builder() \ - .unit_id("BU121") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .page_size(50) \ - .build() + # 构造请求对象 + request: ListDepartmentUnitRequest = ListDepartmentUnitRequest.builder() \ + .unit_id("BU121") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .page_size(50) \ + .build() - # 发起请求 - response: ListDepartmentUnitResponse = client.contact.v3.unit.list_department(request) + # 发起请求 + response: ListDepartmentUnitResponse = client.contact.v3.unit.list_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.list_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.list_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentUnitRequest = ListDepartmentUnitRequest.builder() \ - .unit_id("BU121") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .page_size(50) \ - .build() + # 构造请求对象 + request: ListDepartmentUnitRequest = ListDepartmentUnitRequest.builder() \ + .unit_id("BU121") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .page_size(50) \ + .build() - # 发起请求 - response: ListDepartmentUnitResponse = await client.contact.v3.unit.alist_department(request) + # 发起请求 + response: ListDepartmentUnitResponse = await client.contact.v3.unit.alist_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.alist_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.alist_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_employee_type_enum_sample.py b/samples/api/contact/v3/list_employee_type_enum_sample.py index 0aa100191..36ed0f923 100644 --- a/samples/api/contact/v3/list_employee_type_enum_sample.py +++ b/samples/api/contact/v3/list_employee_type_enum_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeTypeEnumRequest = ListEmployeeTypeEnumRequest.builder() \ - .page_token("3") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListEmployeeTypeEnumRequest = ListEmployeeTypeEnumRequest.builder() \ + .page_token("3") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.list(request) + # 发起请求 + response: ListEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeTypeEnumRequest = ListEmployeeTypeEnumRequest.builder() \ - .page_token("3") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListEmployeeTypeEnumRequest = ListEmployeeTypeEnumRequest.builder() \ + .page_token("3") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.alist(request) + # 发起请求 + response: ListEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_functional_role_member_sample.py b/samples/api/contact/v3/list_functional_role_member_sample.py index 91a86104f..9a9a5c85d 100644 --- a/samples/api/contact/v3/list_functional_role_member_sample.py +++ b/samples/api/contact/v3/list_functional_role_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFunctionalRoleMemberRequest = ListFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .page_size(20) \ - .page_token("dawdewd") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: ListFunctionalRoleMemberRequest = ListFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .page_size(20) \ + .page_token("dawdewd") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: ListFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.list(request) + # 发起请求 + response: ListFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFunctionalRoleMemberRequest = ListFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .page_size(20) \ - .page_token("dawdewd") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: ListFunctionalRoleMemberRequest = ListFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .page_size(20) \ + .page_token("dawdewd") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: ListFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.alist(request) + # 发起请求 + response: ListFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_job_family_sample.py b/samples/api/contact/v3/list_job_family_sample.py index f38230b08..1f635d73f 100644 --- a/samples/api/contact/v3/list_job_family_sample.py +++ b/samples/api/contact/v3/list_job_family_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .name("2-2") \ - .build() + # 构造请求对象 + request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .name("2-2") \ + .build() - # 发起请求 - response: ListJobFamilyResponse = client.contact.v3.job_family.list(request) + # 发起请求 + response: ListJobFamilyResponse = client.contact.v3.job_family.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .name("2-2") \ - .build() + # 构造请求对象 + request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .name("2-2") \ + .build() - # 发起请求 - response: ListJobFamilyResponse = await client.contact.v3.job_family.alist(request) + # 发起请求 + response: ListJobFamilyResponse = await client.contact.v3.job_family.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_job_level_sample.py b/samples/api/contact/v3/list_job_level_sample.py index 72bd60869..31451a7a7 100644 --- a/samples/api/contact/v3/list_job_level_sample.py +++ b/samples/api/contact/v3/list_job_level_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobLevelRequest = ListJobLevelRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .name("高级") \ - .build() + # 构造请求对象 + request: ListJobLevelRequest = ListJobLevelRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .name("高级") \ + .build() - # 发起请求 - response: ListJobLevelResponse = client.contact.v3.job_level.list(request) + # 发起请求 + response: ListJobLevelResponse = client.contact.v3.job_level.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobLevelRequest = ListJobLevelRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .name("高级") \ - .build() + # 构造请求对象 + request: ListJobLevelRequest = ListJobLevelRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .name("高级") \ + .build() - # 发起请求 - response: ListJobLevelResponse = await client.contact.v3.job_level.alist(request) + # 发起请求 + response: ListJobLevelResponse = await client.contact.v3.job_level.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_job_title_sample.py b/samples/api/contact/v3/list_job_title_sample.py index e30102b71..f315742ca 100644 --- a/samples/api/contact/v3/list_job_title_sample.py +++ b/samples/api/contact/v3/list_job_title_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobTitleRequest = ListJobTitleRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .build() + # 构造请求对象 + request: ListJobTitleRequest = ListJobTitleRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .build() - # 发起请求 - response: ListJobTitleResponse = client.contact.v3.job_title.list(request) + # 发起请求 + response: ListJobTitleResponse = client.contact.v3.job_title.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_title.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_title.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobTitleRequest = ListJobTitleRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .build() + # 构造请求对象 + request: ListJobTitleRequest = ListJobTitleRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .build() - # 发起请求 - response: ListJobTitleResponse = await client.contact.v3.job_title.alist(request) + # 发起请求 + response: ListJobTitleResponse = await client.contact.v3.job_title.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_title.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_title.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_scope_sample.py b/samples/api/contact/v3/list_scope_sample.py index 672e31c7e..7dde0c041 100644 --- a/samples/api/contact/v3/list_scope_sample.py +++ b/samples/api/contact/v3/list_scope_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListScopeRequest = ListScopeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .page_size(50) \ - .build() + # 构造请求对象 + request: ListScopeRequest = ListScopeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .page_size(50) \ + .build() - # 发起请求 - response: ListScopeResponse = client.contact.v3.scope.list(request) + # 发起请求 + response: ListScopeResponse = client.contact.v3.scope.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.scope.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.scope.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListScopeRequest = ListScopeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .page_size(50) \ - .build() + # 构造请求对象 + request: ListScopeRequest = ListScopeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .page_size(50) \ + .build() - # 发起请求 - response: ListScopeResponse = await client.contact.v3.scope.alist(request) + # 发起请求 + response: ListScopeResponse = await client.contact.v3.scope.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.scope.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.scope.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_unit_sample.py b/samples/api/contact/v3/list_unit_sample.py index 2219cdf6e..735daff8d 100644 --- a/samples/api/contact/v3/list_unit_sample.py +++ b/samples/api/contact/v3/list_unit_sample.py @@ -5,62 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUnitRequest = ListUnitRequest.builder() \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: ListUnitRequest = ListUnitRequest.builder() \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: ListUnitResponse = client.contact.v3.unit.list(request) + # 发起请求 + response: ListUnitResponse = client.contact.v3.unit.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUnitRequest = ListUnitRequest.builder() \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: ListUnitRequest = ListUnitRequest.builder() \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: ListUnitResponse = await client.contact.v3.unit.alist(request) + # 发起请求 + response: ListUnitResponse = await client.contact.v3.unit.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_user_sample.py b/samples/api/contact/v3/list_user_sample.py index 1d6e43e2f..b7d99e1e7 100644 --- a/samples/api/contact/v3/list_user_sample.py +++ b/samples/api/contact/v3/list_user_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserRequest = ListUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .department_id("str") \ - .page_token("str") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListUserRequest = ListUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .department_id("str") \ + .page_token("str") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListUserResponse = client.contact.v3.user.list(request) + # 发起请求 + response: ListUserResponse = client.contact.v3.user.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserRequest = ListUserRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .department_id("str") \ - .page_token("str") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListUserRequest = ListUserRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .department_id("str") \ + .page_token("str") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListUserResponse = await client.contact.v3.user.alist(request) + # 发起请求 + response: ListUserResponse = await client.contact.v3.user.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/list_work_city_sample.py b/samples/api/contact/v3/list_work_city_sample.py index 713032913..3b0e709c9 100644 --- a/samples/api/contact/v3/list_work_city_sample.py +++ b/samples/api/contact/v3/list_work_city_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWorkCityRequest = ListWorkCityRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .build() + # 构造请求对象 + request: ListWorkCityRequest = ListWorkCityRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .build() - # 发起请求 - response: ListWorkCityResponse = client.contact.v3.work_city.list(request) + # 发起请求 + response: ListWorkCityResponse = client.contact.v3.work_city.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.work_city.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.work_city.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWorkCityRequest = ListWorkCityRequest.builder() \ - .page_size(10) \ - .page_token("") \ - .build() + # 构造请求对象 + request: ListWorkCityRequest = ListWorkCityRequest.builder() \ + .page_size(10) \ + .page_token("") \ + .build() - # 发起请求 - response: ListWorkCityResponse = await client.contact.v3.work_city.alist(request) + # 发起请求 + response: ListWorkCityResponse = await client.contact.v3.work_city.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.work_city.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.work_city.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/member_belong_group_sample.py b/samples/api/contact/v3/member_belong_group_sample.py index 0843b6561..e2d93930a 100644 --- a/samples/api/contact/v3/member_belong_group_sample.py +++ b/samples/api/contact/v3/member_belong_group_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MemberBelongGroupRequest = MemberBelongGroupRequest.builder() \ - .member_id("u287xj12") \ - .member_id_type("open_id") \ - .group_type(1) \ - .page_size(500) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: MemberBelongGroupRequest = MemberBelongGroupRequest.builder() \ + .member_id("u287xj12") \ + .member_id_type("open_id") \ + .group_type(1) \ + .page_size(500) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: MemberBelongGroupResponse = client.contact.v3.group.member_belong(request) + # 发起请求 + response: MemberBelongGroupResponse = client.contact.v3.group.member_belong(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.member_belong failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.member_belong failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MemberBelongGroupRequest = MemberBelongGroupRequest.builder() \ - .member_id("u287xj12") \ - .member_id_type("open_id") \ - .group_type(1) \ - .page_size(500) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .build() + # 构造请求对象 + request: MemberBelongGroupRequest = MemberBelongGroupRequest.builder() \ + .member_id("u287xj12") \ + .member_id_type("open_id") \ + .group_type(1) \ + .page_size(500) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .build() - # 发起请求 - response: MemberBelongGroupResponse = await client.contact.v3.group.amember_belong(request) + # 发起请求 + response: MemberBelongGroupResponse = await client.contact.v3.group.amember_belong(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.amember_belong failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.amember_belong failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/parent_department_sample.py b/samples/api/contact/v3/parent_department_sample.py index 3448644aa..4965afb90 100644 --- a/samples/api/contact/v3/parent_department_sample.py +++ b/samples/api/contact/v3/parent_department_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParentDepartmentRequest = ParentDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ParentDepartmentRequest = ParentDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .page_size(20) \ + .build() - # 发起请求 - response: ParentDepartmentResponse = client.contact.v3.department.parent(request) + # 发起请求 + response: ParentDepartmentResponse = client.contact.v3.department.parent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.parent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.parent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParentDepartmentRequest = ParentDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ParentDepartmentRequest = ParentDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .page_size(20) \ + .build() - # 发起请求 - response: ParentDepartmentResponse = await client.contact.v3.department.aparent(request) + # 发起请求 + response: ParentDepartmentResponse = await client.contact.v3.department.aparent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.aparent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.aparent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/patch_department_sample.py b/samples/api/contact/v3/patch_department_sample.py index a347e6251..aa8d36073 100644 --- a/samples/api/contact/v3/patch_department_sample.py +++ b/samples/api/contact/v3/patch_department_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .department_hrbps([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .department_hrbps([]) + .build()) \ + .build() - # 发起请求 - response: PatchDepartmentResponse = client.contact.v3.department.patch(request) + # 发起请求 + response: PatchDepartmentResponse = client.contact.v3.department.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .department_hrbps([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .department_hrbps([]) + .build()) \ + .build() - # 发起请求 - response: PatchDepartmentResponse = await client.contact.v3.department.apatch(request) + # 发起请求 + response: PatchDepartmentResponse = await client.contact.v3.department.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/patch_group_sample.py b/samples/api/contact/v3/patch_group_sample.py index 47a47bc19..332374565 100644 --- a/samples/api/contact/v3/patch_group_sample.py +++ b/samples/api/contact/v3/patch_group_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchGroupRequest = PatchGroupRequest.builder() \ - .group_id("g187131") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Group.builder() - .name("外包 IT 用户组") - .description("IT 外包用户组,需要进行细粒度权限管控") - .build()) \ - .build() + # 构造请求对象 + request: PatchGroupRequest = PatchGroupRequest.builder() \ + .group_id("g187131") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Group.builder() + .name("外包 IT 用户组") + .description("IT 外包用户组,需要进行细粒度权限管控") + .build()) \ + .build() - # 发起请求 - response: PatchGroupResponse = client.contact.v3.group.patch(request) + # 发起请求 + response: PatchGroupResponse = client.contact.v3.group.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchGroupRequest = PatchGroupRequest.builder() \ - .group_id("g187131") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Group.builder() - .name("外包 IT 用户组") - .description("IT 外包用户组,需要进行细粒度权限管控") - .build()) \ - .build() + # 构造请求对象 + request: PatchGroupRequest = PatchGroupRequest.builder() \ + .group_id("g187131") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Group.builder() + .name("外包 IT 用户组") + .description("IT 外包用户组,需要进行细粒度权限管控") + .build()) \ + .build() - # 发起请求 - response: PatchGroupResponse = await client.contact.v3.group.apatch(request) + # 发起请求 + response: PatchGroupResponse = await client.contact.v3.group.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/patch_unit_sample.py b/samples/api/contact/v3/patch_unit_sample.py index 3f6e1629e..75dffd74f 100644 --- a/samples/api/contact/v3/patch_unit_sample.py +++ b/samples/api/contact/v3/patch_unit_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUnitRequest = PatchUnitRequest.builder() \ - .unit_id("BU121") \ - .request_body(PatchUnitRequestBody.builder() - .name("消费者事业部") - .build()) \ - .build() + # 构造请求对象 + request: PatchUnitRequest = PatchUnitRequest.builder() \ + .unit_id("BU121") \ + .request_body(PatchUnitRequestBody.builder() + .name("消费者事业部") + .build()) \ + .build() - # 发起请求 - response: PatchUnitResponse = client.contact.v3.unit.patch(request) + # 发起请求 + response: PatchUnitResponse = client.contact.v3.unit.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUnitRequest = PatchUnitRequest.builder() \ - .unit_id("BU121") \ - .request_body(PatchUnitRequestBody.builder() - .name("消费者事业部") - .build()) \ - .build() + # 构造请求对象 + request: PatchUnitRequest = PatchUnitRequest.builder() \ + .unit_id("BU121") \ + .request_body(PatchUnitRequestBody.builder() + .name("消费者事业部") + .build()) \ + .build() - # 发起请求 - response: PatchUnitResponse = await client.contact.v3.unit.apatch(request) + # 发起请求 + response: PatchUnitResponse = await client.contact.v3.unit.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/patch_user_sample.py b/samples/api/contact/v3/patch_user_sample.py index cd570422d..ed79815d6 100644 --- a/samples/api/contact/v3/patch_user_sample.py +++ b/samples/api/contact/v3/patch_user_sample.py @@ -5,116 +5,116 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUserRequest = PatchUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(User.builder() - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .is_frozen(False) - .job_level_id("mga5oa8ayjlp9rb") - .job_family_id("mga5oa8ayjlp9rb") - .subscription_ids([]) - .dotted_line_leader_user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchUserRequest = PatchUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(User.builder() + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .is_frozen(False) + .job_level_id("mga5oa8ayjlp9rb") + .job_family_id("mga5oa8ayjlp9rb") + .subscription_ids([]) + .dotted_line_leader_user_ids([]) + .build()) \ + .build() - # 发起请求 - response: PatchUserResponse = client.contact.v3.user.patch(request) + # 发起请求 + response: PatchUserResponse = client.contact.v3.user.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchUserRequest = PatchUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(User.builder() - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .is_frozen(False) - .job_level_id("mga5oa8ayjlp9rb") - .job_family_id("mga5oa8ayjlp9rb") - .subscription_ids([]) - .dotted_line_leader_user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchUserRequest = PatchUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(User.builder() + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .is_frozen(False) + .job_level_id("mga5oa8ayjlp9rb") + .job_family_id("mga5oa8ayjlp9rb") + .subscription_ids([]) + .dotted_line_leader_user_ids([]) + .build()) \ + .build() - # 发起请求 - response: PatchUserResponse = await client.contact.v3.user.apatch(request) + # 发起请求 + response: PatchUserResponse = await client.contact.v3.user.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/remove_group_member_sample.py b/samples/api/contact/v3/remove_group_member_sample.py index 6f73557e7..b7a754877 100644 --- a/samples/api/contact/v3/remove_group_member_sample.py +++ b/samples/api/contact/v3/remove_group_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveGroupMemberRequest = RemoveGroupMemberRequest.builder() \ - .group_id("g198123") \ - .request_body(RemoveGroupMemberRequestBody.builder() - .member_type("user") - .member_id("xj82871k") - .member_id_type("open_id") - .build()) \ - .build() + # 构造请求对象 + request: RemoveGroupMemberRequest = RemoveGroupMemberRequest.builder() \ + .group_id("g198123") \ + .request_body(RemoveGroupMemberRequestBody.builder() + .member_type("user") + .member_id("xj82871k") + .member_id_type("open_id") + .build()) \ + .build() - # 发起请求 - response: RemoveGroupMemberResponse = client.contact.v3.group_member.remove(request) + # 发起请求 + response: RemoveGroupMemberResponse = client.contact.v3.group_member.remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveGroupMemberRequest = RemoveGroupMemberRequest.builder() \ - .group_id("g198123") \ - .request_body(RemoveGroupMemberRequestBody.builder() - .member_type("user") - .member_id("xj82871k") - .member_id_type("open_id") - .build()) \ - .build() + # 构造请求对象 + request: RemoveGroupMemberRequest = RemoveGroupMemberRequest.builder() \ + .group_id("g198123") \ + .request_body(RemoveGroupMemberRequestBody.builder() + .member_type("user") + .member_id("xj82871k") + .member_id_type("open_id") + .build()) \ + .build() - # 发起请求 - response: RemoveGroupMemberResponse = await client.contact.v3.group_member.aremove(request) + # 发起请求 + response: RemoveGroupMemberResponse = await client.contact.v3.group_member.aremove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/resurrect_user_sample.py b/samples/api/contact/v3/resurrect_user_sample.py index 8a01ba7ac..fca60dd12 100644 --- a/samples/api/contact/v3/resurrect_user_sample.py +++ b/samples/api/contact/v3/resurrect_user_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResurrectUserRequest = ResurrectUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ResurrectUserRequestBody.builder() - .departments([]) - .subscription_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: ResurrectUserRequest = ResurrectUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ResurrectUserRequestBody.builder() + .departments([]) + .subscription_ids([]) + .build()) \ + .build() - # 发起请求 - response: ResurrectUserResponse = client.contact.v3.user.resurrect(request) + # 发起请求 + response: ResurrectUserResponse = client.contact.v3.user.resurrect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.resurrect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.resurrect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResurrectUserRequest = ResurrectUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ResurrectUserRequestBody.builder() - .departments([]) - .subscription_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: ResurrectUserRequest = ResurrectUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ResurrectUserRequestBody.builder() + .departments([]) + .subscription_ids([]) + .build()) \ + .build() - # 发起请求 - response: ResurrectUserResponse = await client.contact.v3.user.aresurrect(request) + # 发起请求 + response: ResurrectUserResponse = await client.contact.v3.user.aresurrect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.aresurrect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.aresurrect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/scopes_functional_role_member_sample.py b/samples/api/contact/v3/scopes_functional_role_member_sample.py index 0a544b4a7..bd7f8dc62 100644 --- a/samples/api/contact/v3/scopes_functional_role_member_sample.py +++ b/samples/api/contact/v3/scopes_functional_role_member_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ScopesFunctionalRoleMemberRequest = ScopesFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ScopesFunctionalRoleMemberRequestBody.builder() - .members([]) - .departments([]) - .build()) \ - .build() + # 构造请求对象 + request: ScopesFunctionalRoleMemberRequest = ScopesFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ScopesFunctionalRoleMemberRequestBody.builder() + .members([]) + .departments([]) + .build()) \ + .build() - # 发起请求 - response: ScopesFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.scopes(request) + # 发起请求 + response: ScopesFunctionalRoleMemberResponse = client.contact.v3.functional_role_member.scopes(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.scopes failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.scopes failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ScopesFunctionalRoleMemberRequest = ScopesFunctionalRoleMemberRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ScopesFunctionalRoleMemberRequestBody.builder() - .members([]) - .departments([]) - .build()) \ - .build() + # 构造请求对象 + request: ScopesFunctionalRoleMemberRequest = ScopesFunctionalRoleMemberRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ScopesFunctionalRoleMemberRequestBody.builder() + .members([]) + .departments([]) + .build()) \ + .build() - # 发起请求 - response: ScopesFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.ascopes(request) + # 发起请求 + response: ScopesFunctionalRoleMemberResponse = await client.contact.v3.functional_role_member.ascopes(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role_member.ascopes failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role_member.ascopes failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/search_department_sample.py b/samples/api/contact/v3/search_department_sample.py index 8dcd4b774..d03658925 100644 --- a/samples/api/contact/v3/search_department_sample.py +++ b/samples/api/contact/v3/search_department_sample.py @@ -5,72 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .page_size(20) \ - .request_body(SearchDepartmentRequestBody.builder() - .query("DemoName") - .build()) \ - .build() + # 构造请求对象 + request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .page_size(20) \ + .request_body(SearchDepartmentRequestBody.builder() + .query("DemoName") + .build()) \ + .build() - # 发起请求 - response: SearchDepartmentResponse = client.contact.v3.department.search(request) + # 发起请求 + response: SearchDepartmentResponse = client.contact.v3.department.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ - .page_size(20) \ - .request_body(SearchDepartmentRequestBody.builder() - .query("DemoName") - .build()) \ - .build() + # 构造请求对象 + request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR") \ + .page_size(20) \ + .request_body(SearchDepartmentRequestBody.builder() + .query("DemoName") + .build()) \ + .build() - # 发起请求 - response: SearchDepartmentResponse = await client.contact.v3.department.asearch(request) + # 发起请求 + response: SearchDepartmentResponse = await client.contact.v3.department.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/simplelist_group_member_sample.py b/samples/api/contact/v3/simplelist_group_member_sample.py index 0b2ebff42..4b441f9a4 100644 --- a/samples/api/contact/v3/simplelist_group_member_sample.py +++ b/samples/api/contact/v3/simplelist_group_member_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SimplelistGroupMemberRequest = SimplelistGroupMemberRequest.builder() \ - .group_id("g128187") \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .member_id_type("open_id") \ - .member_type("user") \ - .build() + # 构造请求对象 + request: SimplelistGroupMemberRequest = SimplelistGroupMemberRequest.builder() \ + .group_id("g128187") \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .member_id_type("open_id") \ + .member_type("user") \ + .build() - # 发起请求 - response: SimplelistGroupMemberResponse = client.contact.v3.group_member.simplelist(request) + # 发起请求 + response: SimplelistGroupMemberResponse = client.contact.v3.group_member.simplelist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.simplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.simplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SimplelistGroupMemberRequest = SimplelistGroupMemberRequest.builder() \ - .group_id("g128187") \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .member_id_type("open_id") \ - .member_type("user") \ - .build() + # 构造请求对象 + request: SimplelistGroupMemberRequest = SimplelistGroupMemberRequest.builder() \ + .group_id("g128187") \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .member_id_type("open_id") \ + .member_type("user") \ + .build() - # 发起请求 - response: SimplelistGroupMemberResponse = await client.contact.v3.group_member.asimplelist(request) + # 发起请求 + response: SimplelistGroupMemberResponse = await client.contact.v3.group_member.asimplelist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group_member.asimplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group_member.asimplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/simplelist_group_sample.py b/samples/api/contact/v3/simplelist_group_sample.py index 060d0f3e8..606657362 100644 --- a/samples/api/contact/v3/simplelist_group_sample.py +++ b/samples/api/contact/v3/simplelist_group_sample.py @@ -5,64 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SimplelistGroupRequest = SimplelistGroupRequest.builder() \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .type(1) \ - .build() + # 构造请求对象 + request: SimplelistGroupRequest = SimplelistGroupRequest.builder() \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .type(1) \ + .build() - # 发起请求 - response: SimplelistGroupResponse = client.contact.v3.group.simplelist(request) + # 发起请求 + response: SimplelistGroupResponse = client.contact.v3.group.simplelist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.simplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.simplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SimplelistGroupRequest = SimplelistGroupRequest.builder() \ - .page_size(50) \ - .page_token( - "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ - .type(1) \ - .build() + # 构造请求对象 + request: SimplelistGroupRequest = SimplelistGroupRequest.builder() \ + .page_size(50) \ + .page_token("AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=") \ + .type(1) \ + .build() - # 发起请求 - response: SimplelistGroupResponse = await client.contact.v3.group.asimplelist(request) + # 发起请求 + response: SimplelistGroupResponse = await client.contact.v3.group.asimplelist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.group.asimplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.group.asimplelist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/unbind_department_chat_department_sample.py b/samples/api/contact/v3/unbind_department_chat_department_sample.py index b47d7e261..37f1a945f 100644 --- a/samples/api/contact/v3/unbind_department_chat_department_sample.py +++ b/samples/api/contact/v3/unbind_department_chat_department_sample.py @@ -5,65 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindDepartmentChatDepartmentRequest = UnbindDepartmentChatDepartmentRequest.builder() \ - .department_id_type("open_department_id") \ - .request_body(UnbindDepartmentChatDepartmentRequestBody.builder() - .department_id("D096") - .build()) \ - .build() + # 构造请求对象 + request: UnbindDepartmentChatDepartmentRequest = UnbindDepartmentChatDepartmentRequest.builder() \ + .department_id_type("open_department_id") \ + .request_body(UnbindDepartmentChatDepartmentRequestBody.builder() + .department_id("D096") + .build()) \ + .build() - # 发起请求 - response: UnbindDepartmentChatDepartmentResponse = client.contact.v3.department.unbind_department_chat(request) + # 发起请求 + response: UnbindDepartmentChatDepartmentResponse = client.contact.v3.department.unbind_department_chat(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.unbind_department_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.unbind_department_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindDepartmentChatDepartmentRequest = UnbindDepartmentChatDepartmentRequest.builder() \ - .department_id_type("open_department_id") \ - .request_body(UnbindDepartmentChatDepartmentRequestBody.builder() - .department_id("D096") - .build()) \ - .build() + # 构造请求对象 + request: UnbindDepartmentChatDepartmentRequest = UnbindDepartmentChatDepartmentRequest.builder() \ + .department_id_type("open_department_id") \ + .request_body(UnbindDepartmentChatDepartmentRequestBody.builder() + .department_id("D096") + .build()) \ + .build() - # 发起请求 - response: UnbindDepartmentChatDepartmentResponse = await client.contact.v3.department.aunbind_department_chat( - request) + # 发起请求 + response: UnbindDepartmentChatDepartmentResponse = await client.contact.v3.department.aunbind_department_chat(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.aunbind_department_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.aunbind_department_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/unbind_department_unit_sample.py b/samples/api/contact/v3/unbind_department_unit_sample.py index f021c4b68..78f0828c0 100644 --- a/samples/api/contact/v3/unbind_department_unit_sample.py +++ b/samples/api/contact/v3/unbind_department_unit_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindDepartmentUnitRequest = UnbindDepartmentUnitRequest.builder() \ - .request_body(UnbindDepartmentUnitRequestBody.builder() - .unit_id("BU121") - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .department_id_type("open_department_id") - .build()) \ - .build() + # 构造请求对象 + request: UnbindDepartmentUnitRequest = UnbindDepartmentUnitRequest.builder() \ + .request_body(UnbindDepartmentUnitRequestBody.builder() + .unit_id("BU121") + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .department_id_type("open_department_id") + .build()) \ + .build() - # 发起请求 - response: UnbindDepartmentUnitResponse = client.contact.v3.unit.unbind_department(request) + # 发起请求 + response: UnbindDepartmentUnitResponse = client.contact.v3.unit.unbind_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.unbind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.unbind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindDepartmentUnitRequest = UnbindDepartmentUnitRequest.builder() \ - .request_body(UnbindDepartmentUnitRequestBody.builder() - .unit_id("BU121") - .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") - .department_id_type("open_department_id") - .build()) \ - .build() + # 构造请求对象 + request: UnbindDepartmentUnitRequest = UnbindDepartmentUnitRequest.builder() \ + .request_body(UnbindDepartmentUnitRequestBody.builder() + .unit_id("BU121") + .department_id("od-4e6ac4d14bcd5071a37a39de902c7141") + .department_id_type("open_department_id") + .build()) \ + .build() - # 发起请求 - response: UnbindDepartmentUnitResponse = await client.contact.v3.unit.aunbind_department(request) + # 发起请求 + response: UnbindDepartmentUnitResponse = await client.contact.v3.unit.aunbind_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.unit.aunbind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.unit.aunbind_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_department_id_department_sample.py b/samples/api/contact/v3/update_department_id_department_sample.py index 62fd9d660..c2a49f7af 100644 --- a/samples/api/contact/v3/update_department_id_department_sample.py +++ b/samples/api/contact/v3/update_department_id_department_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDepartmentIdDepartmentRequest = UpdateDepartmentIdDepartmentRequest.builder() \ - .department_id("str") \ - .department_id_type("department_id") \ - .request_body(UpdateDepartmentIdDepartmentRequestBody.builder() - .new_department_id("str") - .build()) \ - .build() + # 构造请求对象 + request: UpdateDepartmentIdDepartmentRequest = UpdateDepartmentIdDepartmentRequest.builder() \ + .department_id("str") \ + .department_id_type("department_id") \ + .request_body(UpdateDepartmentIdDepartmentRequestBody.builder() + .new_department_id("str") + .build()) \ + .build() - # 发起请求 - response: UpdateDepartmentIdDepartmentResponse = client.contact.v3.department.update_department_id(request) + # 发起请求 + response: UpdateDepartmentIdDepartmentResponse = client.contact.v3.department.update_department_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.update_department_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.update_department_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDepartmentIdDepartmentRequest = UpdateDepartmentIdDepartmentRequest.builder() \ - .department_id("str") \ - .department_id_type("department_id") \ - .request_body(UpdateDepartmentIdDepartmentRequestBody.builder() - .new_department_id("str") - .build()) \ - .build() + # 构造请求对象 + request: UpdateDepartmentIdDepartmentRequest = UpdateDepartmentIdDepartmentRequest.builder() \ + .department_id("str") \ + .department_id_type("department_id") \ + .request_body(UpdateDepartmentIdDepartmentRequestBody.builder() + .new_department_id("str") + .build()) \ + .build() - # 发起请求 - response: UpdateDepartmentIdDepartmentResponse = await client.contact.v3.department.aupdate_department_id(request) + # 发起请求 + response: UpdateDepartmentIdDepartmentResponse = await client.contact.v3.department.aupdate_department_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.aupdate_department_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.aupdate_department_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_department_sample.py b/samples/api/contact/v3/update_department_sample.py index fd5b099d8..867338652 100644 --- a/samples/api/contact/v3/update_department_sample.py +++ b/samples/api/contact/v3/update_department_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDepartmentRequest = UpdateDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateDepartmentRequest = UpdateDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .build()) \ + .build() - # 发起请求 - response: UpdateDepartmentResponse = client.contact.v3.department.update(request) + # 发起请求 + response: UpdateDepartmentResponse = client.contact.v3.department.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDepartmentRequest = UpdateDepartmentRequest.builder() \ - .department_id("D096") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(Department.builder() - .name("DemoName") - .i18n_name(DepartmentI18nName.builder().build()) - .parent_department_id("D067") - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .order("100") - .create_group_chat(False) - .leaders([]) - .group_chat_employee_types([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateDepartmentRequest = UpdateDepartmentRequest.builder() \ + .department_id("D096") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(Department.builder() + .name("DemoName") + .i18n_name(DepartmentI18nName.builder().build()) + .parent_department_id("D067") + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .order("100") + .create_group_chat(False) + .leaders([]) + .group_chat_employee_types([]) + .build()) \ + .build() - # 发起请求 - response: UpdateDepartmentResponse = await client.contact.v3.department.aupdate(request) + # 发起请求 + response: UpdateDepartmentResponse = await client.contact.v3.department.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.department.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.department.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_employee_type_enum_sample.py b/samples/api/contact/v3/update_employee_type_enum_sample.py index b81794065..b3be0cf15 100644 --- a/samples/api/contact/v3/update_employee_type_enum_sample.py +++ b/samples/api/contact/v3/update_employee_type_enum_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEmployeeTypeEnumRequest = UpdateEmployeeTypeEnumRequest.builder() \ - .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ - .request_body(EmployeeTypeEnum.builder() - .content("str") - .enum_type(1) - .enum_status(1) - .i18n_content([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateEmployeeTypeEnumRequest = UpdateEmployeeTypeEnumRequest.builder() \ + .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ + .request_body(EmployeeTypeEnum.builder() + .content("str") + .enum_type(1) + .enum_status(1) + .i18n_content([]) + .build()) \ + .build() - # 发起请求 - response: UpdateEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.update(request) + # 发起请求 + response: UpdateEmployeeTypeEnumResponse = client.contact.v3.employee_type_enum.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEmployeeTypeEnumRequest = UpdateEmployeeTypeEnumRequest.builder() \ - .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ - .request_body(EmployeeTypeEnum.builder() - .content("str") - .enum_type(1) - .enum_status(1) - .i18n_content([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateEmployeeTypeEnumRequest = UpdateEmployeeTypeEnumRequest.builder() \ + .enum_id("exGeIjow7zIqWMy+ONkFxA==") \ + .request_body(EmployeeTypeEnum.builder() + .content("str") + .enum_type(1) + .enum_status(1) + .i18n_content([]) + .build()) \ + .build() - # 发起请求 - response: UpdateEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.aupdate(request) + # 发起请求 + response: UpdateEmployeeTypeEnumResponse = await client.contact.v3.employee_type_enum.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.employee_type_enum.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.employee_type_enum.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_functional_role_sample.py b/samples/api/contact/v3/update_functional_role_sample.py index 6b6f960c4..67b062867 100644 --- a/samples/api/contact/v3/update_functional_role_sample.py +++ b/samples/api/contact/v3/update_functional_role_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateFunctionalRoleRequest = UpdateFunctionalRoleRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .request_body(UpdateFunctionalRoleRequestBody.builder() - .role_name("考勤管理员") - .build()) \ - .build() + # 构造请求对象 + request: UpdateFunctionalRoleRequest = UpdateFunctionalRoleRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .request_body(UpdateFunctionalRoleRequestBody.builder() + .role_name("考勤管理员") + .build()) \ + .build() - # 发起请求 - response: UpdateFunctionalRoleResponse = client.contact.v3.functional_role.update(request) + # 发起请求 + response: UpdateFunctionalRoleResponse = client.contact.v3.functional_role.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateFunctionalRoleRequest = UpdateFunctionalRoleRequest.builder() \ - .role_id("7vrj3vk70xk7v5r") \ - .request_body(UpdateFunctionalRoleRequestBody.builder() - .role_name("考勤管理员") - .build()) \ - .build() + # 构造请求对象 + request: UpdateFunctionalRoleRequest = UpdateFunctionalRoleRequest.builder() \ + .role_id("7vrj3vk70xk7v5r") \ + .request_body(UpdateFunctionalRoleRequestBody.builder() + .role_name("考勤管理员") + .build()) \ + .build() - # 发起请求 - response: UpdateFunctionalRoleResponse = await client.contact.v3.functional_role.aupdate(request) + # 发起请求 + response: UpdateFunctionalRoleResponse = await client.contact.v3.functional_role.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.functional_role.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.functional_role.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_job_family_sample.py b/samples/api/contact/v3/update_job_family_sample.py index 61d95afab..2e8bb6dda 100644 --- a/samples/api/contact/v3/update_job_family_sample.py +++ b/samples/api/contact/v3/update_job_family_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobFamilyRequest = UpdateJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .request_body(JobFamily.builder() - .name("产品") - .description("负责产品策略制定的相关工作") - .parent_job_family_id("mga5oa8ayjlp9rb") - .status(False) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobFamilyRequest = UpdateJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .request_body(JobFamily.builder() + .name("产品") + .description("负责产品策略制定的相关工作") + .parent_job_family_id("mga5oa8ayjlp9rb") + .status(False) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: UpdateJobFamilyResponse = client.contact.v3.job_family.update(request) + # 发起请求 + response: UpdateJobFamilyResponse = client.contact.v3.job_family.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobFamilyRequest = UpdateJobFamilyRequest.builder() \ - .job_family_id("mga5oa8ayjlp9rb") \ - .request_body(JobFamily.builder() - .name("产品") - .description("负责产品策略制定的相关工作") - .parent_job_family_id("mga5oa8ayjlp9rb") - .status(False) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobFamilyRequest = UpdateJobFamilyRequest.builder() \ + .job_family_id("mga5oa8ayjlp9rb") \ + .request_body(JobFamily.builder() + .name("产品") + .description("负责产品策略制定的相关工作") + .parent_job_family_id("mga5oa8ayjlp9rb") + .status(False) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: UpdateJobFamilyResponse = await client.contact.v3.job_family.aupdate(request) + # 发起请求 + response: UpdateJobFamilyResponse = await client.contact.v3.job_family.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_family.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_family.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_job_level_sample.py b/samples/api/contact/v3/update_job_level_sample.py index fd9d75149..33b0072ee 100644 --- a/samples/api/contact/v3/update_job_level_sample.py +++ b/samples/api/contact/v3/update_job_level_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobLevelRequest = UpdateJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .request_body(JobLevel.builder() - .name("高级专家") - .description("公司内部中高级职称,有一定专业技术能力的人员") - .order(200) - .status(True) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobLevelRequest = UpdateJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .request_body(JobLevel.builder() + .name("高级专家") + .description("公司内部中高级职称,有一定专业技术能力的人员") + .order(200) + .status(True) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: UpdateJobLevelResponse = client.contact.v3.job_level.update(request) + # 发起请求 + response: UpdateJobLevelResponse = client.contact.v3.job_level.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobLevelRequest = UpdateJobLevelRequest.builder() \ - .job_level_id("mga5oa8ayjlp9rb") \ - .request_body(JobLevel.builder() - .name("高级专家") - .description("公司内部中高级职称,有一定专业技术能力的人员") - .order(200) - .status(True) - .i18n_name([]) - .i18n_description([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobLevelRequest = UpdateJobLevelRequest.builder() \ + .job_level_id("mga5oa8ayjlp9rb") \ + .request_body(JobLevel.builder() + .name("高级专家") + .description("公司内部中高级职称,有一定专业技术能力的人员") + .order(200) + .status(True) + .i18n_name([]) + .i18n_description([]) + .build()) \ + .build() - # 发起请求 - response: UpdateJobLevelResponse = await client.contact.v3.job_level.aupdate(request) + # 发起请求 + response: UpdateJobLevelResponse = await client.contact.v3.job_level.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.job_level.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.job_level.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_user_id_user_sample.py b/samples/api/contact/v3/update_user_id_user_sample.py index f07775214..e6fd7d6c4 100644 --- a/samples/api/contact/v3/update_user_id_user_sample.py +++ b/samples/api/contact/v3/update_user_id_user_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserIdUserRequest = UpdateUserIdUserRequest.builder() \ - .user_id("str") \ - .user_id_type("user_id") \ - .request_body(UpdateUserIdUserRequestBody.builder() - .new_user_id("3e3cf96b") - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserIdUserRequest = UpdateUserIdUserRequest.builder() \ + .user_id("str") \ + .user_id_type("user_id") \ + .request_body(UpdateUserIdUserRequestBody.builder() + .new_user_id("3e3cf96b") + .build()) \ + .build() - # 发起请求 - response: UpdateUserIdUserResponse = client.contact.v3.user.update_user_id(request) + # 发起请求 + response: UpdateUserIdUserResponse = client.contact.v3.user.update_user_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.update_user_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.update_user_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserIdUserRequest = UpdateUserIdUserRequest.builder() \ - .user_id("str") \ - .user_id_type("user_id") \ - .request_body(UpdateUserIdUserRequestBody.builder() - .new_user_id("3e3cf96b") - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserIdUserRequest = UpdateUserIdUserRequest.builder() \ + .user_id("str") \ + .user_id_type("user_id") \ + .request_body(UpdateUserIdUserRequestBody.builder() + .new_user_id("3e3cf96b") + .build()) \ + .build() - # 发起请求 - response: UpdateUserIdUserResponse = await client.contact.v3.user.aupdate_user_id(request) + # 发起请求 + response: UpdateUserIdUserResponse = await client.contact.v3.user.aupdate_user_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.aupdate_user_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.aupdate_user_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/contact/v3/update_user_sample.py b/samples/api/contact/v3/update_user_sample.py index c87c441cf..7c07513b5 100644 --- a/samples/api/contact/v3/update_user_sample.py +++ b/samples/api/contact/v3/update_user_sample.py @@ -5,108 +5,108 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserRequest = UpdateUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(User.builder() - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .is_frozen(False) - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserRequest = UpdateUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(User.builder() + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .is_frozen(False) + .build()) \ + .build() - # 发起请求 - response: UpdateUserResponse = client.contact.v3.user.update(request) + # 发起请求 + response: UpdateUserResponse = client.contact.v3.user.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateUserRequest = UpdateUserRequest.builder() \ - .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(User.builder() - .name("张三") - .en_name("San Zhang") - .nickname("Alex Zhang") - .email("zhangsan@gmail.com") - .mobile("+41446681800") - .mobile_visible(False) - .gender(0) - .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") - .department_ids([]) - .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .city("杭州") - .country("CN") - .work_station("北楼-H34") - .join_time(2147483647) - .employee_no("1") - .employee_type(1) - .orders([]) - .custom_attrs([]) - .enterprise_email("demo@mail.com") - .job_title("xxxxx") - .is_frozen(False) - .build()) \ - .build() + # 构造请求对象 + request: UpdateUserRequest = UpdateUserRequest.builder() \ + .user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(User.builder() + .name("张三") + .en_name("San Zhang") + .nickname("Alex Zhang") + .email("zhangsan@gmail.com") + .mobile("+41446681800") + .mobile_visible(False) + .gender(0) + .avatar_key("2500c7a9-5fff-4d9a-a2de-3d59614ae28g") + .department_ids([]) + .leader_user_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .city("杭州") + .country("CN") + .work_station("北楼-H34") + .join_time(2147483647) + .employee_no("1") + .employee_type(1) + .orders([]) + .custom_attrs([]) + .enterprise_email("demo@mail.com") + .job_title("xxxxx") + .is_frozen(False) + .build()) \ + .build() - # 发起请求 - response: UpdateUserResponse = await client.contact.v3.user.aupdate(request) + # 发起请求 + response: UpdateUserResponse = await client.contact.v3.user.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.contact.v3.user.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.contact.v3.user.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/add_enum_option_common_data_meta_data_sample.py b/samples/api/corehr/v1/add_enum_option_common_data_meta_data_sample.py index adbd928a2..0a32a3ff7 100644 --- a/samples/api/corehr/v1/add_enum_option_common_data_meta_data_sample.py +++ b/samples/api/corehr/v1/add_enum_option_common_data_meta_data_sample.py @@ -5,69 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddEnumOptionCommonDataMetaDataRequest = AddEnumOptionCommonDataMetaDataRequest.builder() \ - .client_token("6727817538283013641") \ - .request_body(AddEnumOptionCommonDataMetaDataRequestBody.builder() - .object_api_name("probation_management") - .enum_field_api_name("final_assessment_grade") - .enum_field_options([]) - .build()) \ - .build() + # 构造请求对象 + request: AddEnumOptionCommonDataMetaDataRequest = AddEnumOptionCommonDataMetaDataRequest.builder() \ + .client_token("6727817538283013641") \ + .request_body(AddEnumOptionCommonDataMetaDataRequestBody.builder() + .object_api_name("probation_management") + .enum_field_api_name("final_assessment_grade") + .enum_field_options([]) + .build()) \ + .build() - # 发起请求 - response: AddEnumOptionCommonDataMetaDataResponse = client.corehr.v1.common_data_meta_data.add_enum_option(request) + # 发起请求 + response: AddEnumOptionCommonDataMetaDataResponse = client.corehr.v1.common_data_meta_data.add_enum_option(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_meta_data.add_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_meta_data.add_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddEnumOptionCommonDataMetaDataRequest = AddEnumOptionCommonDataMetaDataRequest.builder() \ - .client_token("6727817538283013641") \ - .request_body(AddEnumOptionCommonDataMetaDataRequestBody.builder() - .object_api_name("probation_management") - .enum_field_api_name("final_assessment_grade") - .enum_field_options([]) - .build()) \ - .build() + # 构造请求对象 + request: AddEnumOptionCommonDataMetaDataRequest = AddEnumOptionCommonDataMetaDataRequest.builder() \ + .client_token("6727817538283013641") \ + .request_body(AddEnumOptionCommonDataMetaDataRequestBody.builder() + .object_api_name("probation_management") + .enum_field_api_name("final_assessment_grade") + .enum_field_options([]) + .build()) \ + .build() - # 发起请求 - response: AddEnumOptionCommonDataMetaDataResponse = await client.corehr.v1.common_data_meta_data.aadd_enum_option( - request) + # 发起请求 + response: AddEnumOptionCommonDataMetaDataResponse = await client.corehr.v1.common_data_meta_data.aadd_enum_option(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_meta_data.aadd_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_meta_data.aadd_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/add_role_assign_authorization_sample.py b/samples/api/corehr/v1/add_role_assign_authorization_sample.py index bbdc74e1d..e08641cee 100644 --- a/samples/api/corehr/v1/add_role_assign_authorization_sample.py +++ b/samples/api/corehr/v1/add_role_assign_authorization_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddRoleAssignAuthorizationRequest = AddRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .request_body(AddRoleAssignAuthorizationRequestBody.builder() - .assigned_organization_items([]) - .build()) \ - .build() + # 构造请求对象 + request: AddRoleAssignAuthorizationRequest = AddRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .request_body(AddRoleAssignAuthorizationRequestBody.builder() + .assigned_organization_items([]) + .build()) \ + .build() - # 发起请求 - response: AddRoleAssignAuthorizationResponse = client.corehr.v1.authorization.add_role_assign(request) + # 发起请求 + response: AddRoleAssignAuthorizationResponse = client.corehr.v1.authorization.add_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.add_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.add_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddRoleAssignAuthorizationRequest = AddRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .request_body(AddRoleAssignAuthorizationRequestBody.builder() - .assigned_organization_items([]) - .build()) \ - .build() + # 构造请求对象 + request: AddRoleAssignAuthorizationRequest = AddRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .request_body(AddRoleAssignAuthorizationRequestBody.builder() + .assigned_organization_items([]) + .build()) \ + .build() - # 发起请求 - response: AddRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aadd_role_assign(request) + # 发起请求 + response: AddRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aadd_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.aadd_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.aadd_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/convert_common_data_id_sample.py b/samples/api/corehr/v1/convert_common_data_id_sample.py index 0a7df8acb..d3fb98cea 100644 --- a/samples/api/corehr/v1/convert_common_data_id_sample.py +++ b/samples/api/corehr/v1/convert_common_data_id_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ConvertCommonDataIdRequest = ConvertCommonDataIdRequest.builder() \ - .id_transform_type(1) \ - .id_type("employment_id") \ - .feishu_user_id_type("open_id") \ - .feishu_department_id_type("open_department_id") \ - .request_body(ConvertCommonDataIdRequestBody.builder() - .ids([]) - .build()) \ - .build() + # 构造请求对象 + request: ConvertCommonDataIdRequest = ConvertCommonDataIdRequest.builder() \ + .id_transform_type(1) \ + .id_type("employment_id") \ + .feishu_user_id_type("open_id") \ + .feishu_department_id_type("open_department_id") \ + .request_body(ConvertCommonDataIdRequestBody.builder() + .ids([]) + .build()) \ + .build() - # 发起请求 - response: ConvertCommonDataIdResponse = client.corehr.v1.common_data_id.convert(request) + # 发起请求 + response: ConvertCommonDataIdResponse = client.corehr.v1.common_data_id.convert(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_id.convert failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_id.convert failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ConvertCommonDataIdRequest = ConvertCommonDataIdRequest.builder() \ - .id_transform_type(1) \ - .id_type("employment_id") \ - .feishu_user_id_type("open_id") \ - .feishu_department_id_type("open_department_id") \ - .request_body(ConvertCommonDataIdRequestBody.builder() - .ids([]) - .build()) \ - .build() + # 构造请求对象 + request: ConvertCommonDataIdRequest = ConvertCommonDataIdRequest.builder() \ + .id_transform_type(1) \ + .id_type("employment_id") \ + .feishu_user_id_type("open_id") \ + .feishu_department_id_type("open_department_id") \ + .request_body(ConvertCommonDataIdRequestBody.builder() + .ids([]) + .build()) \ + .build() - # 发起请求 - response: ConvertCommonDataIdResponse = await client.corehr.v1.common_data_id.aconvert(request) + # 发起请求 + response: ConvertCommonDataIdResponse = await client.corehr.v1.common_data_id.aconvert(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_id.aconvert failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_id.aconvert failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_company_sample.py b/samples/api/corehr/v1/create_company_sample.py index c13c2d1ac..b63cd5908 100644 --- a/samples/api/corehr/v1/create_company_sample.py +++ b/samples/api/corehr/v1/create_company_sample.py @@ -5,94 +5,94 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCompanyRequest = CreateCompanyRequest.builder() \ - .client_token("12454646") \ - .request_body(Company.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .type(Enum.builder().build()) - .industry_list([]) - .legal_representative([]) - .post_code("邮编") - .tax_payer_id("123456840") - .confidential(True) - .sub_type_list([]) - .branch_company(True) - .primary_manager([]) - .custom_fields([]) - .currency(Currency.builder().build()) - .phone(PhoneNumberAndAreaCode.builder().build()) - .fax(PhoneNumberAndAreaCode.builder().build()) - .registered_office_address_info(Address.builder().build()) - .office_address_info(Address.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCompanyRequest = CreateCompanyRequest.builder() \ + .client_token("12454646") \ + .request_body(Company.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .type(Enum.builder().build()) + .industry_list([]) + .legal_representative([]) + .post_code("邮编") + .tax_payer_id("123456840") + .confidential(True) + .sub_type_list([]) + .branch_company(True) + .primary_manager([]) + .custom_fields([]) + .currency(Currency.builder().build()) + .phone(PhoneNumberAndAreaCode.builder().build()) + .fax(PhoneNumberAndAreaCode.builder().build()) + .registered_office_address_info(Address.builder().build()) + .office_address_info(Address.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCompanyResponse = client.corehr.v1.company.create(request) + # 发起请求 + response: CreateCompanyResponse = client.corehr.v1.company.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCompanyRequest = CreateCompanyRequest.builder() \ - .client_token("12454646") \ - .request_body(Company.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .type(Enum.builder().build()) - .industry_list([]) - .legal_representative([]) - .post_code("邮编") - .tax_payer_id("123456840") - .confidential(True) - .sub_type_list([]) - .branch_company(True) - .primary_manager([]) - .custom_fields([]) - .currency(Currency.builder().build()) - .phone(PhoneNumberAndAreaCode.builder().build()) - .fax(PhoneNumberAndAreaCode.builder().build()) - .registered_office_address_info(Address.builder().build()) - .office_address_info(Address.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCompanyRequest = CreateCompanyRequest.builder() \ + .client_token("12454646") \ + .request_body(Company.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .type(Enum.builder().build()) + .industry_list([]) + .legal_representative([]) + .post_code("邮编") + .tax_payer_id("123456840") + .confidential(True) + .sub_type_list([]) + .branch_company(True) + .primary_manager([]) + .custom_fields([]) + .currency(Currency.builder().build()) + .phone(PhoneNumberAndAreaCode.builder().build()) + .fax(PhoneNumberAndAreaCode.builder().build()) + .registered_office_address_info(Address.builder().build()) + .office_address_info(Address.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCompanyResponse = await client.corehr.v1.company.acreate(request) + # 发起请求 + response: CreateCompanyResponse = await client.corehr.v1.company.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_contract_sample.py b/samples/api/corehr/v1/create_contract_sample.py index 9e669df8e..3cb45539f 100644 --- a/samples/api/corehr/v1/create_contract_sample.py +++ b/samples/api/corehr/v1/create_contract_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateContractRequest = CreateContractRequest.builder() \ - .client_token("12454646") \ - .request_body(Contract.builder() - .effective_time("2050-01-01 00:00:00") - .expiration_time("9999-12-31 23:59:59") - .employment_id("6893013238632416776") - .contract_type(Enum.builder().build()) - .first_party_company_id("6892686614112241165") - .person_id("151515151") - .custom_fields([]) - .duration_type(Enum.builder().build()) - .contract_end_date("2006-01-02") - .contract_number("6919737965274990093") - .signing_type(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateContractRequest = CreateContractRequest.builder() \ + .client_token("12454646") \ + .request_body(Contract.builder() + .effective_time("2050-01-01 00:00:00") + .expiration_time("9999-12-31 23:59:59") + .employment_id("6893013238632416776") + .contract_type(Enum.builder().build()) + .first_party_company_id("6892686614112241165") + .person_id("151515151") + .custom_fields([]) + .duration_type(Enum.builder().build()) + .contract_end_date("2006-01-02") + .contract_number("6919737965274990093") + .signing_type(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateContractResponse = client.corehr.v1.contract.create(request) + # 发起请求 + response: CreateContractResponse = client.corehr.v1.contract.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateContractRequest = CreateContractRequest.builder() \ - .client_token("12454646") \ - .request_body(Contract.builder() - .effective_time("2050-01-01 00:00:00") - .expiration_time("9999-12-31 23:59:59") - .employment_id("6893013238632416776") - .contract_type(Enum.builder().build()) - .first_party_company_id("6892686614112241165") - .person_id("151515151") - .custom_fields([]) - .duration_type(Enum.builder().build()) - .contract_end_date("2006-01-02") - .contract_number("6919737965274990093") - .signing_type(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateContractRequest = CreateContractRequest.builder() \ + .client_token("12454646") \ + .request_body(Contract.builder() + .effective_time("2050-01-01 00:00:00") + .expiration_time("9999-12-31 23:59:59") + .employment_id("6893013238632416776") + .contract_type(Enum.builder().build()) + .first_party_company_id("6892686614112241165") + .person_id("151515151") + .custom_fields([]) + .duration_type(Enum.builder().build()) + .contract_end_date("2006-01-02") + .contract_number("6919737965274990093") + .signing_type(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateContractResponse = await client.corehr.v1.contract.acreate(request) + # 发起请求 + response: CreateContractResponse = await client.corehr.v1.contract.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_department_sample.py b/samples/api/corehr/v1/create_department_sample.py index f3d3d0744..f540fb341 100644 --- a/samples/api/corehr/v1/create_department_sample.py +++ b/samples/api/corehr/v1/create_department_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(DepartmentCreate.builder() - .sub_type(Enum.builder().build()) - .manager("6893013238632416776") - .is_confidential(True) - .hiberarchy_common(HiberarchyCommon.builder().build()) - .effective_time("2020-05-01 00:00:00") - .custom_fields([]) - .cost_center_id("7142384817131652652") - .staffing_model(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(DepartmentCreate.builder() + .sub_type(Enum.builder().build()) + .manager("6893013238632416776") + .is_confidential(True) + .hiberarchy_common(HiberarchyCommon.builder().build()) + .effective_time("2020-05-01 00:00:00") + .custom_fields([]) + .cost_center_id("7142384817131652652") + .staffing_model(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateDepartmentResponse = client.corehr.v1.department.create(request) + # 发起请求 + response: CreateDepartmentResponse = client.corehr.v1.department.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(DepartmentCreate.builder() - .sub_type(Enum.builder().build()) - .manager("6893013238632416776") - .is_confidential(True) - .hiberarchy_common(HiberarchyCommon.builder().build()) - .effective_time("2020-05-01 00:00:00") - .custom_fields([]) - .cost_center_id("7142384817131652652") - .staffing_model(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateDepartmentRequest = CreateDepartmentRequest.builder() \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(DepartmentCreate.builder() + .sub_type(Enum.builder().build()) + .manager("6893013238632416776") + .is_confidential(True) + .hiberarchy_common(HiberarchyCommon.builder().build()) + .effective_time("2020-05-01 00:00:00") + .custom_fields([]) + .cost_center_id("7142384817131652652") + .staffing_model(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateDepartmentResponse = await client.corehr.v1.department.acreate(request) + # 发起请求 + response: CreateDepartmentResponse = await client.corehr.v1.department.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_employee_type_sample.py b/samples/api/corehr/v1/create_employee_type_sample.py index 5f64bc312..a22442e3b 100644 --- a/samples/api/corehr/v1/create_employee_type_sample.py +++ b/samples/api/corehr/v1/create_employee_type_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeTypeRequest = CreateEmployeeTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(EmployeeType.builder() - .name([]) - .default_employee_type(True) - .active(True) - .code("1245") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeTypeRequest = CreateEmployeeTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(EmployeeType.builder() + .name([]) + .default_employee_type(True) + .active(True) + .code("1245") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeTypeResponse = client.corehr.v1.employee_type.create(request) + # 发起请求 + response: CreateEmployeeTypeResponse = client.corehr.v1.employee_type.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeTypeRequest = CreateEmployeeTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(EmployeeType.builder() - .name([]) - .default_employee_type(True) - .active(True) - .code("1245") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeTypeRequest = CreateEmployeeTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(EmployeeType.builder() + .name([]) + .default_employee_type(True) + .active(True) + .code("1245") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeTypeResponse = await client.corehr.v1.employee_type.acreate(request) + # 发起请求 + response: CreateEmployeeTypeResponse = await client.corehr.v1.employee_type.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_employment_sample.py b/samples/api/corehr/v1/create_employment_sample.py index 766349647..fa1d11727 100644 --- a/samples/api/corehr/v1/create_employment_sample.py +++ b/samples/api/corehr/v1/create_employment_sample.py @@ -5,90 +5,90 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmploymentRequest = CreateEmploymentRequest.builder() \ - .client_token("12454646") \ - .request_body(EmploymentCreate.builder() - .seniority_date("2020-01-01") - .employee_number("1000000") - .effective_time("2020-01-01") - .expiration_time("2021-01-01") - .employment_type(Enum.builder().build()) - .person_id("6919733936050406926") - .primary_employment(True) - .employment_status(Enum.builder().build()) - .custom_fields([]) - .work_email_list([]) - .reason_for_offboarding(Enum.builder().build()) - .ats_application_id("6838119494196871234") - .rehire(Enum.builder().build()) - .rehire_employment_id("7051837122449425964") - .build()) \ - .build() + # 构造请求对象 + request: CreateEmploymentRequest = CreateEmploymentRequest.builder() \ + .client_token("12454646") \ + .request_body(EmploymentCreate.builder() + .seniority_date("2020-01-01") + .employee_number("1000000") + .effective_time("2020-01-01") + .expiration_time("2021-01-01") + .employment_type(Enum.builder().build()) + .person_id("6919733936050406926") + .primary_employment(True) + .employment_status(Enum.builder().build()) + .custom_fields([]) + .work_email_list([]) + .reason_for_offboarding(Enum.builder().build()) + .ats_application_id("6838119494196871234") + .rehire(Enum.builder().build()) + .rehire_employment_id("7051837122449425964") + .build()) \ + .build() - # 发起请求 - response: CreateEmploymentResponse = client.corehr.v1.employment.create(request) + # 发起请求 + response: CreateEmploymentResponse = client.corehr.v1.employment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmploymentRequest = CreateEmploymentRequest.builder() \ - .client_token("12454646") \ - .request_body(EmploymentCreate.builder() - .seniority_date("2020-01-01") - .employee_number("1000000") - .effective_time("2020-01-01") - .expiration_time("2021-01-01") - .employment_type(Enum.builder().build()) - .person_id("6919733936050406926") - .primary_employment(True) - .employment_status(Enum.builder().build()) - .custom_fields([]) - .work_email_list([]) - .reason_for_offboarding(Enum.builder().build()) - .ats_application_id("6838119494196871234") - .rehire(Enum.builder().build()) - .rehire_employment_id("7051837122449425964") - .build()) \ - .build() + # 构造请求对象 + request: CreateEmploymentRequest = CreateEmploymentRequest.builder() \ + .client_token("12454646") \ + .request_body(EmploymentCreate.builder() + .seniority_date("2020-01-01") + .employee_number("1000000") + .effective_time("2020-01-01") + .expiration_time("2021-01-01") + .employment_type(Enum.builder().build()) + .person_id("6919733936050406926") + .primary_employment(True) + .employment_status(Enum.builder().build()) + .custom_fields([]) + .work_email_list([]) + .reason_for_offboarding(Enum.builder().build()) + .ats_application_id("6838119494196871234") + .rehire(Enum.builder().build()) + .rehire_employment_id("7051837122449425964") + .build()) \ + .build() - # 发起请求 - response: CreateEmploymentResponse = await client.corehr.v1.employment.acreate(request) + # 发起请求 + response: CreateEmploymentResponse = await client.corehr.v1.employment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_job_change_sample.py b/samples/api/corehr/v1/create_job_change_sample.py index 7b328ae80..f853729d5 100644 --- a/samples/api/corehr/v1/create_job_change_sample.py +++ b/samples/api/corehr/v1/create_job_change_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobChangeRequest = CreateJobChangeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(CreateJobChangeRequestBody.builder() - .transfer_mode(2) - .employment_id("ou_a294793e8fa21529f2a60e3e9de45520") - .transfer_type_unique_identifier("internal_transfer") - .flow_id("people_6963913041981490725_6983885526583627531") - .effective_date("2022-03-01") - .transfer_info(TransferInfo.builder().build()) - .transfer_key("transfer_3627531") - .initiator_id("ou_a294793e8fa21529f2a60e3e9de45520") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobChangeRequest = CreateJobChangeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(CreateJobChangeRequestBody.builder() + .transfer_mode(2) + .employment_id("ou_a294793e8fa21529f2a60e3e9de45520") + .transfer_type_unique_identifier("internal_transfer") + .flow_id("people_6963913041981490725_6983885526583627531") + .effective_date("2022-03-01") + .transfer_info(TransferInfo.builder().build()) + .transfer_key("transfer_3627531") + .initiator_id("ou_a294793e8fa21529f2a60e3e9de45520") + .build()) \ + .build() - # 发起请求 - response: CreateJobChangeResponse = client.corehr.v1.job_change.create(request) + # 发起请求 + response: CreateJobChangeResponse = client.corehr.v1.job_change.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_change.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_change.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobChangeRequest = CreateJobChangeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(CreateJobChangeRequestBody.builder() - .transfer_mode(2) - .employment_id("ou_a294793e8fa21529f2a60e3e9de45520") - .transfer_type_unique_identifier("internal_transfer") - .flow_id("people_6963913041981490725_6983885526583627531") - .effective_date("2022-03-01") - .transfer_info(TransferInfo.builder().build()) - .transfer_key("transfer_3627531") - .initiator_id("ou_a294793e8fa21529f2a60e3e9de45520") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobChangeRequest = CreateJobChangeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(CreateJobChangeRequestBody.builder() + .transfer_mode(2) + .employment_id("ou_a294793e8fa21529f2a60e3e9de45520") + .transfer_type_unique_identifier("internal_transfer") + .flow_id("people_6963913041981490725_6983885526583627531") + .effective_date("2022-03-01") + .transfer_info(TransferInfo.builder().build()) + .transfer_key("transfer_3627531") + .initiator_id("ou_a294793e8fa21529f2a60e3e9de45520") + .build()) \ + .build() - # 发起请求 - response: CreateJobChangeResponse = await client.corehr.v1.job_change.acreate(request) + # 发起请求 + response: CreateJobChangeResponse = await client.corehr.v1.job_change.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_change.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_change.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_job_data_sample.py b/samples/api/corehr/v1/create_job_data_sample.py index 4c2221eb7..a3a57ae3c 100644 --- a/samples/api/corehr/v1/create_job_data_sample.py +++ b/samples/api/corehr/v1/create_job_data_sample.py @@ -5,112 +5,112 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobDataRequest = CreateJobDataRequest.builder() \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(JobData.builder() - .job_level_id("6890452208593372679") - .job_grade_id("6890452208593372679") - .employee_type_id("6890452208593372679") - .working_hours_type_id("6890452208593372679") - .work_location_id("6890452208593372679") - .department_id("6890452208593372679") - .job_id("6890452208593372679") - .probation_start_date("2018-03-16T00:00:00") - .probation_end_date("2019-05-24T00:00:00") - .primary_job_data(True) - .employment_id("6893014062142064135") - .effective_time("2020-05-01 00:00:00") - .expiration_time("2020-05-02 00:00:00") - .job_family_id("1245678") - .assignment_start_reason(Enum.builder().build()) - .probation_expected_end_date("2006-01-02") - .direct_manager_id("6890452208593372679") - .dotted_line_manager_id_list([]) - .second_direct_manager_id("6890452208593372679") - .cost_center_rate([]) - .work_shift(Enum.builder().build()) - .compensation_type(Enum.builder().build()) - .service_company("6890452208593372680") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobDataRequest = CreateJobDataRequest.builder() \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(JobData.builder() + .job_level_id("6890452208593372679") + .job_grade_id("6890452208593372679") + .employee_type_id("6890452208593372679") + .working_hours_type_id("6890452208593372679") + .work_location_id("6890452208593372679") + .department_id("6890452208593372679") + .job_id("6890452208593372679") + .probation_start_date("2018-03-16T00:00:00") + .probation_end_date("2019-05-24T00:00:00") + .primary_job_data(True) + .employment_id("6893014062142064135") + .effective_time("2020-05-01 00:00:00") + .expiration_time("2020-05-02 00:00:00") + .job_family_id("1245678") + .assignment_start_reason(Enum.builder().build()) + .probation_expected_end_date("2006-01-02") + .direct_manager_id("6890452208593372679") + .dotted_line_manager_id_list([]) + .second_direct_manager_id("6890452208593372679") + .cost_center_rate([]) + .work_shift(Enum.builder().build()) + .compensation_type(Enum.builder().build()) + .service_company("6890452208593372680") + .build()) \ + .build() - # 发起请求 - response: CreateJobDataResponse = client.corehr.v1.job_data.create(request) + # 发起请求 + response: CreateJobDataResponse = client.corehr.v1.job_data.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobDataRequest = CreateJobDataRequest.builder() \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(JobData.builder() - .job_level_id("6890452208593372679") - .job_grade_id("6890452208593372679") - .employee_type_id("6890452208593372679") - .working_hours_type_id("6890452208593372679") - .work_location_id("6890452208593372679") - .department_id("6890452208593372679") - .job_id("6890452208593372679") - .probation_start_date("2018-03-16T00:00:00") - .probation_end_date("2019-05-24T00:00:00") - .primary_job_data(True) - .employment_id("6893014062142064135") - .effective_time("2020-05-01 00:00:00") - .expiration_time("2020-05-02 00:00:00") - .job_family_id("1245678") - .assignment_start_reason(Enum.builder().build()) - .probation_expected_end_date("2006-01-02") - .direct_manager_id("6890452208593372679") - .dotted_line_manager_id_list([]) - .second_direct_manager_id("6890452208593372679") - .cost_center_rate([]) - .work_shift(Enum.builder().build()) - .compensation_type(Enum.builder().build()) - .service_company("6890452208593372680") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobDataRequest = CreateJobDataRequest.builder() \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(JobData.builder() + .job_level_id("6890452208593372679") + .job_grade_id("6890452208593372679") + .employee_type_id("6890452208593372679") + .working_hours_type_id("6890452208593372679") + .work_location_id("6890452208593372679") + .department_id("6890452208593372679") + .job_id("6890452208593372679") + .probation_start_date("2018-03-16T00:00:00") + .probation_end_date("2019-05-24T00:00:00") + .primary_job_data(True) + .employment_id("6893014062142064135") + .effective_time("2020-05-01 00:00:00") + .expiration_time("2020-05-02 00:00:00") + .job_family_id("1245678") + .assignment_start_reason(Enum.builder().build()) + .probation_expected_end_date("2006-01-02") + .direct_manager_id("6890452208593372679") + .dotted_line_manager_id_list([]) + .second_direct_manager_id("6890452208593372679") + .cost_center_rate([]) + .work_shift(Enum.builder().build()) + .compensation_type(Enum.builder().build()) + .service_company("6890452208593372680") + .build()) \ + .build() - # 发起请求 - response: CreateJobDataResponse = await client.corehr.v1.job_data.acreate(request) + # 发起请求 + response: CreateJobDataResponse = await client.corehr.v1.job_data.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_job_family_sample.py b/samples/api/corehr/v1/create_job_family_sample.py index 218c51591..5034c95aa 100644 --- a/samples/api/corehr/v1/create_job_family_sample.py +++ b/samples/api/corehr/v1/create_job_family_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ - .client_token("12454646") \ - .request_body(JobFamily.builder() - .name([]) - .active(True) - .parent_id("4698020757495316313") - .effective_time("2020-05-01 00:00:00") - .code("123456") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ + .client_token("12454646") \ + .request_body(JobFamily.builder() + .name([]) + .active(True) + .parent_id("4698020757495316313") + .effective_time("2020-05-01 00:00:00") + .code("123456") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobFamilyResponse = client.corehr.v1.job_family.create(request) + # 发起请求 + response: CreateJobFamilyResponse = client.corehr.v1.job_family.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ - .client_token("12454646") \ - .request_body(JobFamily.builder() - .name([]) - .active(True) - .parent_id("4698020757495316313") - .effective_time("2020-05-01 00:00:00") - .code("123456") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobFamilyRequest = CreateJobFamilyRequest.builder() \ + .client_token("12454646") \ + .request_body(JobFamily.builder() + .name([]) + .active(True) + .parent_id("4698020757495316313") + .effective_time("2020-05-01 00:00:00") + .code("123456") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobFamilyResponse = await client.corehr.v1.job_family.acreate(request) + # 发起请求 + response: CreateJobFamilyResponse = await client.corehr.v1.job_family.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_job_level_sample.py b/samples/api/corehr/v1/create_job_level_sample.py index 79be77e0f..98c0f15fa 100644 --- a/samples/api/corehr/v1/create_job_level_sample.py +++ b/samples/api/corehr/v1/create_job_level_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ - .client_token("12454646") \ - .request_body(JobLevel.builder() - .level_order(9999) - .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") - .name([]) - .description([]) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ + .client_token("12454646") \ + .request_body(JobLevel.builder() + .level_order(9999) + .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") + .name([]) + .description([]) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobLevelResponse = client.corehr.v1.job_level.create(request) + # 发起请求 + response: CreateJobLevelResponse = client.corehr.v1.job_level.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ - .client_token("12454646") \ - .request_body(JobLevel.builder() - .level_order(9999) - .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") - .name([]) - .description([]) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobLevelRequest = CreateJobLevelRequest.builder() \ + .client_token("12454646") \ + .request_body(JobLevel.builder() + .level_order(9999) + .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") + .name([]) + .description([]) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobLevelResponse = await client.corehr.v1.job_level.acreate(request) + # 发起请求 + response: CreateJobLevelResponse = await client.corehr.v1.job_level.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_job_sample.py b/samples/api/corehr/v1/create_job_sample.py index 0e4e105b9..2fd40b0e2 100644 --- a/samples/api/corehr/v1/create_job_sample.py +++ b/samples/api/corehr/v1/create_job_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobRequest = CreateJobRequest.builder() \ - .client_token("12454646") \ - .request_body(Job.builder() - .code("JP422119") - .name([]) - .description([]) - .active(True) - .job_title([]) - .job_family_id_list([]) - .job_level_id_list([]) - .working_hours_type_id("6890452208593372679") - .effective_time("2020-01-01 00:00:00") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobRequest = CreateJobRequest.builder() \ + .client_token("12454646") \ + .request_body(Job.builder() + .code("JP422119") + .name([]) + .description([]) + .active(True) + .job_title([]) + .job_family_id_list([]) + .job_level_id_list([]) + .working_hours_type_id("6890452208593372679") + .effective_time("2020-01-01 00:00:00") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobResponse = client.corehr.v1.job.create(request) + # 发起请求 + response: CreateJobResponse = client.corehr.v1.job.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobRequest = CreateJobRequest.builder() \ - .client_token("12454646") \ - .request_body(Job.builder() - .code("JP422119") - .name([]) - .description([]) - .active(True) - .job_title([]) - .job_family_id_list([]) - .job_level_id_list([]) - .working_hours_type_id("6890452208593372679") - .effective_time("2020-01-01 00:00:00") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateJobRequest = CreateJobRequest.builder() \ + .client_token("12454646") \ + .request_body(Job.builder() + .code("JP422119") + .name([]) + .description([]) + .active(True) + .job_title([]) + .job_family_id_list([]) + .job_level_id_list([]) + .working_hours_type_id("6890452208593372679") + .effective_time("2020-01-01 00:00:00") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateJobResponse = await client.corehr.v1.job.acreate(request) + # 发起请求 + response: CreateJobResponse = await client.corehr.v1.job.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_leave_granting_record_sample.py b/samples/api/corehr/v1/create_leave_granting_record_sample.py index e73f923d7..41b7c4e9e 100644 --- a/samples/api/corehr/v1/create_leave_granting_record_sample.py +++ b/samples/api/corehr/v1/create_leave_granting_record_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateLeaveGrantingRecordRequest = CreateLeaveGrantingRecordRequest.builder() \ - .user_id_type("open_id") \ - .request_body(CreateLeaveGrantingRecordRequestBody.builder() - .leave_type_id("7111688079785723436") - .employment_id("6982509313466189342") - .granting_quantity("0.5") - .granting_unit(1) - .effective_date("2022-01-01") - .expiration_date("2022-01-01") - .section_type(1) - .reason([]) - .external_id("111") - .build()) \ - .build() + # 构造请求对象 + request: CreateLeaveGrantingRecordRequest = CreateLeaveGrantingRecordRequest.builder() \ + .user_id_type("open_id") \ + .request_body(CreateLeaveGrantingRecordRequestBody.builder() + .leave_type_id("7111688079785723436") + .employment_id("6982509313466189342") + .granting_quantity("0.5") + .granting_unit(1) + .effective_date("2022-01-01") + .expiration_date("2022-01-01") + .section_type(1) + .reason([]) + .external_id("111") + .build()) \ + .build() - # 发起请求 - response: CreateLeaveGrantingRecordResponse = client.corehr.v1.leave_granting_record.create(request) + # 发起请求 + response: CreateLeaveGrantingRecordResponse = client.corehr.v1.leave_granting_record.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave_granting_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave_granting_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateLeaveGrantingRecordRequest = CreateLeaveGrantingRecordRequest.builder() \ - .user_id_type("open_id") \ - .request_body(CreateLeaveGrantingRecordRequestBody.builder() - .leave_type_id("7111688079785723436") - .employment_id("6982509313466189342") - .granting_quantity("0.5") - .granting_unit(1) - .effective_date("2022-01-01") - .expiration_date("2022-01-01") - .section_type(1) - .reason([]) - .external_id("111") - .build()) \ - .build() + # 构造请求对象 + request: CreateLeaveGrantingRecordRequest = CreateLeaveGrantingRecordRequest.builder() \ + .user_id_type("open_id") \ + .request_body(CreateLeaveGrantingRecordRequestBody.builder() + .leave_type_id("7111688079785723436") + .employment_id("6982509313466189342") + .granting_quantity("0.5") + .granting_unit(1) + .effective_date("2022-01-01") + .expiration_date("2022-01-01") + .section_type(1) + .reason([]) + .external_id("111") + .build()) \ + .build() - # 发起请求 - response: CreateLeaveGrantingRecordResponse = await client.corehr.v1.leave_granting_record.acreate(request) + # 发起请求 + response: CreateLeaveGrantingRecordResponse = await client.corehr.v1.leave_granting_record.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave_granting_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave_granting_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_location_sample.py b/samples/api/corehr/v1/create_location_sample.py index 99ce83883..1c9ab7d62 100644 --- a/samples/api/corehr/v1/create_location_sample.py +++ b/samples/api/corehr/v1/create_location_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateLocationRequest = CreateLocationRequest.builder() \ - .client_token("12454646") \ - .request_body(Location.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .location_usage_list([]) - .address([]) - .working_hours_type_id("4690238309151997779") - .effective_time("2020-05-01 00:00:00") - .locale(Enum.builder().build()) - .time_zone_id("123456789") - .display_language_id("123456789") - .build()) \ - .build() + # 构造请求对象 + request: CreateLocationRequest = CreateLocationRequest.builder() \ + .client_token("12454646") \ + .request_body(Location.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .location_usage_list([]) + .address([]) + .working_hours_type_id("4690238309151997779") + .effective_time("2020-05-01 00:00:00") + .locale(Enum.builder().build()) + .time_zone_id("123456789") + .display_language_id("123456789") + .build()) \ + .build() - # 发起请求 - response: CreateLocationResponse = client.corehr.v1.location.create(request) + # 发起请求 + response: CreateLocationResponse = client.corehr.v1.location.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateLocationRequest = CreateLocationRequest.builder() \ - .client_token("12454646") \ - .request_body(Location.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .location_usage_list([]) - .address([]) - .working_hours_type_id("4690238309151997779") - .effective_time("2020-05-01 00:00:00") - .locale(Enum.builder().build()) - .time_zone_id("123456789") - .display_language_id("123456789") - .build()) \ - .build() + # 构造请求对象 + request: CreateLocationRequest = CreateLocationRequest.builder() \ + .client_token("12454646") \ + .request_body(Location.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .location_usage_list([]) + .address([]) + .working_hours_type_id("4690238309151997779") + .effective_time("2020-05-01 00:00:00") + .locale(Enum.builder().build()) + .time_zone_id("123456789") + .display_language_id("123456789") + .build()) \ + .build() - # 发起请求 - response: CreateLocationResponse = await client.corehr.v1.location.acreate(request) + # 发起请求 + response: CreateLocationResponse = await client.corehr.v1.location.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_national_id_type_sample.py b/samples/api/corehr/v1/create_national_id_type_sample.py index 663f9a775..9678b07ae 100644 --- a/samples/api/corehr/v1/create_national_id_type_sample.py +++ b/samples/api/corehr/v1/create_national_id_type_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNationalIdTypeRequest = CreateNationalIdTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(NationalIdType.builder() - .country_region_id("6862995747139225096") - .name([]) - .active(True) - .validation_rule("") - .validation_rule_description([]) - .code("AUS-TFN") - .identification_type(Enum.builder().build()) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateNationalIdTypeRequest = CreateNationalIdTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(NationalIdType.builder() + .country_region_id("6862995747139225096") + .name([]) + .active(True) + .validation_rule("") + .validation_rule_description([]) + .code("AUS-TFN") + .identification_type(Enum.builder().build()) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateNationalIdTypeResponse = client.corehr.v1.national_id_type.create(request) + # 发起请求 + response: CreateNationalIdTypeResponse = client.corehr.v1.national_id_type.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNationalIdTypeRequest = CreateNationalIdTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(NationalIdType.builder() - .country_region_id("6862995747139225096") - .name([]) - .active(True) - .validation_rule("") - .validation_rule_description([]) - .code("AUS-TFN") - .identification_type(Enum.builder().build()) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateNationalIdTypeRequest = CreateNationalIdTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(NationalIdType.builder() + .country_region_id("6862995747139225096") + .name([]) + .active(True) + .validation_rule("") + .validation_rule_description([]) + .code("AUS-TFN") + .identification_type(Enum.builder().build()) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateNationalIdTypeResponse = await client.corehr.v1.national_id_type.acreate(request) + # 发起请求 + response: CreateNationalIdTypeResponse = await client.corehr.v1.national_id_type.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_person_sample.py b/samples/api/corehr/v1/create_person_sample.py index 1789a2305..1ba219210 100644 --- a/samples/api/corehr/v1/create_person_sample.py +++ b/samples/api/corehr/v1/create_person_sample.py @@ -5,104 +5,104 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePersonRequest = CreatePersonRequest.builder() \ - .client_token("12454646") \ - .request_body(Person.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .nationality_id("7075702732803278381") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .custom_fields([]) - .resident_tax_id_list([]) - .age(22) - .personal_profile([]) - .build()) \ - .build() + # 构造请求对象 + request: CreatePersonRequest = CreatePersonRequest.builder() \ + .client_token("12454646") \ + .request_body(Person.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .nationality_id("7075702732803278381") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .custom_fields([]) + .resident_tax_id_list([]) + .age(22) + .personal_profile([]) + .build()) \ + .build() - # 发起请求 - response: CreatePersonResponse = client.corehr.v1.person.create(request) + # 发起请求 + response: CreatePersonResponse = client.corehr.v1.person.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePersonRequest = CreatePersonRequest.builder() \ - .client_token("12454646") \ - .request_body(Person.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .nationality_id("7075702732803278381") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .custom_fields([]) - .resident_tax_id_list([]) - .age(22) - .personal_profile([]) - .build()) \ - .build() + # 构造请求对象 + request: CreatePersonRequest = CreatePersonRequest.builder() \ + .client_token("12454646") \ + .request_body(Person.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .nationality_id("7075702732803278381") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .custom_fields([]) + .resident_tax_id_list([]) + .age(22) + .personal_profile([]) + .build()) \ + .build() - # 发起请求 - response: CreatePersonResponse = await client.corehr.v1.person.acreate(request) + # 发起请求 + response: CreatePersonResponse = await client.corehr.v1.person.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/create_working_hours_type_sample.py b/samples/api/corehr/v1/create_working_hours_type_sample.py index 27272db6e..2faae6b70 100644 --- a/samples/api/corehr/v1/create_working_hours_type_sample.py +++ b/samples/api/corehr/v1/create_working_hours_type_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWorkingHoursTypeRequest = CreateWorkingHoursTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(WorkingHoursType.builder() - .code("1") - .name([]) - .country_region_id_list([]) - .default_for_job(True) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateWorkingHoursTypeRequest = CreateWorkingHoursTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(WorkingHoursType.builder() + .code("1") + .name([]) + .country_region_id_list([]) + .default_for_job(True) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.create(request) + # 发起请求 + response: CreateWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWorkingHoursTypeRequest = CreateWorkingHoursTypeRequest.builder() \ - .client_token("12454646") \ - .request_body(WorkingHoursType.builder() - .code("1") - .name([]) - .country_region_id_list([]) - .default_for_job(True) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateWorkingHoursTypeRequest = CreateWorkingHoursTypeRequest.builder() \ + .client_token("12454646") \ + .request_body(WorkingHoursType.builder() + .code("1") + .name([]) + .country_region_id_list([]) + .default_for_job(True) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: CreateWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.acreate(request) + # 发起请求 + response: CreateWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_company_sample.py b/samples/api/corehr/v1/delete_company_sample.py index f40adff89..6c4069cb5 100644 --- a/samples/api/corehr/v1/delete_company_sample.py +++ b/samples/api/corehr/v1/delete_company_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCompanyRequest = DeleteCompanyRequest.builder() \ - .company_id("341432424") \ - .build() + # 构造请求对象 + request: DeleteCompanyRequest = DeleteCompanyRequest.builder() \ + .company_id("341432424") \ + .build() - # 发起请求 - response: DeleteCompanyResponse = client.corehr.v1.company.delete(request) + # 发起请求 + response: DeleteCompanyResponse = client.corehr.v1.company.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCompanyRequest = DeleteCompanyRequest.builder() \ - .company_id("341432424") \ - .build() + # 构造请求对象 + request: DeleteCompanyRequest = DeleteCompanyRequest.builder() \ + .company_id("341432424") \ + .build() - # 发起请求 - response: DeleteCompanyResponse = await client.corehr.v1.company.adelete(request) + # 发起请求 + response: DeleteCompanyResponse = await client.corehr.v1.company.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_contract_sample.py b/samples/api/corehr/v1/delete_contract_sample.py index 50c6fd2d4..b948b0c6d 100644 --- a/samples/api/corehr/v1/delete_contract_sample.py +++ b/samples/api/corehr/v1/delete_contract_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteContractRequest = DeleteContractRequest.builder() \ - .contract_id("4137834332") \ - .build() + # 构造请求对象 + request: DeleteContractRequest = DeleteContractRequest.builder() \ + .contract_id("4137834332") \ + .build() - # 发起请求 - response: DeleteContractResponse = client.corehr.v1.contract.delete(request) + # 发起请求 + response: DeleteContractResponse = client.corehr.v1.contract.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteContractRequest = DeleteContractRequest.builder() \ - .contract_id("4137834332") \ - .build() + # 构造请求对象 + request: DeleteContractRequest = DeleteContractRequest.builder() \ + .contract_id("4137834332") \ + .build() - # 发起请求 - response: DeleteContractResponse = await client.corehr.v1.contract.adelete(request) + # 发起请求 + response: DeleteContractResponse = await client.corehr.v1.contract.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_department_sample.py b/samples/api/corehr/v1/delete_department_sample.py index c2900cdb0..fcd830847 100644 --- a/samples/api/corehr/v1/delete_department_sample.py +++ b/samples/api/corehr/v1/delete_department_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ - .department_id("341143141") \ - .build() + # 构造请求对象 + request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("341143141") \ + .build() - # 发起请求 - response: DeleteDepartmentResponse = client.corehr.v1.department.delete(request) + # 发起请求 + response: DeleteDepartmentResponse = client.corehr.v1.department.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ - .department_id("341143141") \ - .build() + # 构造请求对象 + request: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("341143141") \ + .build() - # 发起请求 - response: DeleteDepartmentResponse = await client.corehr.v1.department.adelete(request) + # 发起请求 + response: DeleteDepartmentResponse = await client.corehr.v1.department.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_employee_type_sample.py b/samples/api/corehr/v1/delete_employee_type_sample.py index 199c8dc32..85e7057c7 100644 --- a/samples/api/corehr/v1/delete_employee_type_sample.py +++ b/samples/api/corehr/v1/delete_employee_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmployeeTypeRequest = DeleteEmployeeTypeRequest.builder() \ - .employee_type_id("434343434") \ - .build() + # 构造请求对象 + request: DeleteEmployeeTypeRequest = DeleteEmployeeTypeRequest.builder() \ + .employee_type_id("434343434") \ + .build() - # 发起请求 - response: DeleteEmployeeTypeResponse = client.corehr.v1.employee_type.delete(request) + # 发起请求 + response: DeleteEmployeeTypeResponse = client.corehr.v1.employee_type.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmployeeTypeRequest = DeleteEmployeeTypeRequest.builder() \ - .employee_type_id("434343434") \ - .build() + # 构造请求对象 + request: DeleteEmployeeTypeRequest = DeleteEmployeeTypeRequest.builder() \ + .employee_type_id("434343434") \ + .build() - # 发起请求 - response: DeleteEmployeeTypeResponse = await client.corehr.v1.employee_type.adelete(request) + # 发起请求 + response: DeleteEmployeeTypeResponse = await client.corehr.v1.employee_type.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_employment_sample.py b/samples/api/corehr/v1/delete_employment_sample.py index 3162700c8..b234b808a 100644 --- a/samples/api/corehr/v1/delete_employment_sample.py +++ b/samples/api/corehr/v1/delete_employment_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmploymentRequest = DeleteEmploymentRequest.builder() \ - .employment_id("65536878783232") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: DeleteEmploymentRequest = DeleteEmploymentRequest.builder() \ + .employment_id("65536878783232") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: DeleteEmploymentResponse = client.corehr.v1.employment.delete(request) + # 发起请求 + response: DeleteEmploymentResponse = client.corehr.v1.employment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEmploymentRequest = DeleteEmploymentRequest.builder() \ - .employment_id("65536878783232") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: DeleteEmploymentRequest = DeleteEmploymentRequest.builder() \ + .employment_id("65536878783232") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: DeleteEmploymentResponse = await client.corehr.v1.employment.adelete(request) + # 发起请求 + response: DeleteEmploymentResponse = await client.corehr.v1.employment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_job_data_sample.py b/samples/api/corehr/v1/delete_job_data_sample.py index 581c64871..b27667b24 100644 --- a/samples/api/corehr/v1/delete_job_data_sample.py +++ b/samples/api/corehr/v1/delete_job_data_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ - .job_data_id("467642764726472") \ - .build() + # 构造请求对象 + request: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ + .job_data_id("467642764726472") \ + .build() - # 发起请求 - response: DeleteJobDataResponse = client.corehr.v1.job_data.delete(request) + # 发起请求 + response: DeleteJobDataResponse = client.corehr.v1.job_data.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ - .job_data_id("467642764726472") \ - .build() + # 构造请求对象 + request: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ + .job_data_id("467642764726472") \ + .build() - # 发起请求 - response: DeleteJobDataResponse = await client.corehr.v1.job_data.adelete(request) + # 发起请求 + response: DeleteJobDataResponse = await client.corehr.v1.job_data.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_job_family_sample.py b/samples/api/corehr/v1/delete_job_family_sample.py index 4a795d303..4fa368180 100644 --- a/samples/api/corehr/v1/delete_job_family_sample.py +++ b/samples/api/corehr/v1/delete_job_family_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ - .job_family_id("5425424525") \ - .build() + # 构造请求对象 + request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ + .job_family_id("5425424525") \ + .build() - # 发起请求 - response: DeleteJobFamilyResponse = client.corehr.v1.job_family.delete(request) + # 发起请求 + response: DeleteJobFamilyResponse = client.corehr.v1.job_family.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ - .job_family_id("5425424525") \ - .build() + # 构造请求对象 + request: DeleteJobFamilyRequest = DeleteJobFamilyRequest.builder() \ + .job_family_id("5425424525") \ + .build() - # 发起请求 - response: DeleteJobFamilyResponse = await client.corehr.v1.job_family.adelete(request) + # 发起请求 + response: DeleteJobFamilyResponse = await client.corehr.v1.job_family.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_job_level_sample.py b/samples/api/corehr/v1/delete_job_level_sample.py index c4087e5ae..82cdd065d 100644 --- a/samples/api/corehr/v1/delete_job_level_sample.py +++ b/samples/api/corehr/v1/delete_job_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ - .job_level_id("5423452542") \ - .build() + # 构造请求对象 + request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ + .job_level_id("5423452542") \ + .build() - # 发起请求 - response: DeleteJobLevelResponse = client.corehr.v1.job_level.delete(request) + # 发起请求 + response: DeleteJobLevelResponse = client.corehr.v1.job_level.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ - .job_level_id("5423452542") \ - .build() + # 构造请求对象 + request: DeleteJobLevelRequest = DeleteJobLevelRequest.builder() \ + .job_level_id("5423452542") \ + .build() - # 发起请求 - response: DeleteJobLevelResponse = await client.corehr.v1.job_level.adelete(request) + # 发起请求 + response: DeleteJobLevelResponse = await client.corehr.v1.job_level.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_job_sample.py b/samples/api/corehr/v1/delete_job_sample.py index 51a1f7b50..82c27c5fc 100644 --- a/samples/api/corehr/v1/delete_job_sample.py +++ b/samples/api/corehr/v1/delete_job_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobRequest = DeleteJobRequest.builder() \ - .job_id("67163716371") \ - .build() + # 构造请求对象 + request: DeleteJobRequest = DeleteJobRequest.builder() \ + .job_id("67163716371") \ + .build() - # 发起请求 - response: DeleteJobResponse = client.corehr.v1.job.delete(request) + # 发起请求 + response: DeleteJobResponse = client.corehr.v1.job.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobRequest = DeleteJobRequest.builder() \ - .job_id("67163716371") \ - .build() + # 构造请求对象 + request: DeleteJobRequest = DeleteJobRequest.builder() \ + .job_id("67163716371") \ + .build() - # 发起请求 - response: DeleteJobResponse = await client.corehr.v1.job.adelete(request) + # 发起请求 + response: DeleteJobResponse = await client.corehr.v1.job.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_leave_granting_record_sample.py b/samples/api/corehr/v1/delete_leave_granting_record_sample.py index d47a174b3..46b8c3af4 100644 --- a/samples/api/corehr/v1/delete_leave_granting_record_sample.py +++ b/samples/api/corehr/v1/delete_leave_granting_record_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteLeaveGrantingRecordRequest = DeleteLeaveGrantingRecordRequest.builder() \ - .leave_granting_record_id("6893014062142064135") \ - .build() + # 构造请求对象 + request: DeleteLeaveGrantingRecordRequest = DeleteLeaveGrantingRecordRequest.builder() \ + .leave_granting_record_id("6893014062142064135") \ + .build() - # 发起请求 - response: DeleteLeaveGrantingRecordResponse = client.corehr.v1.leave_granting_record.delete(request) + # 发起请求 + response: DeleteLeaveGrantingRecordResponse = client.corehr.v1.leave_granting_record.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave_granting_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave_granting_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteLeaveGrantingRecordRequest = DeleteLeaveGrantingRecordRequest.builder() \ - .leave_granting_record_id("6893014062142064135") \ - .build() + # 构造请求对象 + request: DeleteLeaveGrantingRecordRequest = DeleteLeaveGrantingRecordRequest.builder() \ + .leave_granting_record_id("6893014062142064135") \ + .build() - # 发起请求 - response: DeleteLeaveGrantingRecordResponse = await client.corehr.v1.leave_granting_record.adelete(request) + # 发起请求 + response: DeleteLeaveGrantingRecordResponse = await client.corehr.v1.leave_granting_record.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave_granting_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave_granting_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_location_sample.py b/samples/api/corehr/v1/delete_location_sample.py index 34ce890b4..33301a5b1 100644 --- a/samples/api/corehr/v1/delete_location_sample.py +++ b/samples/api/corehr/v1/delete_location_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteLocationRequest = DeleteLocationRequest.builder() \ - .location_id("4312443243") \ - .build() + # 构造请求对象 + request: DeleteLocationRequest = DeleteLocationRequest.builder() \ + .location_id("4312443243") \ + .build() - # 发起请求 - response: DeleteLocationResponse = client.corehr.v1.location.delete(request) + # 发起请求 + response: DeleteLocationResponse = client.corehr.v1.location.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteLocationRequest = DeleteLocationRequest.builder() \ - .location_id("4312443243") \ - .build() + # 构造请求对象 + request: DeleteLocationRequest = DeleteLocationRequest.builder() \ + .location_id("4312443243") \ + .build() - # 发起请求 - response: DeleteLocationResponse = await client.corehr.v1.location.adelete(request) + # 发起请求 + response: DeleteLocationResponse = await client.corehr.v1.location.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_national_id_type_sample.py b/samples/api/corehr/v1/delete_national_id_type_sample.py index 48f9549ea..28f68eb58 100644 --- a/samples/api/corehr/v1/delete_national_id_type_sample.py +++ b/samples/api/corehr/v1/delete_national_id_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteNationalIdTypeRequest = DeleteNationalIdTypeRequest.builder() \ - .national_id_type_id("27837817381") \ - .build() + # 构造请求对象 + request: DeleteNationalIdTypeRequest = DeleteNationalIdTypeRequest.builder() \ + .national_id_type_id("27837817381") \ + .build() - # 发起请求 - response: DeleteNationalIdTypeResponse = client.corehr.v1.national_id_type.delete(request) + # 发起请求 + response: DeleteNationalIdTypeResponse = client.corehr.v1.national_id_type.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteNationalIdTypeRequest = DeleteNationalIdTypeRequest.builder() \ - .national_id_type_id("27837817381") \ - .build() + # 构造请求对象 + request: DeleteNationalIdTypeRequest = DeleteNationalIdTypeRequest.builder() \ + .national_id_type_id("27837817381") \ + .build() - # 发起请求 - response: DeleteNationalIdTypeResponse = await client.corehr.v1.national_id_type.adelete(request) + # 发起请求 + response: DeleteNationalIdTypeResponse = await client.corehr.v1.national_id_type.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_person_sample.py b/samples/api/corehr/v1/delete_person_sample.py index 1ee558f6f..017cf7bc8 100644 --- a/samples/api/corehr/v1/delete_person_sample.py +++ b/samples/api/corehr/v1/delete_person_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePersonRequest = DeletePersonRequest.builder() \ - .person_id("654637829201") \ - .build() + # 构造请求对象 + request: DeletePersonRequest = DeletePersonRequest.builder() \ + .person_id("654637829201") \ + .build() - # 发起请求 - response: DeletePersonResponse = client.corehr.v1.person.delete(request) + # 发起请求 + response: DeletePersonResponse = client.corehr.v1.person.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePersonRequest = DeletePersonRequest.builder() \ - .person_id("654637829201") \ - .build() + # 构造请求对象 + request: DeletePersonRequest = DeletePersonRequest.builder() \ + .person_id("654637829201") \ + .build() - # 发起请求 - response: DeletePersonResponse = await client.corehr.v1.person.adelete(request) + # 发起请求 + response: DeletePersonResponse = await client.corehr.v1.person.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_pre_hire_sample.py b/samples/api/corehr/v1/delete_pre_hire_sample.py index fb118a699..3837d0237 100644 --- a/samples/api/corehr/v1/delete_pre_hire_sample.py +++ b/samples/api/corehr/v1/delete_pre_hire_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePreHireRequest = DeletePreHireRequest.builder() \ - .pre_hire_id("76534545454") \ - .build() + # 构造请求对象 + request: DeletePreHireRequest = DeletePreHireRequest.builder() \ + .pre_hire_id("76534545454") \ + .build() - # 发起请求 - response: DeletePreHireResponse = client.corehr.v1.pre_hire.delete(request) + # 发起请求 + response: DeletePreHireResponse = client.corehr.v1.pre_hire.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePreHireRequest = DeletePreHireRequest.builder() \ - .pre_hire_id("76534545454") \ - .build() + # 构造请求对象 + request: DeletePreHireRequest = DeletePreHireRequest.builder() \ + .pre_hire_id("76534545454") \ + .build() - # 发起请求 - response: DeletePreHireResponse = await client.corehr.v1.pre_hire.adelete(request) + # 发起请求 + response: DeletePreHireResponse = await client.corehr.v1.pre_hire.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/delete_working_hours_type_sample.py b/samples/api/corehr/v1/delete_working_hours_type_sample.py index 8390cfbb0..dbb01410e 100644 --- a/samples/api/corehr/v1/delete_working_hours_type_sample.py +++ b/samples/api/corehr/v1/delete_working_hours_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteWorkingHoursTypeRequest = DeleteWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("325325254") \ - .build() + # 构造请求对象 + request: DeleteWorkingHoursTypeRequest = DeleteWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("325325254") \ + .build() - # 发起请求 - response: DeleteWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.delete(request) + # 发起请求 + response: DeleteWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteWorkingHoursTypeRequest = DeleteWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("325325254") \ - .build() + # 构造请求对象 + request: DeleteWorkingHoursTypeRequest = DeleteWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("325325254") \ + .build() - # 发起请求 - response: DeleteWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.adelete(request) + # 发起请求 + response: DeleteWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/edit_enum_option_common_data_meta_data_sample.py b/samples/api/corehr/v1/edit_enum_option_common_data_meta_data_sample.py index 9cc3ef223..6098ea82f 100644 --- a/samples/api/corehr/v1/edit_enum_option_common_data_meta_data_sample.py +++ b/samples/api/corehr/v1/edit_enum_option_common_data_meta_data_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EditEnumOptionCommonDataMetaDataRequest = EditEnumOptionCommonDataMetaDataRequest.builder() \ - .client_token("6727817538283013641") \ - .request_body(EditEnumOptionCommonDataMetaDataRequestBody.builder() - .object_api_name("probation_management") - .enum_field_api_name("final_assessment_grade") - .enum_field_option(EnumFieldOption.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: EditEnumOptionCommonDataMetaDataRequest = EditEnumOptionCommonDataMetaDataRequest.builder() \ + .client_token("6727817538283013641") \ + .request_body(EditEnumOptionCommonDataMetaDataRequestBody.builder() + .object_api_name("probation_management") + .enum_field_api_name("final_assessment_grade") + .enum_field_option(EnumFieldOption.builder().build()) + .build()) \ + .build() - # 发起请求 - response: EditEnumOptionCommonDataMetaDataResponse = client.corehr.v1.common_data_meta_data.edit_enum_option( - request) + # 发起请求 + response: EditEnumOptionCommonDataMetaDataResponse = client.corehr.v1.common_data_meta_data.edit_enum_option(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_meta_data.edit_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_meta_data.edit_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EditEnumOptionCommonDataMetaDataRequest = EditEnumOptionCommonDataMetaDataRequest.builder() \ - .client_token("6727817538283013641") \ - .request_body(EditEnumOptionCommonDataMetaDataRequestBody.builder() - .object_api_name("probation_management") - .enum_field_api_name("final_assessment_grade") - .enum_field_option(EnumFieldOption.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: EditEnumOptionCommonDataMetaDataRequest = EditEnumOptionCommonDataMetaDataRequest.builder() \ + .client_token("6727817538283013641") \ + .request_body(EditEnumOptionCommonDataMetaDataRequestBody.builder() + .object_api_name("probation_management") + .enum_field_api_name("final_assessment_grade") + .enum_field_option(EnumFieldOption.builder().build()) + .build()) \ + .build() - # 发起请求 - response: EditEnumOptionCommonDataMetaDataResponse = await client.corehr.v1.common_data_meta_data.aedit_enum_option( - request) + # 发起请求 + response: EditEnumOptionCommonDataMetaDataResponse = await client.corehr.v1.common_data_meta_data.aedit_enum_option(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.common_data_meta_data.aedit_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.common_data_meta_data.aedit_enum_option failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_by_param_authorization_sample.py b/samples/api/corehr/v1/get_by_param_authorization_sample.py index 8fb5ba24b..6fae96718 100644 --- a/samples/api/corehr/v1/get_by_param_authorization_sample.py +++ b/samples/api/corehr/v1/get_by_param_authorization_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByParamAuthorizationRequest = GetByParamAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: GetByParamAuthorizationRequest = GetByParamAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: GetByParamAuthorizationResponse = client.corehr.v1.authorization.get_by_param(request) + # 发起请求 + response: GetByParamAuthorizationResponse = client.corehr.v1.authorization.get_by_param(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.get_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.get_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByParamAuthorizationRequest = GetByParamAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: GetByParamAuthorizationRequest = GetByParamAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: GetByParamAuthorizationResponse = await client.corehr.v1.authorization.aget_by_param(request) + # 发起请求 + response: GetByParamAuthorizationResponse = await client.corehr.v1.authorization.aget_by_param(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.aget_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.aget_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_by_param_custom_field_sample.py b/samples/api/corehr/v1/get_by_param_custom_field_sample.py index b1936038c..a042ac0df 100644 --- a/samples/api/corehr/v1/get_by_param_custom_field_sample.py +++ b/samples/api/corehr/v1/get_by_param_custom_field_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByParamCustomFieldRequest = GetByParamCustomFieldRequest.builder() \ - .object_api_name("offboarding_info") \ - .custom_api_name("custom_field_33") \ - .build() + # 构造请求对象 + request: GetByParamCustomFieldRequest = GetByParamCustomFieldRequest.builder() \ + .object_api_name("offboarding_info") \ + .custom_api_name("custom_field_33") \ + .build() - # 发起请求 - response: GetByParamCustomFieldResponse = client.corehr.v1.custom_field.get_by_param(request) + # 发起请求 + response: GetByParamCustomFieldResponse = client.corehr.v1.custom_field.get_by_param(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.get_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.get_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByParamCustomFieldRequest = GetByParamCustomFieldRequest.builder() \ - .object_api_name("offboarding_info") \ - .custom_api_name("custom_field_33") \ - .build() + # 构造请求对象 + request: GetByParamCustomFieldRequest = GetByParamCustomFieldRequest.builder() \ + .object_api_name("offboarding_info") \ + .custom_api_name("custom_field_33") \ + .build() - # 发起请求 - response: GetByParamCustomFieldResponse = await client.corehr.v1.custom_field.aget_by_param(request) + # 发起请求 + response: GetByParamCustomFieldResponse = await client.corehr.v1.custom_field.aget_by_param(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.aget_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.aget_by_param failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_company_sample.py b/samples/api/corehr/v1/get_company_sample.py index e8f5f8196..aa6d6a868 100644 --- a/samples/api/corehr/v1/get_company_sample.py +++ b/samples/api/corehr/v1/get_company_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCompanyRequest = GetCompanyRequest.builder() \ - .company_id("151515") \ - .build() + # 构造请求对象 + request: GetCompanyRequest = GetCompanyRequest.builder() \ + .company_id("151515") \ + .build() - # 发起请求 - response: GetCompanyResponse = client.corehr.v1.company.get(request) + # 发起请求 + response: GetCompanyResponse = client.corehr.v1.company.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCompanyRequest = GetCompanyRequest.builder() \ - .company_id("151515") \ - .build() + # 构造请求对象 + request: GetCompanyRequest = GetCompanyRequest.builder() \ + .company_id("151515") \ + .build() - # 发起请求 - response: GetCompanyResponse = await client.corehr.v1.company.aget(request) + # 发起请求 + response: GetCompanyResponse = await client.corehr.v1.company.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_contract_sample.py b/samples/api/corehr/v1/get_contract_sample.py index b2d81e2b7..e2ef08cad 100644 --- a/samples/api/corehr/v1/get_contract_sample.py +++ b/samples/api/corehr/v1/get_contract_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetContractRequest = GetContractRequest.builder() \ - .contract_id("151515") \ - .build() + # 构造请求对象 + request: GetContractRequest = GetContractRequest.builder() \ + .contract_id("151515") \ + .build() - # 发起请求 - response: GetContractResponse = client.corehr.v1.contract.get(request) + # 发起请求 + response: GetContractResponse = client.corehr.v1.contract.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetContractRequest = GetContractRequest.builder() \ - .contract_id("151515") \ - .build() + # 构造请求对象 + request: GetContractRequest = GetContractRequest.builder() \ + .contract_id("151515") \ + .build() - # 发起请求 - response: GetContractResponse = await client.corehr.v1.contract.aget(request) + # 发起请求 + response: GetContractResponse = await client.corehr.v1.contract.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_country_region_sample.py b/samples/api/corehr/v1/get_country_region_sample.py index c0004aca7..70e66eb36 100644 --- a/samples/api/corehr/v1/get_country_region_sample.py +++ b/samples/api/corehr/v1/get_country_region_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCountryRegionRequest = GetCountryRegionRequest.builder() \ - .country_region_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetCountryRegionRequest = GetCountryRegionRequest.builder() \ + .country_region_id("67489937334909845") \ + .build() - # 发起请求 - response: GetCountryRegionResponse = client.corehr.v1.country_region.get(request) + # 发起请求 + response: GetCountryRegionResponse = client.corehr.v1.country_region.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.country_region.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.country_region.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCountryRegionRequest = GetCountryRegionRequest.builder() \ - .country_region_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetCountryRegionRequest = GetCountryRegionRequest.builder() \ + .country_region_id("67489937334909845") \ + .build() - # 发起请求 - response: GetCountryRegionResponse = await client.corehr.v1.country_region.aget(request) + # 发起请求 + response: GetCountryRegionResponse = await client.corehr.v1.country_region.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.country_region.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.country_region.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_currency_sample.py b/samples/api/corehr/v1/get_currency_sample.py index 6faaac98e..91b5bc996 100644 --- a/samples/api/corehr/v1/get_currency_sample.py +++ b/samples/api/corehr/v1/get_currency_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCurrencyRequest = GetCurrencyRequest.builder() \ - .currency_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetCurrencyRequest = GetCurrencyRequest.builder() \ + .currency_id("67489937334909845") \ + .build() - # 发起请求 - response: GetCurrencyResponse = client.corehr.v1.currency.get(request) + # 发起请求 + response: GetCurrencyResponse = client.corehr.v1.currency.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.currency.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.currency.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCurrencyRequest = GetCurrencyRequest.builder() \ - .currency_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetCurrencyRequest = GetCurrencyRequest.builder() \ + .currency_id("67489937334909845") \ + .build() - # 发起请求 - response: GetCurrencyResponse = await client.corehr.v1.currency.aget(request) + # 发起请求 + response: GetCurrencyResponse = await client.corehr.v1.currency.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.currency.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.currency.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_department_sample.py b/samples/api/corehr/v1/get_department_sample.py index e589c20c1..f727394c2 100644 --- a/samples/api/corehr/v1/get_department_sample.py +++ b/samples/api/corehr/v1/get_department_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDepartmentRequest = GetDepartmentRequest.builder() \ - .department_id("45456564") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetDepartmentRequest = GetDepartmentRequest.builder() \ + .department_id("45456564") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetDepartmentResponse = client.corehr.v1.department.get(request) + # 发起请求 + response: GetDepartmentResponse = client.corehr.v1.department.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDepartmentRequest = GetDepartmentRequest.builder() \ - .department_id("45456564") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetDepartmentRequest = GetDepartmentRequest.builder() \ + .department_id("45456564") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetDepartmentResponse = await client.corehr.v1.department.aget(request) + # 发起请求 + response: GetDepartmentResponse = await client.corehr.v1.department.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_employee_type_sample.py b/samples/api/corehr/v1/get_employee_type_sample.py index 3c7bf03c5..038beebf6 100644 --- a/samples/api/corehr/v1/get_employee_type_sample.py +++ b/samples/api/corehr/v1/get_employee_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEmployeeTypeRequest = GetEmployeeTypeRequest.builder() \ - .employee_type_id("1") \ - .build() + # 构造请求对象 + request: GetEmployeeTypeRequest = GetEmployeeTypeRequest.builder() \ + .employee_type_id("1") \ + .build() - # 发起请求 - response: GetEmployeeTypeResponse = client.corehr.v1.employee_type.get(request) + # 发起请求 + response: GetEmployeeTypeResponse = client.corehr.v1.employee_type.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEmployeeTypeRequest = GetEmployeeTypeRequest.builder() \ - .employee_type_id("1") \ - .build() + # 构造请求对象 + request: GetEmployeeTypeRequest = GetEmployeeTypeRequest.builder() \ + .employee_type_id("1") \ + .build() - # 发起请求 - response: GetEmployeeTypeResponse = await client.corehr.v1.employee_type.aget(request) + # 发起请求 + response: GetEmployeeTypeResponse = await client.corehr.v1.employee_type.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_file_sample.py b/samples/api/corehr/v1/get_file_sample.py index a02012c37..c47a54d13 100644 --- a/samples/api/corehr/v1/get_file_sample.py +++ b/samples/api/corehr/v1/get_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileRequest = GetFileRequest.builder() \ - .id("150018109586e8ea745e47ae8feb3722dbe1d03a181336393633393133303431393831343930373235150100") \ - .build() + # 构造请求对象 + request: GetFileRequest = GetFileRequest.builder() \ + .id("150018109586e8ea745e47ae8feb3722dbe1d03a181336393633393133303431393831343930373235150100") \ + .build() - # 发起请求 - response: GetFileResponse = client.corehr.v1.file.get(request) + # 发起请求 + response: GetFileResponse = client.corehr.v1.file.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.file.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.file.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileRequest = GetFileRequest.builder() \ - .id("150018109586e8ea745e47ae8feb3722dbe1d03a181336393633393133303431393831343930373235150100") \ - .build() + # 构造请求对象 + request: GetFileRequest = GetFileRequest.builder() \ + .id("150018109586e8ea745e47ae8feb3722dbe1d03a181336393633393133303431393831343930373235150100") \ + .build() - # 发起请求 - response: GetFileResponse = await client.corehr.v1.file.aget(request) + # 发起请求 + response: GetFileResponse = await client.corehr.v1.file.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.file.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.file.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_job_data_sample.py b/samples/api/corehr/v1/get_job_data_sample.py index 0ef05b9ca..0bf939e36 100644 --- a/samples/api/corehr/v1/get_job_data_sample.py +++ b/samples/api/corehr/v1/get_job_data_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobDataRequest = GetJobDataRequest.builder() \ - .job_data_id("151515") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetJobDataRequest = GetJobDataRequest.builder() \ + .job_data_id("151515") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetJobDataResponse = client.corehr.v1.job_data.get(request) + # 发起请求 + response: GetJobDataResponse = client.corehr.v1.job_data.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobDataRequest = GetJobDataRequest.builder() \ - .job_data_id("151515") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetJobDataRequest = GetJobDataRequest.builder() \ + .job_data_id("151515") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetJobDataResponse = await client.corehr.v1.job_data.aget(request) + # 发起请求 + response: GetJobDataResponse = await client.corehr.v1.job_data.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_job_family_sample.py b/samples/api/corehr/v1/get_job_family_sample.py index 33a4ed337..a39e73cce 100644 --- a/samples/api/corehr/v1/get_job_family_sample.py +++ b/samples/api/corehr/v1/get_job_family_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ - .job_family_id("1554548") \ - .build() + # 构造请求对象 + request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ + .job_family_id("1554548") \ + .build() - # 发起请求 - response: GetJobFamilyResponse = client.corehr.v1.job_family.get(request) + # 发起请求 + response: GetJobFamilyResponse = client.corehr.v1.job_family.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ - .job_family_id("1554548") \ - .build() + # 构造请求对象 + request: GetJobFamilyRequest = GetJobFamilyRequest.builder() \ + .job_family_id("1554548") \ + .build() - # 发起请求 - response: GetJobFamilyResponse = await client.corehr.v1.job_family.aget(request) + # 发起请求 + response: GetJobFamilyResponse = await client.corehr.v1.job_family.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_job_level_sample.py b/samples/api/corehr/v1/get_job_level_sample.py index ab98b4eab..9bd6b5379 100644 --- a/samples/api/corehr/v1/get_job_level_sample.py +++ b/samples/api/corehr/v1/get_job_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobLevelRequest = GetJobLevelRequest.builder() \ - .job_level_id("1515") \ - .build() + # 构造请求对象 + request: GetJobLevelRequest = GetJobLevelRequest.builder() \ + .job_level_id("1515") \ + .build() - # 发起请求 - response: GetJobLevelResponse = client.corehr.v1.job_level.get(request) + # 发起请求 + response: GetJobLevelResponse = client.corehr.v1.job_level.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobLevelRequest = GetJobLevelRequest.builder() \ - .job_level_id("1515") \ - .build() + # 构造请求对象 + request: GetJobLevelRequest = GetJobLevelRequest.builder() \ + .job_level_id("1515") \ + .build() - # 发起请求 - response: GetJobLevelResponse = await client.corehr.v1.job_level.aget(request) + # 发起请求 + response: GetJobLevelResponse = await client.corehr.v1.job_level.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_job_sample.py b/samples/api/corehr/v1/get_job_sample.py index b18fcdbf4..804ada585 100644 --- a/samples/api/corehr/v1/get_job_sample.py +++ b/samples/api/corehr/v1/get_job_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("151515") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("151515") \ + .build() - # 发起请求 - response: GetJobResponse = client.corehr.v1.job.get(request) + # 发起请求 + response: GetJobResponse = client.corehr.v1.job.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("151515") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("151515") \ + .build() - # 发起请求 - response: GetJobResponse = await client.corehr.v1.job.aget(request) + # 发起请求 + response: GetJobResponse = await client.corehr.v1.job.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_location_sample.py b/samples/api/corehr/v1/get_location_sample.py index 2714d9a88..28d465773 100644 --- a/samples/api/corehr/v1/get_location_sample.py +++ b/samples/api/corehr/v1/get_location_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetLocationRequest = GetLocationRequest.builder() \ - .location_id("1215") \ - .build() + # 构造请求对象 + request: GetLocationRequest = GetLocationRequest.builder() \ + .location_id("1215") \ + .build() - # 发起请求 - response: GetLocationResponse = client.corehr.v1.location.get(request) + # 发起请求 + response: GetLocationResponse = client.corehr.v1.location.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetLocationRequest = GetLocationRequest.builder() \ - .location_id("1215") \ - .build() + # 构造请求对象 + request: GetLocationRequest = GetLocationRequest.builder() \ + .location_id("1215") \ + .build() - # 发起请求 - response: GetLocationResponse = await client.corehr.v1.location.aget(request) + # 发起请求 + response: GetLocationResponse = await client.corehr.v1.location.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_national_id_type_sample.py b/samples/api/corehr/v1/get_national_id_type_sample.py index 631420db5..42f43e442 100644 --- a/samples/api/corehr/v1/get_national_id_type_sample.py +++ b/samples/api/corehr/v1/get_national_id_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNationalIdTypeRequest = GetNationalIdTypeRequest.builder() \ - .national_id_type_id("121515") \ - .build() + # 构造请求对象 + request: GetNationalIdTypeRequest = GetNationalIdTypeRequest.builder() \ + .national_id_type_id("121515") \ + .build() - # 发起请求 - response: GetNationalIdTypeResponse = client.corehr.v1.national_id_type.get(request) + # 发起请求 + response: GetNationalIdTypeResponse = client.corehr.v1.national_id_type.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNationalIdTypeRequest = GetNationalIdTypeRequest.builder() \ - .national_id_type_id("121515") \ - .build() + # 构造请求对象 + request: GetNationalIdTypeRequest = GetNationalIdTypeRequest.builder() \ + .national_id_type_id("121515") \ + .build() - # 发起请求 - response: GetNationalIdTypeResponse = await client.corehr.v1.national_id_type.aget(request) + # 发起请求 + response: GetNationalIdTypeResponse = await client.corehr.v1.national_id_type.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_person_sample.py b/samples/api/corehr/v1/get_person_sample.py index 1066ef811..101f28ccb 100644 --- a/samples/api/corehr/v1/get_person_sample.py +++ b/samples/api/corehr/v1/get_person_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPersonRequest = GetPersonRequest.builder() \ - .person_id("1616161616") \ - .user_id_type("people_employee_id") \ - .build() + # 构造请求对象 + request: GetPersonRequest = GetPersonRequest.builder() \ + .person_id("1616161616") \ + .user_id_type("people_employee_id") \ + .build() - # 发起请求 - response: GetPersonResponse = client.corehr.v1.person.get(request) + # 发起请求 + response: GetPersonResponse = client.corehr.v1.person.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPersonRequest = GetPersonRequest.builder() \ - .person_id("1616161616") \ - .user_id_type("people_employee_id") \ - .build() + # 构造请求对象 + request: GetPersonRequest = GetPersonRequest.builder() \ + .person_id("1616161616") \ + .user_id_type("people_employee_id") \ + .build() - # 发起请求 - response: GetPersonResponse = await client.corehr.v1.person.aget(request) + # 发起请求 + response: GetPersonResponse = await client.corehr.v1.person.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_pre_hire_sample.py b/samples/api/corehr/v1/get_pre_hire_sample.py index 705a6321e..bf4bb99ab 100644 --- a/samples/api/corehr/v1/get_pre_hire_sample.py +++ b/samples/api/corehr/v1/get_pre_hire_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPreHireRequest = GetPreHireRequest.builder() \ - .pre_hire_id("121215") \ - .build() + # 构造请求对象 + request: GetPreHireRequest = GetPreHireRequest.builder() \ + .pre_hire_id("121215") \ + .build() - # 发起请求 - response: GetPreHireResponse = client.corehr.v1.pre_hire.get(request) + # 发起请求 + response: GetPreHireResponse = client.corehr.v1.pre_hire.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPreHireRequest = GetPreHireRequest.builder() \ - .pre_hire_id("121215") \ - .build() + # 构造请求对象 + request: GetPreHireRequest = GetPreHireRequest.builder() \ + .pre_hire_id("121215") \ + .build() - # 发起请求 - response: GetPreHireResponse = await client.corehr.v1.pre_hire.aget(request) + # 发起请求 + response: GetPreHireResponse = await client.corehr.v1.pre_hire.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_process_form_variable_data_sample.py b/samples/api/corehr/v1/get_process_form_variable_data_sample.py index a1cdea1f6..c19bb7c79 100644 --- a/samples/api/corehr/v1/get_process_form_variable_data_sample.py +++ b/samples/api/corehr/v1/get_process_form_variable_data_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ - .process_id("123456987") \ - .build() + # 构造请求对象 + request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ + .process_id("123456987") \ + .build() - # 发起请求 - response: GetProcessFormVariableDataResponse = client.corehr.v1.process_form_variable_data.get(request) + # 发起请求 + response: GetProcessFormVariableDataResponse = client.corehr.v1.process_form_variable_data.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.process_form_variable_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.process_form_variable_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ - .process_id("123456987") \ - .build() + # 构造请求对象 + request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ + .process_id("123456987") \ + .build() - # 发起请求 - response: GetProcessFormVariableDataResponse = await client.corehr.v1.process_form_variable_data.aget(request) + # 发起请求 + response: GetProcessFormVariableDataResponse = await client.corehr.v1.process_form_variable_data.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.process_form_variable_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.process_form_variable_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_subdivision_sample.py b/samples/api/corehr/v1/get_subdivision_sample.py index 920577399..23d91a6a3 100644 --- a/samples/api/corehr/v1/get_subdivision_sample.py +++ b/samples/api/corehr/v1/get_subdivision_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubdivisionRequest = GetSubdivisionRequest.builder() \ - .subdivision_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetSubdivisionRequest = GetSubdivisionRequest.builder() \ + .subdivision_id("67489937334909845") \ + .build() - # 发起请求 - response: GetSubdivisionResponse = client.corehr.v1.subdivision.get(request) + # 发起请求 + response: GetSubdivisionResponse = client.corehr.v1.subdivision.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subdivision.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subdivision.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubdivisionRequest = GetSubdivisionRequest.builder() \ - .subdivision_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetSubdivisionRequest = GetSubdivisionRequest.builder() \ + .subdivision_id("67489937334909845") \ + .build() - # 发起请求 - response: GetSubdivisionResponse = await client.corehr.v1.subdivision.aget(request) + # 发起请求 + response: GetSubdivisionResponse = await client.corehr.v1.subdivision.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subdivision.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subdivision.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_subregion_sample.py b/samples/api/corehr/v1/get_subregion_sample.py index 67f0aad58..ab49c43ad 100644 --- a/samples/api/corehr/v1/get_subregion_sample.py +++ b/samples/api/corehr/v1/get_subregion_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubregionRequest = GetSubregionRequest.builder() \ - .subregion_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetSubregionRequest = GetSubregionRequest.builder() \ + .subregion_id("67489937334909845") \ + .build() - # 发起请求 - response: GetSubregionResponse = client.corehr.v1.subregion.get(request) + # 发起请求 + response: GetSubregionResponse = client.corehr.v1.subregion.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subregion.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subregion.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubregionRequest = GetSubregionRequest.builder() \ - .subregion_id("67489937334909845") \ - .build() + # 构造请求对象 + request: GetSubregionRequest = GetSubregionRequest.builder() \ + .subregion_id("67489937334909845") \ + .build() - # 发起请求 - response: GetSubregionResponse = await client.corehr.v1.subregion.aget(request) + # 发起请求 + response: GetSubregionResponse = await client.corehr.v1.subregion.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subregion.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subregion.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/get_working_hours_type_sample.py b/samples/api/corehr/v1/get_working_hours_type_sample.py index 4394638dd..c45336e81 100644 --- a/samples/api/corehr/v1/get_working_hours_type_sample.py +++ b/samples/api/corehr/v1/get_working_hours_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWorkingHoursTypeRequest = GetWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("1212") \ - .build() + # 构造请求对象 + request: GetWorkingHoursTypeRequest = GetWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("1212") \ + .build() - # 发起请求 - response: GetWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.get(request) + # 发起请求 + response: GetWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWorkingHoursTypeRequest = GetWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("1212") \ - .build() + # 构造请求对象 + request: GetWorkingHoursTypeRequest = GetWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("1212") \ + .build() - # 发起请求 - response: GetWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.aget(request) + # 发起请求 + response: GetWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/leave_balances_leave_sample.py b/samples/api/corehr/v1/leave_balances_leave_sample.py index 8703527fc..edcb9528b 100644 --- a/samples/api/corehr/v1/leave_balances_leave_sample.py +++ b/samples/api/corehr/v1/leave_balances_leave_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveBalancesLeaveRequest = LeaveBalancesLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("20") \ - .as_of_date("2022-07-29") \ - .employment_id_list([]) \ - .user_id_type("people_corehr_id") \ - .time_zone("Asia/Shanghai") \ - .build() + # 构造请求对象 + request: LeaveBalancesLeaveRequest = LeaveBalancesLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("20") \ + .as_of_date("2022-07-29") \ + .employment_id_list([]) \ + .user_id_type("people_corehr_id") \ + .time_zone("Asia/Shanghai") \ + .build() - # 发起请求 - response: LeaveBalancesLeaveResponse = client.corehr.v1.leave.leave_balances(request) + # 发起请求 + response: LeaveBalancesLeaveResponse = client.corehr.v1.leave.leave_balances(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.leave_balances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.leave_balances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveBalancesLeaveRequest = LeaveBalancesLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("20") \ - .as_of_date("2022-07-29") \ - .employment_id_list([]) \ - .user_id_type("people_corehr_id") \ - .time_zone("Asia/Shanghai") \ - .build() + # 构造请求对象 + request: LeaveBalancesLeaveRequest = LeaveBalancesLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("20") \ + .as_of_date("2022-07-29") \ + .employment_id_list([]) \ + .user_id_type("people_corehr_id") \ + .time_zone("Asia/Shanghai") \ + .build() - # 发起请求 - response: LeaveBalancesLeaveResponse = await client.corehr.v1.leave.aleave_balances(request) + # 发起请求 + response: LeaveBalancesLeaveResponse = await client.corehr.v1.leave.aleave_balances(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.aleave_balances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.aleave_balances failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/leave_request_history_leave_sample.py b/samples/api/corehr/v1/leave_request_history_leave_sample.py index f69f1c00b..816586351 100644 --- a/samples/api/corehr/v1/leave_request_history_leave_sample.py +++ b/samples/api/corehr/v1/leave_request_history_leave_sample.py @@ -5,104 +5,104 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveRequestHistoryLeaveRequest = LeaveRequestHistoryLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("100") \ - .employment_id_list([]) \ - .initiator_id_list([]) \ - .leave_request_status([]) \ - .leave_type_id_list([]) \ - .leave_start_date_min("2022-07-20 morning") \ - .leave_start_date_max("2022-07-20 morning") \ - .leave_end_date_min("2022-07-20 morning") \ - .leave_end_date_max("2022-07-20 morning") \ - .leave_submit_date_min("2022-07-20 morning") \ - .leave_submit_date_max("2022-07-20 morning") \ - .user_id_type("people_corehr_id") \ - .leave_update_time_min("2022-10-24 10:00:00") \ - .leave_update_time_max("2022-10-24 10:00:00") \ - .return_detail(False) \ - .leave_term_type(0) \ - .time_zone("Asia/Shanghai") \ - .data_source(1) \ - .db_update_time_min("2022-10-24 10:00:00") \ - .db_update_time_max("2022-10-24 10:00:00") \ - .wd_need_amount_zero_records(False) \ - .wd_need_denied_and_canceled_record(False) \ - .wd_paid_type(1) \ - .build() + # 构造请求对象 + request: LeaveRequestHistoryLeaveRequest = LeaveRequestHistoryLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("100") \ + .employment_id_list([]) \ + .initiator_id_list([]) \ + .leave_request_status([]) \ + .leave_type_id_list([]) \ + .leave_start_date_min("2022-07-20 morning") \ + .leave_start_date_max("2022-07-20 morning") \ + .leave_end_date_min("2022-07-20 morning") \ + .leave_end_date_max("2022-07-20 morning") \ + .leave_submit_date_min("2022-07-20 morning") \ + .leave_submit_date_max("2022-07-20 morning") \ + .user_id_type("people_corehr_id") \ + .leave_update_time_min("2022-10-24 10:00:00") \ + .leave_update_time_max("2022-10-24 10:00:00") \ + .return_detail(False) \ + .leave_term_type(0) \ + .time_zone("Asia/Shanghai") \ + .data_source(1) \ + .db_update_time_min("2022-10-24 10:00:00") \ + .db_update_time_max("2022-10-24 10:00:00") \ + .wd_need_amount_zero_records(False) \ + .wd_need_denied_and_canceled_record(False) \ + .wd_paid_type(1) \ + .build() - # 发起请求 - response: LeaveRequestHistoryLeaveResponse = client.corehr.v1.leave.leave_request_history(request) + # 发起请求 + response: LeaveRequestHistoryLeaveResponse = client.corehr.v1.leave.leave_request_history(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.leave_request_history failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.leave_request_history failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveRequestHistoryLeaveRequest = LeaveRequestHistoryLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("100") \ - .employment_id_list([]) \ - .initiator_id_list([]) \ - .leave_request_status([]) \ - .leave_type_id_list([]) \ - .leave_start_date_min("2022-07-20 morning") \ - .leave_start_date_max("2022-07-20 morning") \ - .leave_end_date_min("2022-07-20 morning") \ - .leave_end_date_max("2022-07-20 morning") \ - .leave_submit_date_min("2022-07-20 morning") \ - .leave_submit_date_max("2022-07-20 morning") \ - .user_id_type("people_corehr_id") \ - .leave_update_time_min("2022-10-24 10:00:00") \ - .leave_update_time_max("2022-10-24 10:00:00") \ - .return_detail(False) \ - .leave_term_type(0) \ - .time_zone("Asia/Shanghai") \ - .data_source(1) \ - .db_update_time_min("2022-10-24 10:00:00") \ - .db_update_time_max("2022-10-24 10:00:00") \ - .wd_need_amount_zero_records(False) \ - .wd_need_denied_and_canceled_record(False) \ - .wd_paid_type(1) \ - .build() + # 构造请求对象 + request: LeaveRequestHistoryLeaveRequest = LeaveRequestHistoryLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("100") \ + .employment_id_list([]) \ + .initiator_id_list([]) \ + .leave_request_status([]) \ + .leave_type_id_list([]) \ + .leave_start_date_min("2022-07-20 morning") \ + .leave_start_date_max("2022-07-20 morning") \ + .leave_end_date_min("2022-07-20 morning") \ + .leave_end_date_max("2022-07-20 morning") \ + .leave_submit_date_min("2022-07-20 morning") \ + .leave_submit_date_max("2022-07-20 morning") \ + .user_id_type("people_corehr_id") \ + .leave_update_time_min("2022-10-24 10:00:00") \ + .leave_update_time_max("2022-10-24 10:00:00") \ + .return_detail(False) \ + .leave_term_type(0) \ + .time_zone("Asia/Shanghai") \ + .data_source(1) \ + .db_update_time_min("2022-10-24 10:00:00") \ + .db_update_time_max("2022-10-24 10:00:00") \ + .wd_need_amount_zero_records(False) \ + .wd_need_denied_and_canceled_record(False) \ + .wd_paid_type(1) \ + .build() - # 发起请求 - response: LeaveRequestHistoryLeaveResponse = await client.corehr.v1.leave.aleave_request_history(request) + # 发起请求 + response: LeaveRequestHistoryLeaveResponse = await client.corehr.v1.leave.aleave_request_history(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.aleave_request_history failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.aleave_request_history failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/leave_types_leave_sample.py b/samples/api/corehr/v1/leave_types_leave_sample.py index 1d948b5fb..1c25acae9 100644 --- a/samples/api/corehr/v1/leave_types_leave_sample.py +++ b/samples/api/corehr/v1/leave_types_leave_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveTypesLeaveRequest = LeaveTypesLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("100") \ - .status("1") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: LeaveTypesLeaveRequest = LeaveTypesLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("100") \ + .status("1") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: LeaveTypesLeaveResponse = client.corehr.v1.leave.leave_types(request) + # 发起请求 + response: LeaveTypesLeaveResponse = client.corehr.v1.leave.leave_types(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.leave_types failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.leave_types failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LeaveTypesLeaveRequest = LeaveTypesLeaveRequest.builder() \ - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ - .page_size("100") \ - .status("1") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: LeaveTypesLeaveRequest = LeaveTypesLeaveRequest.builder() \ + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") \ + .page_size("100") \ + .status("1") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: LeaveTypesLeaveResponse = await client.corehr.v1.leave.aleave_types(request) + # 发起请求 + response: LeaveTypesLeaveResponse = await client.corehr.v1.leave.aleave_types(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.leave.aleave_types failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.aleave_types failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_company_sample.py b/samples/api/corehr/v1/list_company_sample.py index d14716be6..fa7ee81bb 100644 --- a/samples/api/corehr/v1/list_company_sample.py +++ b/samples/api/corehr/v1/list_company_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCompanyRequest = ListCompanyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCompanyRequest = ListCompanyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCompanyResponse = client.corehr.v1.company.list(request) + # 发起请求 + response: ListCompanyResponse = client.corehr.v1.company.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCompanyRequest = ListCompanyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCompanyRequest = ListCompanyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCompanyResponse = await client.corehr.v1.company.alist(request) + # 发起请求 + response: ListCompanyResponse = await client.corehr.v1.company.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_contract_sample.py b/samples/api/corehr/v1/list_contract_sample.py index 55c51d8e5..34a9a6d8b 100644 --- a/samples/api/corehr/v1/list_contract_sample.py +++ b/samples/api/corehr/v1/list_contract_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListContractRequest = ListContractRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListContractRequest = ListContractRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListContractResponse = client.corehr.v1.contract.list(request) + # 发起请求 + response: ListContractResponse = client.corehr.v1.contract.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListContractRequest = ListContractRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListContractRequest = ListContractRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListContractResponse = await client.corehr.v1.contract.alist(request) + # 发起请求 + response: ListContractResponse = await client.corehr.v1.contract.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_country_region_sample.py b/samples/api/corehr/v1/list_country_region_sample.py index 630f93edd..d4ac05b9f 100644 --- a/samples/api/corehr/v1/list_country_region_sample.py +++ b/samples/api/corehr/v1/list_country_region_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCountryRegionRequest = ListCountryRegionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCountryRegionRequest = ListCountryRegionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCountryRegionResponse = client.corehr.v1.country_region.list(request) + # 发起请求 + response: ListCountryRegionResponse = client.corehr.v1.country_region.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.country_region.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.country_region.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCountryRegionRequest = ListCountryRegionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCountryRegionRequest = ListCountryRegionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCountryRegionResponse = await client.corehr.v1.country_region.alist(request) + # 发起请求 + response: ListCountryRegionResponse = await client.corehr.v1.country_region.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.country_region.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.country_region.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_currency_sample.py b/samples/api/corehr/v1/list_currency_sample.py index 47a9c8518..e89580c4e 100644 --- a/samples/api/corehr/v1/list_currency_sample.py +++ b/samples/api/corehr/v1/list_currency_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCurrencyRequest = ListCurrencyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCurrencyRequest = ListCurrencyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCurrencyResponse = client.corehr.v1.currency.list(request) + # 发起请求 + response: ListCurrencyResponse = client.corehr.v1.currency.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.currency.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.currency.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCurrencyRequest = ListCurrencyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListCurrencyRequest = ListCurrencyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListCurrencyResponse = await client.corehr.v1.currency.alist(request) + # 发起请求 + response: ListCurrencyResponse = await client.corehr.v1.currency.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.currency.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.currency.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_department_sample.py b/samples/api/corehr/v1/list_department_sample.py index 9337db13c..bfaef36fa 100644 --- a/samples/api/corehr/v1/list_department_sample.py +++ b/samples/api/corehr/v1/list_department_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentRequest = ListDepartmentRequest.builder() \ - .page_token("") \ - .page_size("100") \ - .department_id_list([]) \ - .name_list([]) \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: ListDepartmentRequest = ListDepartmentRequest.builder() \ + .page_token("") \ + .page_size("100") \ + .department_id_list([]) \ + .name_list([]) \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: ListDepartmentResponse = client.corehr.v1.department.list(request) + # 发起请求 + response: ListDepartmentResponse = client.corehr.v1.department.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDepartmentRequest = ListDepartmentRequest.builder() \ - .page_token("") \ - .page_size("100") \ - .department_id_list([]) \ - .name_list([]) \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: ListDepartmentRequest = ListDepartmentRequest.builder() \ + .page_token("") \ + .page_size("100") \ + .department_id_list([]) \ + .name_list([]) \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: ListDepartmentResponse = await client.corehr.v1.department.alist(request) + # 发起请求 + response: ListDepartmentResponse = await client.corehr.v1.department.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_employee_type_sample.py b/samples/api/corehr/v1/list_employee_type_sample.py index 44d6d3e0f..667a5ccb9 100644 --- a/samples/api/corehr/v1/list_employee_type_sample.py +++ b/samples/api/corehr/v1/list_employee_type_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeTypeRequest = ListEmployeeTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListEmployeeTypeRequest = ListEmployeeTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListEmployeeTypeResponse = client.corehr.v1.employee_type.list(request) + # 发起请求 + response: ListEmployeeTypeResponse = client.corehr.v1.employee_type.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeTypeRequest = ListEmployeeTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListEmployeeTypeRequest = ListEmployeeTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListEmployeeTypeResponse = await client.corehr.v1.employee_type.alist(request) + # 发起请求 + response: ListEmployeeTypeResponse = await client.corehr.v1.employee_type.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_job_data_sample.py b/samples/api/corehr/v1/list_job_data_sample.py index 2e3a09548..a5321560a 100644 --- a/samples/api/corehr/v1/list_job_data_sample.py +++ b/samples/api/corehr/v1/list_job_data_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobDataRequest = ListJobDataRequest.builder() \ - .page_token("6994718879515739656") \ - .page_size("100") \ - .employment_id("7072306364927985196") \ - .job_data_id_list([]) \ - .department_id("6887868781834536462") \ - .job_id("6893014062142064135") \ - .get_all_version(False) \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: ListJobDataRequest = ListJobDataRequest.builder() \ + .page_token("6994718879515739656") \ + .page_size("100") \ + .employment_id("7072306364927985196") \ + .job_data_id_list([]) \ + .department_id("6887868781834536462") \ + .job_id("6893014062142064135") \ + .get_all_version(False) \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: ListJobDataResponse = client.corehr.v1.job_data.list(request) + # 发起请求 + response: ListJobDataResponse = client.corehr.v1.job_data.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobDataRequest = ListJobDataRequest.builder() \ - .page_token("6994718879515739656") \ - .page_size("100") \ - .employment_id("7072306364927985196") \ - .job_data_id_list([]) \ - .department_id("6887868781834536462") \ - .job_id("6893014062142064135") \ - .get_all_version(False) \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: ListJobDataRequest = ListJobDataRequest.builder() \ + .page_token("6994718879515739656") \ + .page_size("100") \ + .employment_id("7072306364927985196") \ + .job_data_id_list([]) \ + .department_id("6887868781834536462") \ + .job_id("6893014062142064135") \ + .get_all_version(False) \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: ListJobDataResponse = await client.corehr.v1.job_data.alist(request) + # 发起请求 + response: ListJobDataResponse = await client.corehr.v1.job_data.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_job_family_sample.py b/samples/api/corehr/v1/list_job_family_sample.py index eaf9d2a12..3729d38f6 100644 --- a/samples/api/corehr/v1/list_job_family_sample.py +++ b/samples/api/corehr/v1/list_job_family_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListJobFamilyResponse = client.corehr.v1.job_family.list(request) + # 发起请求 + response: ListJobFamilyResponse = client.corehr.v1.job_family.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListJobFamilyRequest = ListJobFamilyRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListJobFamilyResponse = await client.corehr.v1.job_family.alist(request) + # 发起请求 + response: ListJobFamilyResponse = await client.corehr.v1.job_family.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_job_level_sample.py b/samples/api/corehr/v1/list_job_level_sample.py index f72e3ffb5..67a172135 100644 --- a/samples/api/corehr/v1/list_job_level_sample.py +++ b/samples/api/corehr/v1/list_job_level_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobLevelRequest = ListJobLevelRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListJobLevelRequest = ListJobLevelRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListJobLevelResponse = client.corehr.v1.job_level.list(request) + # 发起请求 + response: ListJobLevelResponse = client.corehr.v1.job_level.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobLevelRequest = ListJobLevelRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListJobLevelRequest = ListJobLevelRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListJobLevelResponse = await client.corehr.v1.job_level.alist(request) + # 发起请求 + response: ListJobLevelResponse = await client.corehr.v1.job_level.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_job_sample.py b/samples/api/corehr/v1/list_job_sample.py index e3afa9ab3..a6d7d13c9 100644 --- a/samples/api/corehr/v1/list_job_sample.py +++ b/samples/api/corehr/v1/list_job_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .name("keyword") \ - .query_language("zh") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .name("keyword") \ + .query_language("zh") \ + .build() - # 发起请求 - response: ListJobResponse = client.corehr.v1.job.list(request) + # 发起请求 + response: ListJobResponse = client.corehr.v1.job.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .name("keyword") \ - .query_language("zh") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .name("keyword") \ + .query_language("zh") \ + .build() - # 发起请求 - response: ListJobResponse = await client.corehr.v1.job.alist(request) + # 发起请求 + response: ListJobResponse = await client.corehr.v1.job.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_location_sample.py b/samples/api/corehr/v1/list_location_sample.py index c14a44e01..b00c9a056 100644 --- a/samples/api/corehr/v1/list_location_sample.py +++ b/samples/api/corehr/v1/list_location_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListLocationRequest = ListLocationRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListLocationRequest = ListLocationRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListLocationResponse = client.corehr.v1.location.list(request) + # 发起请求 + response: ListLocationResponse = client.corehr.v1.location.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListLocationRequest = ListLocationRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListLocationRequest = ListLocationRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListLocationResponse = await client.corehr.v1.location.alist(request) + # 发起请求 + response: ListLocationResponse = await client.corehr.v1.location.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.location.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.location.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_national_id_type_sample.py b/samples/api/corehr/v1/list_national_id_type_sample.py index 202890b33..b0d45fca2 100644 --- a/samples/api/corehr/v1/list_national_id_type_sample.py +++ b/samples/api/corehr/v1/list_national_id_type_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListNationalIdTypeRequest = ListNationalIdTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .identification_type("regular_passport") \ - .code("MYS-ID") \ - .country_region_id("6862995749043439111") \ - .build() + # 构造请求对象 + request: ListNationalIdTypeRequest = ListNationalIdTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .identification_type("regular_passport") \ + .code("MYS-ID") \ + .country_region_id("6862995749043439111") \ + .build() - # 发起请求 - response: ListNationalIdTypeResponse = client.corehr.v1.national_id_type.list(request) + # 发起请求 + response: ListNationalIdTypeResponse = client.corehr.v1.national_id_type.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListNationalIdTypeRequest = ListNationalIdTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .identification_type("regular_passport") \ - .code("MYS-ID") \ - .country_region_id("6862995749043439111") \ - .build() + # 构造请求对象 + request: ListNationalIdTypeRequest = ListNationalIdTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .identification_type("regular_passport") \ + .code("MYS-ID") \ + .country_region_id("6862995749043439111") \ + .build() - # 发起请求 - response: ListNationalIdTypeResponse = await client.corehr.v1.national_id_type.alist(request) + # 发起请求 + response: ListNationalIdTypeResponse = await client.corehr.v1.national_id_type.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_object_api_name_custom_field_sample.py b/samples/api/corehr/v1/list_object_api_name_custom_field_sample.py index fd9dc4386..87651beb5 100644 --- a/samples/api/corehr/v1/list_object_api_name_custom_field_sample.py +++ b/samples/api/corehr/v1/list_object_api_name_custom_field_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListObjectApiNameCustomFieldRequest = ListObjectApiNameCustomFieldRequest.builder() \ - .page_token("11") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListObjectApiNameCustomFieldRequest = ListObjectApiNameCustomFieldRequest.builder() \ + .page_token("11") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListObjectApiNameCustomFieldResponse = client.corehr.v1.custom_field.list_object_api_name(request) + # 发起请求 + response: ListObjectApiNameCustomFieldResponse = client.corehr.v1.custom_field.list_object_api_name(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.list_object_api_name failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.list_object_api_name failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListObjectApiNameCustomFieldRequest = ListObjectApiNameCustomFieldRequest.builder() \ - .page_token("11") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListObjectApiNameCustomFieldRequest = ListObjectApiNameCustomFieldRequest.builder() \ + .page_token("11") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListObjectApiNameCustomFieldResponse = await client.corehr.v1.custom_field.alist_object_api_name(request) + # 发起请求 + response: ListObjectApiNameCustomFieldResponse = await client.corehr.v1.custom_field.alist_object_api_name(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.alist_object_api_name failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.alist_object_api_name failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_pre_hire_sample.py b/samples/api/corehr/v1/list_pre_hire_sample.py index 42883513e..b789c4def 100644 --- a/samples/api/corehr/v1/list_pre_hire_sample.py +++ b/samples/api/corehr/v1/list_pre_hire_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPreHireRequest = ListPreHireRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .pre_hire_ids([]) \ - .build() + # 构造请求对象 + request: ListPreHireRequest = ListPreHireRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .pre_hire_ids([]) \ + .build() - # 发起请求 - response: ListPreHireResponse = client.corehr.v1.pre_hire.list(request) + # 发起请求 + response: ListPreHireResponse = client.corehr.v1.pre_hire.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPreHireRequest = ListPreHireRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .pre_hire_ids([]) \ - .build() + # 构造请求对象 + request: ListPreHireRequest = ListPreHireRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .pre_hire_ids([]) \ + .build() - # 发起请求 - response: ListPreHireResponse = await client.corehr.v1.pre_hire.alist(request) + # 发起请求 + response: ListPreHireResponse = await client.corehr.v1.pre_hire.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_security_group_sample.py b/samples/api/corehr/v1/list_security_group_sample.py index 203869470..77686ed4a 100644 --- a/samples/api/corehr/v1/list_security_group_sample.py +++ b/samples/api/corehr/v1/list_security_group_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSecurityGroupRequest = ListSecurityGroupRequest.builder() \ - .page_token("10") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListSecurityGroupRequest = ListSecurityGroupRequest.builder() \ + .page_token("10") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListSecurityGroupResponse = client.corehr.v1.security_group.list(request) + # 发起请求 + response: ListSecurityGroupResponse = client.corehr.v1.security_group.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.security_group.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.security_group.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSecurityGroupRequest = ListSecurityGroupRequest.builder() \ - .page_token("10") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListSecurityGroupRequest = ListSecurityGroupRequest.builder() \ + .page_token("10") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListSecurityGroupResponse = await client.corehr.v1.security_group.alist(request) + # 发起请求 + response: ListSecurityGroupResponse = await client.corehr.v1.security_group.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.security_group.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.security_group.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_subdivision_sample.py b/samples/api/corehr/v1/list_subdivision_sample.py index 02ac9602e..36ac11d05 100644 --- a/samples/api/corehr/v1/list_subdivision_sample.py +++ b/samples/api/corehr/v1/list_subdivision_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubdivisionRequest = ListSubdivisionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .country_region_id("100") \ - .build() + # 构造请求对象 + request: ListSubdivisionRequest = ListSubdivisionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .country_region_id("100") \ + .build() - # 发起请求 - response: ListSubdivisionResponse = client.corehr.v1.subdivision.list(request) + # 发起请求 + response: ListSubdivisionResponse = client.corehr.v1.subdivision.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subdivision.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subdivision.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubdivisionRequest = ListSubdivisionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .country_region_id("100") \ - .build() + # 构造请求对象 + request: ListSubdivisionRequest = ListSubdivisionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .country_region_id("100") \ + .build() - # 发起请求 - response: ListSubdivisionResponse = await client.corehr.v1.subdivision.alist(request) + # 发起请求 + response: ListSubdivisionResponse = await client.corehr.v1.subdivision.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subdivision.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subdivision.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_subregion_sample.py b/samples/api/corehr/v1/list_subregion_sample.py index 53fa7e1bb..847e5db1b 100644 --- a/samples/api/corehr/v1/list_subregion_sample.py +++ b/samples/api/corehr/v1/list_subregion_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubregionRequest = ListSubregionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .subdivision_id("100") \ - .build() + # 构造请求对象 + request: ListSubregionRequest = ListSubregionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .subdivision_id("100") \ + .build() - # 发起请求 - response: ListSubregionResponse = client.corehr.v1.subregion.list(request) + # 发起请求 + response: ListSubregionResponse = client.corehr.v1.subregion.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subregion.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subregion.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubregionRequest = ListSubregionRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .subdivision_id("100") \ - .build() + # 构造请求对象 + request: ListSubregionRequest = ListSubregionRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .subdivision_id("100") \ + .build() - # 发起请求 - response: ListSubregionResponse = await client.corehr.v1.subregion.alist(request) + # 发起请求 + response: ListSubregionResponse = await client.corehr.v1.subregion.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.subregion.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.subregion.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/list_working_hours_type_sample.py b/samples/api/corehr/v1/list_working_hours_type_sample.py index fb9249df5..44e4e95a9 100644 --- a/samples/api/corehr/v1/list_working_hours_type_sample.py +++ b/samples/api/corehr/v1/list_working_hours_type_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWorkingHoursTypeRequest = ListWorkingHoursTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListWorkingHoursTypeRequest = ListWorkingHoursTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.list(request) + # 发起请求 + response: ListWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWorkingHoursTypeRequest = ListWorkingHoursTypeRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .build() + # 构造请求对象 + request: ListWorkingHoursTypeRequest = ListWorkingHoursTypeRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .build() - # 发起请求 - response: ListWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.alist(request) + # 发起请求 + response: ListWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/match_compensation_standard_sample.py b/samples/api/corehr/v1/match_compensation_standard_sample.py index 05140fbc6..067f1071f 100644 --- a/samples/api/corehr/v1/match_compensation_standard_sample.py +++ b/samples/api/corehr/v1/match_compensation_standard_sample.py @@ -5,88 +5,88 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchCompensationStandardRequest = MatchCompensationStandardRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .employment_id("7124293751317038636") \ - .reference_object_api("cpst_item") \ - .reference_object_id("7156853394442044972") \ - .department_id("od-53899868dd0da32292a2d809f0518c8f") \ - .work_location_id("7094869485965870636") \ - .company_id("7091599096804394540") \ - .job_family_id("7039313681989502508") \ - .job_level_id("7086415175263258156") \ - .employee_type_id("7039310401359775276") \ - .recruitment_type("experienced_professionals") \ - .cpst_change_reason_id("6967639606963471117") \ - .cpst_plan_id("6967639606963471118") \ - .cpst_salary_level_id("6967639606963471119") \ - .effective_time("1660924800000") \ - .build() + # 构造请求对象 + request: MatchCompensationStandardRequest = MatchCompensationStandardRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .employment_id("7124293751317038636") \ + .reference_object_api("cpst_item") \ + .reference_object_id("7156853394442044972") \ + .department_id("od-53899868dd0da32292a2d809f0518c8f") \ + .work_location_id("7094869485965870636") \ + .company_id("7091599096804394540") \ + .job_family_id("7039313681989502508") \ + .job_level_id("7086415175263258156") \ + .employee_type_id("7039310401359775276") \ + .recruitment_type("experienced_professionals") \ + .cpst_change_reason_id("6967639606963471117") \ + .cpst_plan_id("6967639606963471118") \ + .cpst_salary_level_id("6967639606963471119") \ + .effective_time("1660924800000") \ + .build() - # 发起请求 - response: MatchCompensationStandardResponse = client.corehr.v1.compensation_standard.match(request) + # 发起请求 + response: MatchCompensationStandardResponse = client.corehr.v1.compensation_standard.match(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.compensation_standard.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.compensation_standard.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchCompensationStandardRequest = MatchCompensationStandardRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .employment_id("7124293751317038636") \ - .reference_object_api("cpst_item") \ - .reference_object_id("7156853394442044972") \ - .department_id("od-53899868dd0da32292a2d809f0518c8f") \ - .work_location_id("7094869485965870636") \ - .company_id("7091599096804394540") \ - .job_family_id("7039313681989502508") \ - .job_level_id("7086415175263258156") \ - .employee_type_id("7039310401359775276") \ - .recruitment_type("experienced_professionals") \ - .cpst_change_reason_id("6967639606963471117") \ - .cpst_plan_id("6967639606963471118") \ - .cpst_salary_level_id("6967639606963471119") \ - .effective_time("1660924800000") \ - .build() + # 构造请求对象 + request: MatchCompensationStandardRequest = MatchCompensationStandardRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .employment_id("7124293751317038636") \ + .reference_object_api("cpst_item") \ + .reference_object_id("7156853394442044972") \ + .department_id("od-53899868dd0da32292a2d809f0518c8f") \ + .work_location_id("7094869485965870636") \ + .company_id("7091599096804394540") \ + .job_family_id("7039313681989502508") \ + .job_level_id("7086415175263258156") \ + .employee_type_id("7039310401359775276") \ + .recruitment_type("experienced_professionals") \ + .cpst_change_reason_id("6967639606963471117") \ + .cpst_plan_id("6967639606963471118") \ + .cpst_salary_level_id("6967639606963471119") \ + .effective_time("1660924800000") \ + .build() - # 发起请求 - response: MatchCompensationStandardResponse = await client.corehr.v1.compensation_standard.amatch(request) + # 发起请求 + response: MatchCompensationStandardResponse = await client.corehr.v1.compensation_standard.amatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.compensation_standard.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.compensation_standard.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_company_sample.py b/samples/api/corehr/v1/patch_company_sample.py index 71f56df58..c8a064c58 100644 --- a/samples/api/corehr/v1/patch_company_sample.py +++ b/samples/api/corehr/v1/patch_company_sample.py @@ -5,94 +5,94 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCompanyRequest = PatchCompanyRequest.builder() \ - .company_id("1616161616") \ - .client_token("12454646") \ - .request_body(Company.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .type(Enum.builder().build()) - .industry_list([]) - .legal_representative([]) - .post_code("邮编") - .tax_payer_id("123456840") - .confidential(True) - .sub_type_list([]) - .branch_company(True) - .primary_manager([]) - .currency(Currency.builder().build()) - .phone(PhoneNumberAndAreaCode.builder().build()) - .fax(PhoneNumberAndAreaCode.builder().build()) - .registered_office_address_info(Address.builder().build()) - .office_address_info(Address.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchCompanyRequest = PatchCompanyRequest.builder() \ + .company_id("1616161616") \ + .client_token("12454646") \ + .request_body(Company.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .type(Enum.builder().build()) + .industry_list([]) + .legal_representative([]) + .post_code("邮编") + .tax_payer_id("123456840") + .confidential(True) + .sub_type_list([]) + .branch_company(True) + .primary_manager([]) + .currency(Currency.builder().build()) + .phone(PhoneNumberAndAreaCode.builder().build()) + .fax(PhoneNumberAndAreaCode.builder().build()) + .registered_office_address_info(Address.builder().build()) + .office_address_info(Address.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchCompanyResponse = client.corehr.v1.company.patch(request) + # 发起请求 + response: PatchCompanyResponse = client.corehr.v1.company.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCompanyRequest = PatchCompanyRequest.builder() \ - .company_id("1616161616") \ - .client_token("12454646") \ - .request_body(Company.builder() - .hiberarchy_common(HiberarchyCommon.builder().build()) - .type(Enum.builder().build()) - .industry_list([]) - .legal_representative([]) - .post_code("邮编") - .tax_payer_id("123456840") - .confidential(True) - .sub_type_list([]) - .branch_company(True) - .primary_manager([]) - .currency(Currency.builder().build()) - .phone(PhoneNumberAndAreaCode.builder().build()) - .fax(PhoneNumberAndAreaCode.builder().build()) - .registered_office_address_info(Address.builder().build()) - .office_address_info(Address.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchCompanyRequest = PatchCompanyRequest.builder() \ + .company_id("1616161616") \ + .client_token("12454646") \ + .request_body(Company.builder() + .hiberarchy_common(HiberarchyCommon.builder().build()) + .type(Enum.builder().build()) + .industry_list([]) + .legal_representative([]) + .post_code("邮编") + .tax_payer_id("123456840") + .confidential(True) + .sub_type_list([]) + .branch_company(True) + .primary_manager([]) + .currency(Currency.builder().build()) + .phone(PhoneNumberAndAreaCode.builder().build()) + .fax(PhoneNumberAndAreaCode.builder().build()) + .registered_office_address_info(Address.builder().build()) + .office_address_info(Address.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchCompanyResponse = await client.corehr.v1.company.apatch(request) + # 发起请求 + response: PatchCompanyResponse = await client.corehr.v1.company.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.company.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.company.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_contract_sample.py b/samples/api/corehr/v1/patch_contract_sample.py index f17af136f..208f9031e 100644 --- a/samples/api/corehr/v1/patch_contract_sample.py +++ b/samples/api/corehr/v1/patch_contract_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchContractRequest = PatchContractRequest.builder() \ - .contract_id("1616161616") \ - .client_token("12454646") \ - .request_body(Contract.builder() - .effective_time("2050-01-01 00:00:00") - .expiration_time("9999-12-31 23:59:59") - .employment_id("6893013238632416776") - .contract_type(Enum.builder().build()) - .first_party_company_id("6892686614112241165") - .person_id("151515151") - .custom_fields([]) - .duration_type(Enum.builder().build()) - .contract_end_date("2006-01-02") - .contract_number("6919737965274990093") - .signing_type(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchContractRequest = PatchContractRequest.builder() \ + .contract_id("1616161616") \ + .client_token("12454646") \ + .request_body(Contract.builder() + .effective_time("2050-01-01 00:00:00") + .expiration_time("9999-12-31 23:59:59") + .employment_id("6893013238632416776") + .contract_type(Enum.builder().build()) + .first_party_company_id("6892686614112241165") + .person_id("151515151") + .custom_fields([]) + .duration_type(Enum.builder().build()) + .contract_end_date("2006-01-02") + .contract_number("6919737965274990093") + .signing_type(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchContractResponse = client.corehr.v1.contract.patch(request) + # 发起请求 + response: PatchContractResponse = client.corehr.v1.contract.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchContractRequest = PatchContractRequest.builder() \ - .contract_id("1616161616") \ - .client_token("12454646") \ - .request_body(Contract.builder() - .effective_time("2050-01-01 00:00:00") - .expiration_time("9999-12-31 23:59:59") - .employment_id("6893013238632416776") - .contract_type(Enum.builder().build()) - .first_party_company_id("6892686614112241165") - .person_id("151515151") - .custom_fields([]) - .duration_type(Enum.builder().build()) - .contract_end_date("2006-01-02") - .contract_number("6919737965274990093") - .signing_type(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchContractRequest = PatchContractRequest.builder() \ + .contract_id("1616161616") \ + .client_token("12454646") \ + .request_body(Contract.builder() + .effective_time("2050-01-01 00:00:00") + .expiration_time("9999-12-31 23:59:59") + .employment_id("6893013238632416776") + .contract_type(Enum.builder().build()) + .first_party_company_id("6892686614112241165") + .person_id("151515151") + .custom_fields([]) + .duration_type(Enum.builder().build()) + .contract_end_date("2006-01-02") + .contract_number("6919737965274990093") + .signing_type(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchContractResponse = await client.corehr.v1.contract.apatch(request) + # 发起请求 + response: PatchContractResponse = await client.corehr.v1.contract.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.contract.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.contract.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_department_sample.py b/samples/api/corehr/v1/patch_department_sample.py index c22510cab..988920bab 100644 --- a/samples/api/corehr/v1/patch_department_sample.py +++ b/samples/api/corehr/v1/patch_department_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ - .department_id("6969828847121885087") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(Department.builder() - .id("4719456877659520852") - .sub_type(Enum.builder().build()) - .manager("6893013238632416776") - .is_confidential(True) - .hiberarchy_common(HiberarchyCommon.builder().build()) - .effective_time("2020-05-01 00:00:00") - .custom_fields([]) - .cost_center_id("7142384817131652652") - .staffing_model(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("6969828847121885087") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(Department.builder() + .id("4719456877659520852") + .sub_type(Enum.builder().build()) + .manager("6893013238632416776") + .is_confidential(True) + .hiberarchy_common(HiberarchyCommon.builder().build()) + .effective_time("2020-05-01 00:00:00") + .custom_fields([]) + .cost_center_id("7142384817131652652") + .staffing_model(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchDepartmentResponse = client.corehr.v1.department.patch(request) + # 发起请求 + response: PatchDepartmentResponse = client.corehr.v1.department.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ - .department_id("6969828847121885087") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(Department.builder() - .id("4719456877659520852") - .sub_type(Enum.builder().build()) - .manager("6893013238632416776") - .is_confidential(True) - .hiberarchy_common(HiberarchyCommon.builder().build()) - .effective_time("2020-05-01 00:00:00") - .custom_fields([]) - .cost_center_id("7142384817131652652") - .staffing_model(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("6969828847121885087") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(Department.builder() + .id("4719456877659520852") + .sub_type(Enum.builder().build()) + .manager("6893013238632416776") + .is_confidential(True) + .hiberarchy_common(HiberarchyCommon.builder().build()) + .effective_time("2020-05-01 00:00:00") + .custom_fields([]) + .cost_center_id("7142384817131652652") + .staffing_model(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchDepartmentResponse = await client.corehr.v1.department.apatch(request) + # 发起请求 + response: PatchDepartmentResponse = await client.corehr.v1.department.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.department.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.department.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_employee_type_sample.py b/samples/api/corehr/v1/patch_employee_type_sample.py index 56b78416b..ae7c2b316 100644 --- a/samples/api/corehr/v1/patch_employee_type_sample.py +++ b/samples/api/corehr/v1/patch_employee_type_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmployeeTypeRequest = PatchEmployeeTypeRequest.builder() \ - .employee_type_id("6969828847931885087") \ - .client_token("12454646") \ - .request_body(EmployeeType.builder() - .name([]) - .default_employee_type(True) - .active(True) - .code("1245") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchEmployeeTypeRequest = PatchEmployeeTypeRequest.builder() \ + .employee_type_id("6969828847931885087") \ + .client_token("12454646") \ + .request_body(EmployeeType.builder() + .name([]) + .default_employee_type(True) + .active(True) + .code("1245") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchEmployeeTypeResponse = client.corehr.v1.employee_type.patch(request) + # 发起请求 + response: PatchEmployeeTypeResponse = client.corehr.v1.employee_type.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmployeeTypeRequest = PatchEmployeeTypeRequest.builder() \ - .employee_type_id("6969828847931885087") \ - .client_token("12454646") \ - .request_body(EmployeeType.builder() - .name([]) - .default_employee_type(True) - .active(True) - .code("1245") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchEmployeeTypeRequest = PatchEmployeeTypeRequest.builder() \ + .employee_type_id("6969828847931885087") \ + .client_token("12454646") \ + .request_body(EmployeeType.builder() + .name([]) + .default_employee_type(True) + .active(True) + .code("1245") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchEmployeeTypeResponse = await client.corehr.v1.employee_type.apatch(request) + # 发起请求 + response: PatchEmployeeTypeResponse = await client.corehr.v1.employee_type.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employee_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employee_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_employment_sample.py b/samples/api/corehr/v1/patch_employment_sample.py index 35f61e50b..60e117f84 100644 --- a/samples/api/corehr/v1/patch_employment_sample.py +++ b/samples/api/corehr/v1/patch_employment_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmploymentRequest = PatchEmploymentRequest.builder() \ - .employment_id("1616161616") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(Employment.builder() - .seniority_date("2020-01-01") - .employee_number("1000000") - .employment_type(Enum.builder().build()) - .person_id("6919733936050406926") - .primary_employment(True) - .custom_fields([]) - .work_email_list([]) - .reason_for_offboarding(Enum.builder().build()) - .ats_application_id("6838119494196871234") - .build()) \ - .build() + # 构造请求对象 + request: PatchEmploymentRequest = PatchEmploymentRequest.builder() \ + .employment_id("1616161616") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(Employment.builder() + .seniority_date("2020-01-01") + .employee_number("1000000") + .employment_type(Enum.builder().build()) + .person_id("6919733936050406926") + .primary_employment(True) + .custom_fields([]) + .work_email_list([]) + .reason_for_offboarding(Enum.builder().build()) + .ats_application_id("6838119494196871234") + .build()) \ + .build() - # 发起请求 - response: PatchEmploymentResponse = client.corehr.v1.employment.patch(request) + # 发起请求 + response: PatchEmploymentResponse = client.corehr.v1.employment.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmploymentRequest = PatchEmploymentRequest.builder() \ - .employment_id("1616161616") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(Employment.builder() - .seniority_date("2020-01-01") - .employee_number("1000000") - .employment_type(Enum.builder().build()) - .person_id("6919733936050406926") - .primary_employment(True) - .custom_fields([]) - .work_email_list([]) - .reason_for_offboarding(Enum.builder().build()) - .ats_application_id("6838119494196871234") - .build()) \ - .build() + # 构造请求对象 + request: PatchEmploymentRequest = PatchEmploymentRequest.builder() \ + .employment_id("1616161616") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(Employment.builder() + .seniority_date("2020-01-01") + .employee_number("1000000") + .employment_type(Enum.builder().build()) + .person_id("6919733936050406926") + .primary_employment(True) + .custom_fields([]) + .work_email_list([]) + .reason_for_offboarding(Enum.builder().build()) + .ats_application_id("6838119494196871234") + .build()) \ + .build() - # 发起请求 - response: PatchEmploymentResponse = await client.corehr.v1.employment.apatch(request) + # 发起请求 + response: PatchEmploymentResponse = await client.corehr.v1.employment.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.employment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.employment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_job_data_sample.py b/samples/api/corehr/v1/patch_job_data_sample.py index 87d28fc97..c5b0e1086 100644 --- a/samples/api/corehr/v1/patch_job_data_sample.py +++ b/samples/api/corehr/v1/patch_job_data_sample.py @@ -5,116 +5,116 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobDataRequest = PatchJobDataRequest.builder() \ - .job_data_id("151515") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .strict_verify("false") \ - .request_body(JobData.builder() - .version_id("6890452208593372697") - .job_level_id("6890452208593372679") - .job_grade_id("6890452208593372679") - .employee_type_id("6890452208593372679") - .working_hours_type_id("6890452208593372679") - .work_location_id("6890452208593372679") - .department_id("6890452208593372679") - .job_id("6890452208593372679") - .probation_start_date("2018-03-16T00:00:00") - .probation_end_date("2019-05-24T00:00:00") - .primary_job_data(True) - .effective_time("2020-05-01 00:00:00") - .expiration_time("2020-05-02 00:00:00") - .job_family_id("1245678") - .assignment_start_reason(Enum.builder().build()) - .probation_expected_end_date("2006-01-02") - .direct_manager_id("6890452208593372679") - .dotted_line_manager_id_list([]) - .second_direct_manager_id("6890452208593372679") - .cost_center_rate([]) - .work_shift(Enum.builder().build()) - .compensation_type(Enum.builder().build()) - .service_company("6890452208593372680") - .build()) \ - .build() + # 构造请求对象 + request: PatchJobDataRequest = PatchJobDataRequest.builder() \ + .job_data_id("151515") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .strict_verify("false") \ + .request_body(JobData.builder() + .version_id("6890452208593372697") + .job_level_id("6890452208593372679") + .job_grade_id("6890452208593372679") + .employee_type_id("6890452208593372679") + .working_hours_type_id("6890452208593372679") + .work_location_id("6890452208593372679") + .department_id("6890452208593372679") + .job_id("6890452208593372679") + .probation_start_date("2018-03-16T00:00:00") + .probation_end_date("2019-05-24T00:00:00") + .primary_job_data(True) + .effective_time("2020-05-01 00:00:00") + .expiration_time("2020-05-02 00:00:00") + .job_family_id("1245678") + .assignment_start_reason(Enum.builder().build()) + .probation_expected_end_date("2006-01-02") + .direct_manager_id("6890452208593372679") + .dotted_line_manager_id_list([]) + .second_direct_manager_id("6890452208593372679") + .cost_center_rate([]) + .work_shift(Enum.builder().build()) + .compensation_type(Enum.builder().build()) + .service_company("6890452208593372680") + .build()) \ + .build() - # 发起请求 - response: PatchJobDataResponse = client.corehr.v1.job_data.patch(request) + # 发起请求 + response: PatchJobDataResponse = client.corehr.v1.job_data.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobDataRequest = PatchJobDataRequest.builder() \ - .job_data_id("151515") \ - .client_token("12454646") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .strict_verify("false") \ - .request_body(JobData.builder() - .version_id("6890452208593372697") - .job_level_id("6890452208593372679") - .job_grade_id("6890452208593372679") - .employee_type_id("6890452208593372679") - .working_hours_type_id("6890452208593372679") - .work_location_id("6890452208593372679") - .department_id("6890452208593372679") - .job_id("6890452208593372679") - .probation_start_date("2018-03-16T00:00:00") - .probation_end_date("2019-05-24T00:00:00") - .primary_job_data(True) - .effective_time("2020-05-01 00:00:00") - .expiration_time("2020-05-02 00:00:00") - .job_family_id("1245678") - .assignment_start_reason(Enum.builder().build()) - .probation_expected_end_date("2006-01-02") - .direct_manager_id("6890452208593372679") - .dotted_line_manager_id_list([]) - .second_direct_manager_id("6890452208593372679") - .cost_center_rate([]) - .work_shift(Enum.builder().build()) - .compensation_type(Enum.builder().build()) - .service_company("6890452208593372680") - .build()) \ - .build() + # 构造请求对象 + request: PatchJobDataRequest = PatchJobDataRequest.builder() \ + .job_data_id("151515") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .strict_verify("false") \ + .request_body(JobData.builder() + .version_id("6890452208593372697") + .job_level_id("6890452208593372679") + .job_grade_id("6890452208593372679") + .employee_type_id("6890452208593372679") + .working_hours_type_id("6890452208593372679") + .work_location_id("6890452208593372679") + .department_id("6890452208593372679") + .job_id("6890452208593372679") + .probation_start_date("2018-03-16T00:00:00") + .probation_end_date("2019-05-24T00:00:00") + .primary_job_data(True) + .effective_time("2020-05-01 00:00:00") + .expiration_time("2020-05-02 00:00:00") + .job_family_id("1245678") + .assignment_start_reason(Enum.builder().build()) + .probation_expected_end_date("2006-01-02") + .direct_manager_id("6890452208593372679") + .dotted_line_manager_id_list([]) + .second_direct_manager_id("6890452208593372679") + .cost_center_rate([]) + .work_shift(Enum.builder().build()) + .compensation_type(Enum.builder().build()) + .service_company("6890452208593372680") + .build()) \ + .build() - # 发起请求 - response: PatchJobDataResponse = await client.corehr.v1.job_data.apatch(request) + # 发起请求 + response: PatchJobDataResponse = await client.corehr.v1.job_data.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_data.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_data.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_job_family_sample.py b/samples/api/corehr/v1/patch_job_family_sample.py index 19950897e..0f802aca4 100644 --- a/samples/api/corehr/v1/patch_job_family_sample.py +++ b/samples/api/corehr/v1/patch_job_family_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobFamilyRequest = PatchJobFamilyRequest.builder() \ - .job_family_id("1616161616") \ - .client_token("12454646") \ - .request_body(JobFamily.builder() - .name([]) - .active(True) - .parent_id("4698020757495316313") - .effective_time("2020-05-01 00:00:00") - .code("123456") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobFamilyRequest = PatchJobFamilyRequest.builder() \ + .job_family_id("1616161616") \ + .client_token("12454646") \ + .request_body(JobFamily.builder() + .name([]) + .active(True) + .parent_id("4698020757495316313") + .effective_time("2020-05-01 00:00:00") + .code("123456") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobFamilyResponse = client.corehr.v1.job_family.patch(request) + # 发起请求 + response: PatchJobFamilyResponse = client.corehr.v1.job_family.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobFamilyRequest = PatchJobFamilyRequest.builder() \ - .job_family_id("1616161616") \ - .client_token("12454646") \ - .request_body(JobFamily.builder() - .name([]) - .active(True) - .parent_id("4698020757495316313") - .effective_time("2020-05-01 00:00:00") - .code("123456") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobFamilyRequest = PatchJobFamilyRequest.builder() \ + .job_family_id("1616161616") \ + .client_token("12454646") \ + .request_body(JobFamily.builder() + .name([]) + .active(True) + .parent_id("4698020757495316313") + .effective_time("2020-05-01 00:00:00") + .code("123456") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobFamilyResponse = await client.corehr.v1.job_family.apatch(request) + # 发起请求 + response: PatchJobFamilyResponse = await client.corehr.v1.job_family.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_family.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_family.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_job_level_sample.py b/samples/api/corehr/v1/patch_job_level_sample.py index 4b51087ff..31f17efd5 100644 --- a/samples/api/corehr/v1/patch_job_level_sample.py +++ b/samples/api/corehr/v1/patch_job_level_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobLevelRequest = PatchJobLevelRequest.builder() \ - .job_level_id("1616161616") \ - .client_token("12454646") \ - .request_body(JobLevel.builder() - .level_order(9999) - .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") - .name([]) - .description([]) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobLevelRequest = PatchJobLevelRequest.builder() \ + .job_level_id("1616161616") \ + .client_token("12454646") \ + .request_body(JobLevel.builder() + .level_order(9999) + .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") + .name([]) + .description([]) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobLevelResponse = client.corehr.v1.job_level.patch(request) + # 发起请求 + response: PatchJobLevelResponse = client.corehr.v1.job_level.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobLevelRequest = PatchJobLevelRequest.builder() \ - .job_level_id("1616161616") \ - .client_token("12454646") \ - .request_body(JobLevel.builder() - .level_order(9999) - .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") - .name([]) - .description([]) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobLevelRequest = PatchJobLevelRequest.builder() \ + .job_level_id("1616161616") \ + .client_token("12454646") \ + .request_body(JobLevel.builder() + .level_order(9999) + .code("VQzo/BSonp8l6PmcZ+VlDhkd2595LMkhyBAGX6HAlCY=") + .name([]) + .description([]) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobLevelResponse = await client.corehr.v1.job_level.apatch(request) + # 发起请求 + response: PatchJobLevelResponse = await client.corehr.v1.job_level.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job_level.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job_level.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_job_sample.py b/samples/api/corehr/v1/patch_job_sample.py index b28b49943..afff7f0b0 100644 --- a/samples/api/corehr/v1/patch_job_sample.py +++ b/samples/api/corehr/v1/patch_job_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobRequest = PatchJobRequest.builder() \ - .job_id("1616161616") \ - .client_token("12454646") \ - .request_body(Job.builder() - .code("JP422119") - .name([]) - .description([]) - .active(True) - .job_title([]) - .job_family_id_list([]) - .job_level_id_list([]) - .working_hours_type_id("6890452208593372679") - .effective_time("2020-01-01 00:00:00") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobRequest = PatchJobRequest.builder() \ + .job_id("1616161616") \ + .client_token("12454646") \ + .request_body(Job.builder() + .code("JP422119") + .name([]) + .description([]) + .active(True) + .job_title([]) + .job_family_id_list([]) + .job_level_id_list([]) + .working_hours_type_id("6890452208593372679") + .effective_time("2020-01-01 00:00:00") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobResponse = client.corehr.v1.job.patch(request) + # 发起请求 + response: PatchJobResponse = client.corehr.v1.job.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchJobRequest = PatchJobRequest.builder() \ - .job_id("1616161616") \ - .client_token("12454646") \ - .request_body(Job.builder() - .code("JP422119") - .name([]) - .description([]) - .active(True) - .job_title([]) - .job_family_id_list([]) - .job_level_id_list([]) - .working_hours_type_id("6890452208593372679") - .effective_time("2020-01-01 00:00:00") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchJobRequest = PatchJobRequest.builder() \ + .job_id("1616161616") \ + .client_token("12454646") \ + .request_body(Job.builder() + .code("JP422119") + .name([]) + .description([]) + .active(True) + .job_title([]) + .job_family_id_list([]) + .job_level_id_list([]) + .working_hours_type_id("6890452208593372679") + .effective_time("2020-01-01 00:00:00") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchJobResponse = await client.corehr.v1.job.apatch(request) + # 发起请求 + response: PatchJobResponse = await client.corehr.v1.job.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.job.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.job.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_national_id_type_sample.py b/samples/api/corehr/v1/patch_national_id_type_sample.py index 1aeb4b2c1..a4436856f 100644 --- a/samples/api/corehr/v1/patch_national_id_type_sample.py +++ b/samples/api/corehr/v1/patch_national_id_type_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNationalIdTypeRequest = PatchNationalIdTypeRequest.builder() \ - .national_id_type_id("1616161616") \ - .client_token("12454646") \ - .request_body(NationalIdType.builder() - .country_region_id("6862995747139225096") - .name([]) - .active(True) - .validation_rule("") - .validation_rule_description([]) - .code("AUS-TFN") - .identification_type(Enum.builder().build()) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchNationalIdTypeRequest = PatchNationalIdTypeRequest.builder() \ + .national_id_type_id("1616161616") \ + .client_token("12454646") \ + .request_body(NationalIdType.builder() + .country_region_id("6862995747139225096") + .name([]) + .active(True) + .validation_rule("") + .validation_rule_description([]) + .code("AUS-TFN") + .identification_type(Enum.builder().build()) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchNationalIdTypeResponse = client.corehr.v1.national_id_type.patch(request) + # 发起请求 + response: PatchNationalIdTypeResponse = client.corehr.v1.national_id_type.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNationalIdTypeRequest = PatchNationalIdTypeRequest.builder() \ - .national_id_type_id("1616161616") \ - .client_token("12454646") \ - .request_body(NationalIdType.builder() - .country_region_id("6862995747139225096") - .name([]) - .active(True) - .validation_rule("") - .validation_rule_description([]) - .code("AUS-TFN") - .identification_type(Enum.builder().build()) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchNationalIdTypeRequest = PatchNationalIdTypeRequest.builder() \ + .national_id_type_id("1616161616") \ + .client_token("12454646") \ + .request_body(NationalIdType.builder() + .country_region_id("6862995747139225096") + .name([]) + .active(True) + .validation_rule("") + .validation_rule_description([]) + .code("AUS-TFN") + .identification_type(Enum.builder().build()) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchNationalIdTypeResponse = await client.corehr.v1.national_id_type.apatch(request) + # 发起请求 + response: PatchNationalIdTypeResponse = await client.corehr.v1.national_id_type.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.national_id_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.national_id_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_person_sample.py b/samples/api/corehr/v1/patch_person_sample.py index fedf55e2c..274a42bd0 100644 --- a/samples/api/corehr/v1/patch_person_sample.py +++ b/samples/api/corehr/v1/patch_person_sample.py @@ -5,106 +5,106 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPersonRequest = PatchPersonRequest.builder() \ - .person_id("6969828847931885087") \ - .client_token("12454646") \ - .request_body(Person.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .nationality_id("7075702732803278381") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .custom_fields([]) - .resident_tax_id_list([]) - .age(22) - .personal_profile([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchPersonRequest = PatchPersonRequest.builder() \ + .person_id("6969828847931885087") \ + .client_token("12454646") \ + .request_body(Person.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .nationality_id("7075702732803278381") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .custom_fields([]) + .resident_tax_id_list([]) + .age(22) + .personal_profile([]) + .build()) \ + .build() - # 发起请求 - response: PatchPersonResponse = client.corehr.v1.person.patch(request) + # 发起请求 + response: PatchPersonResponse = client.corehr.v1.person.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPersonRequest = PatchPersonRequest.builder() \ - .person_id("6969828847931885087") \ - .client_token("12454646") \ - .request_body(Person.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .nationality_id("7075702732803278381") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .custom_fields([]) - .resident_tax_id_list([]) - .age(22) - .personal_profile([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchPersonRequest = PatchPersonRequest.builder() \ + .person_id("6969828847931885087") \ + .client_token("12454646") \ + .request_body(Person.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .nationality_id("7075702732803278381") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .custom_fields([]) + .resident_tax_id_list([]) + .age(22) + .personal_profile([]) + .build()) \ + .build() - # 发起请求 - response: PatchPersonResponse = await client.corehr.v1.person.apatch(request) + # 发起请求 + response: PatchPersonResponse = await client.corehr.v1.person.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_pre_hire_sample.py b/samples/api/corehr/v1/patch_pre_hire_sample.py index a7ecfb0d7..d86ed8974 100644 --- a/samples/api/corehr/v1/patch_pre_hire_sample.py +++ b/samples/api/corehr/v1/patch_pre_hire_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPreHireRequest = PatchPreHireRequest.builder() \ - .pre_hire_id("1616161616") \ - .client_token("12454646") \ - .request_body(PreHire.builder() - .ats_application_id("4719168654814483759") - .hire_date("2020-01-01") - .employee_type(Enum.builder().build()) - .worker_id("1245646") - .employee_type_id("正式") - .person_id("656464648662") - .custom_fields([]) - .cost_center_rate([]) - .onboarding_status(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchPreHireRequest = PatchPreHireRequest.builder() \ + .pre_hire_id("1616161616") \ + .client_token("12454646") \ + .request_body(PreHire.builder() + .ats_application_id("4719168654814483759") + .hire_date("2020-01-01") + .employee_type(Enum.builder().build()) + .worker_id("1245646") + .employee_type_id("正式") + .person_id("656464648662") + .custom_fields([]) + .cost_center_rate([]) + .onboarding_status(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchPreHireResponse = client.corehr.v1.pre_hire.patch(request) + # 发起请求 + response: PatchPreHireResponse = client.corehr.v1.pre_hire.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPreHireRequest = PatchPreHireRequest.builder() \ - .pre_hire_id("1616161616") \ - .client_token("12454646") \ - .request_body(PreHire.builder() - .ats_application_id("4719168654814483759") - .hire_date("2020-01-01") - .employee_type(Enum.builder().build()) - .worker_id("1245646") - .employee_type_id("正式") - .person_id("656464648662") - .custom_fields([]) - .cost_center_rate([]) - .onboarding_status(Enum.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchPreHireRequest = PatchPreHireRequest.builder() \ + .pre_hire_id("1616161616") \ + .client_token("12454646") \ + .request_body(PreHire.builder() + .ats_application_id("4719168654814483759") + .hire_date("2020-01-01") + .employee_type(Enum.builder().build()) + .worker_id("1245646") + .employee_type_id("正式") + .person_id("656464648662") + .custom_fields([]) + .cost_center_rate([]) + .onboarding_status(Enum.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchPreHireResponse = await client.corehr.v1.pre_hire.apatch(request) + # 发起请求 + response: PatchPreHireResponse = await client.corehr.v1.pre_hire.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.pre_hire.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.pre_hire.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/patch_working_hours_type_sample.py b/samples/api/corehr/v1/patch_working_hours_type_sample.py index 7e2f9fed0..a2e74b0f0 100644 --- a/samples/api/corehr/v1/patch_working_hours_type_sample.py +++ b/samples/api/corehr/v1/patch_working_hours_type_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchWorkingHoursTypeRequest = PatchWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("1616161616") \ - .client_token("12454646") \ - .request_body(WorkingHoursType.builder() - .code("1") - .name([]) - .country_region_id_list([]) - .default_for_job(True) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchWorkingHoursTypeRequest = PatchWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("1616161616") \ + .client_token("12454646") \ + .request_body(WorkingHoursType.builder() + .code("1") + .name([]) + .country_region_id_list([]) + .default_for_job(True) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.patch(request) + # 发起请求 + response: PatchWorkingHoursTypeResponse = client.corehr.v1.working_hours_type.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchWorkingHoursTypeRequest = PatchWorkingHoursTypeRequest.builder() \ - .working_hours_type_id("1616161616") \ - .client_token("12454646") \ - .request_body(WorkingHoursType.builder() - .code("1") - .name([]) - .country_region_id_list([]) - .default_for_job(True) - .active(True) - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchWorkingHoursTypeRequest = PatchWorkingHoursTypeRequest.builder() \ + .working_hours_type_id("1616161616") \ + .client_token("12454646") \ + .request_body(WorkingHoursType.builder() + .code("1") + .name([]) + .country_region_id_list([]) + .default_for_job(True) + .active(True) + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.apatch(request) + # 发起请求 + response: PatchWorkingHoursTypeResponse = await client.corehr.v1.working_hours_type.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.working_hours_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.working_hours_type.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_authorization_sample.py b/samples/api/corehr/v1/query_authorization_sample.py index 477e4f775..b1dc04c8f 100644 --- a/samples/api/corehr/v1/query_authorization_sample.py +++ b/samples/api/corehr/v1/query_authorization_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryAuthorizationRequest = QueryAuthorizationRequest.builder() \ - .employment_id_list([]) \ - .role_id_list([]) \ - .page_token("6969864184272078374") \ - .page_size("20") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: QueryAuthorizationRequest = QueryAuthorizationRequest.builder() \ + .employment_id_list([]) \ + .role_id_list([]) \ + .page_token("6969864184272078374") \ + .page_size("20") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: QueryAuthorizationResponse = client.corehr.v1.authorization.query(request) + # 发起请求 + response: QueryAuthorizationResponse = client.corehr.v1.authorization.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryAuthorizationRequest = QueryAuthorizationRequest.builder() \ - .employment_id_list([]) \ - .role_id_list([]) \ - .page_token("6969864184272078374") \ - .page_size("20") \ - .user_id_type("people_corehr_id") \ - .build() + # 构造请求对象 + request: QueryAuthorizationRequest = QueryAuthorizationRequest.builder() \ + .employment_id_list([]) \ + .role_id_list([]) \ + .page_token("6969864184272078374") \ + .page_size("20") \ + .user_id_type("people_corehr_id") \ + .build() - # 发起请求 - response: QueryAuthorizationResponse = await client.corehr.v1.authorization.aquery(request) + # 发起请求 + response: QueryAuthorizationResponse = await client.corehr.v1.authorization.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_custom_field_sample.py b/samples/api/corehr/v1/query_custom_field_sample.py index 19639591d..7155e6e23 100644 --- a/samples/api/corehr/v1/query_custom_field_sample.py +++ b/samples/api/corehr/v1/query_custom_field_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryCustomFieldRequest = QueryCustomFieldRequest.builder() \ - .object_api_name_list([]) \ - .build() + # 构造请求对象 + request: QueryCustomFieldRequest = QueryCustomFieldRequest.builder() \ + .object_api_name_list([]) \ + .build() - # 发起请求 - response: QueryCustomFieldResponse = client.corehr.v1.custom_field.query(request) + # 发起请求 + response: QueryCustomFieldResponse = client.corehr.v1.custom_field.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryCustomFieldRequest = QueryCustomFieldRequest.builder() \ - .object_api_name_list([]) \ - .build() + # 构造请求对象 + request: QueryCustomFieldRequest = QueryCustomFieldRequest.builder() \ + .object_api_name_list([]) \ + .build() - # 发起请求 - response: QueryCustomFieldResponse = await client.corehr.v1.custom_field.aquery(request) + # 发起请求 + response: QueryCustomFieldResponse = await client.corehr.v1.custom_field.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.custom_field.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.custom_field.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_offboarding_sample.py b/samples/api/corehr/v1/query_offboarding_sample.py index 999ceb38b..c973c9b8e 100644 --- a/samples/api/corehr/v1/query_offboarding_sample.py +++ b/samples/api/corehr/v1/query_offboarding_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryOffboardingRequest = QueryOffboardingRequest.builder() \ - .request_body(QueryOffboardingRequestBody.builder() - .active(True) - .offboarding_reason_unique_identifier([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryOffboardingRequest = QueryOffboardingRequest.builder() \ + .request_body(QueryOffboardingRequestBody.builder() + .active(True) + .offboarding_reason_unique_identifier([]) + .build()) \ + .build() - # 发起请求 - response: QueryOffboardingResponse = client.corehr.v1.offboarding.query(request) + # 发起请求 + response: QueryOffboardingResponse = client.corehr.v1.offboarding.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryOffboardingRequest = QueryOffboardingRequest.builder() \ - .request_body(QueryOffboardingRequestBody.builder() - .active(True) - .offboarding_reason_unique_identifier([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryOffboardingRequest = QueryOffboardingRequest.builder() \ + .request_body(QueryOffboardingRequestBody.builder() + .active(True) + .offboarding_reason_unique_identifier([]) + .build()) \ + .build() - # 发起请求 - response: QueryOffboardingResponse = await client.corehr.v1.offboarding.aquery(request) + # 发起请求 + response: QueryOffboardingResponse = await client.corehr.v1.offboarding.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_security_group_sample.py b/samples/api/corehr/v1/query_security_group_sample.py index ab2f87fcc..661784208 100644 --- a/samples/api/corehr/v1/query_security_group_sample.py +++ b/samples/api/corehr/v1/query_security_group_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySecurityGroupRequest = QuerySecurityGroupRequest.builder() \ - .department_id_type("people_corehr_department_id") \ - .request_body(QuerySecurityGroupRequestBody.builder() - .item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: QuerySecurityGroupRequest = QuerySecurityGroupRequest.builder() \ + .department_id_type("people_corehr_department_id") \ + .request_body(QuerySecurityGroupRequestBody.builder() + .item_list([]) + .build()) \ + .build() - # 发起请求 - response: QuerySecurityGroupResponse = client.corehr.v1.security_group.query(request) + # 发起请求 + response: QuerySecurityGroupResponse = client.corehr.v1.security_group.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.security_group.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.security_group.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySecurityGroupRequest = QuerySecurityGroupRequest.builder() \ - .department_id_type("people_corehr_department_id") \ - .request_body(QuerySecurityGroupRequestBody.builder() - .item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: QuerySecurityGroupRequest = QuerySecurityGroupRequest.builder() \ + .department_id_type("people_corehr_department_id") \ + .request_body(QuerySecurityGroupRequestBody.builder() + .item_list([]) + .build()) \ + .build() - # 发起请求 - response: QuerySecurityGroupResponse = await client.corehr.v1.security_group.aquery(request) + # 发起请求 + response: QuerySecurityGroupResponse = await client.corehr.v1.security_group.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.security_group.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.security_group.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_transfer_reason_sample.py b/samples/api/corehr/v1/query_transfer_reason_sample.py index b39a10b8c..ddd4b1758 100644 --- a/samples/api/corehr/v1/query_transfer_reason_sample.py +++ b/samples/api/corehr/v1/query_transfer_reason_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTransferReasonRequest = QueryTransferReasonRequest.builder() \ - .active(True) \ - .transfer_reason_unique_identifier([]) \ - .build() + # 构造请求对象 + request: QueryTransferReasonRequest = QueryTransferReasonRequest.builder() \ + .active(True) \ + .transfer_reason_unique_identifier([]) \ + .build() - # 发起请求 - response: QueryTransferReasonResponse = client.corehr.v1.transfer_reason.query(request) + # 发起请求 + response: QueryTransferReasonResponse = client.corehr.v1.transfer_reason.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.transfer_reason.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.transfer_reason.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTransferReasonRequest = QueryTransferReasonRequest.builder() \ - .active(True) \ - .transfer_reason_unique_identifier([]) \ - .build() + # 构造请求对象 + request: QueryTransferReasonRequest = QueryTransferReasonRequest.builder() \ + .active(True) \ + .transfer_reason_unique_identifier([]) \ + .build() - # 发起请求 - response: QueryTransferReasonResponse = await client.corehr.v1.transfer_reason.aquery(request) + # 发起请求 + response: QueryTransferReasonResponse = await client.corehr.v1.transfer_reason.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.transfer_reason.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.transfer_reason.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/query_transfer_type_sample.py b/samples/api/corehr/v1/query_transfer_type_sample.py index 77a84b683..afe4043cb 100644 --- a/samples/api/corehr/v1/query_transfer_type_sample.py +++ b/samples/api/corehr/v1/query_transfer_type_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTransferTypeRequest = QueryTransferTypeRequest.builder() \ - .active(True) \ - .transfer_type_unique_identifier([]) \ - .build() + # 构造请求对象 + request: QueryTransferTypeRequest = QueryTransferTypeRequest.builder() \ + .active(True) \ + .transfer_type_unique_identifier([]) \ + .build() - # 发起请求 - response: QueryTransferTypeResponse = client.corehr.v1.transfer_type.query(request) + # 发起请求 + response: QueryTransferTypeResponse = client.corehr.v1.transfer_type.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.transfer_type.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.transfer_type.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTransferTypeRequest = QueryTransferTypeRequest.builder() \ - .active(True) \ - .transfer_type_unique_identifier([]) \ - .build() + # 构造请求对象 + request: QueryTransferTypeRequest = QueryTransferTypeRequest.builder() \ + .active(True) \ + .transfer_type_unique_identifier([]) \ + .build() - # 发起请求 - response: QueryTransferTypeResponse = await client.corehr.v1.transfer_type.aquery(request) + # 发起请求 + response: QueryTransferTypeResponse = await client.corehr.v1.transfer_type.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.transfer_type.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.transfer_type.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/remove_role_assign_authorization_sample.py b/samples/api/corehr/v1/remove_role_assign_authorization_sample.py index b094dd75d..afe825c8a 100644 --- a/samples/api/corehr/v1/remove_role_assign_authorization_sample.py +++ b/samples/api/corehr/v1/remove_role_assign_authorization_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRoleAssignAuthorizationRequest = RemoveRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .build() + # 构造请求对象 + request: RemoveRoleAssignAuthorizationRequest = RemoveRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .build() - # 发起请求 - response: RemoveRoleAssignAuthorizationResponse = client.corehr.v1.authorization.remove_role_assign(request) + # 发起请求 + response: RemoveRoleAssignAuthorizationResponse = client.corehr.v1.authorization.remove_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.remove_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.remove_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRoleAssignAuthorizationRequest = RemoveRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .build() + # 构造请求对象 + request: RemoveRoleAssignAuthorizationRequest = RemoveRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .build() - # 发起请求 - response: RemoveRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aremove_role_assign(request) + # 发起请求 + response: RemoveRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aremove_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.aremove_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.aremove_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/search_assigned_user_sample.py b/samples/api/corehr/v1/search_assigned_user_sample.py index 6b3fa5c6c..9a8e230f7 100644 --- a/samples/api/corehr/v1/search_assigned_user_sample.py +++ b/samples/api/corehr/v1/search_assigned_user_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchAssignedUserRequest = SearchAssignedUserRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(SearchAssignedUserRequestBody.builder() - .role_id("100") - .management_scope_list([]) - .search_method("1") - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") - .page_size("100") - .build()) \ - .build() + # 构造请求对象 + request: SearchAssignedUserRequest = SearchAssignedUserRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(SearchAssignedUserRequestBody.builder() + .role_id("100") + .management_scope_list([]) + .search_method("1") + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") + .page_size("100") + .build()) \ + .build() - # 发起请求 - response: SearchAssignedUserResponse = client.corehr.v1.assigned_user.search(request) + # 发起请求 + response: SearchAssignedUserResponse = client.corehr.v1.assigned_user.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.assigned_user.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.assigned_user.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchAssignedUserRequest = SearchAssignedUserRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(SearchAssignedUserRequestBody.builder() - .role_id("100") - .management_scope_list([]) - .search_method("1") - .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") - .page_size("100") - .build()) \ - .build() + # 构造请求对象 + request: SearchAssignedUserRequest = SearchAssignedUserRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(SearchAssignedUserRequestBody.builder() + .role_id("100") + .management_scope_list([]) + .search_method("1") + .page_token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") + .page_size("100") + .build()) \ + .build() - # 发起请求 - response: SearchAssignedUserResponse = await client.corehr.v1.assigned_user.asearch(request) + # 发起请求 + response: SearchAssignedUserResponse = await client.corehr.v1.assigned_user.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.assigned_user.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.assigned_user.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/search_offboarding_sample.py b/samples/api/corehr/v1/search_offboarding_sample.py index ac5180e79..1e51c3b2d 100644 --- a/samples/api/corehr/v1/search_offboarding_sample.py +++ b/samples/api/corehr/v1/search_offboarding_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchOffboardingRequest = SearchOffboardingRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .request_body(SearchOffboardingRequestBody.builder() - .employment_ids([]) - .apply_initiating_time_start("2022-01-01 11:22:33") - .apply_initiating_time_end("2022-01-01 11:22:33") - .expected_offboarding_date_start("2022-01-01") - .expected_offboarding_date_end("2022-01-01") - .offboarding_date_start("2022-01-01") - .offboarding_date_end("2022-01-01") - .statuses([]) - .reasons([]) - .employee_reasons([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchOffboardingRequest = SearchOffboardingRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .request_body(SearchOffboardingRequestBody.builder() + .employment_ids([]) + .apply_initiating_time_start("2022-01-01 11:22:33") + .apply_initiating_time_end("2022-01-01 11:22:33") + .expected_offboarding_date_start("2022-01-01") + .expected_offboarding_date_end("2022-01-01") + .offboarding_date_start("2022-01-01") + .offboarding_date_end("2022-01-01") + .statuses([]) + .reasons([]) + .employee_reasons([]) + .build()) \ + .build() - # 发起请求 - response: SearchOffboardingResponse = client.corehr.v1.offboarding.search(request) + # 发起请求 + response: SearchOffboardingResponse = client.corehr.v1.offboarding.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchOffboardingRequest = SearchOffboardingRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .request_body(SearchOffboardingRequestBody.builder() - .employment_ids([]) - .apply_initiating_time_start("2022-01-01 11:22:33") - .apply_initiating_time_end("2022-01-01 11:22:33") - .expected_offboarding_date_start("2022-01-01") - .expected_offboarding_date_end("2022-01-01") - .offboarding_date_start("2022-01-01") - .offboarding_date_end("2022-01-01") - .statuses([]) - .reasons([]) - .employee_reasons([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchOffboardingRequest = SearchOffboardingRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .request_body(SearchOffboardingRequestBody.builder() + .employment_ids([]) + .apply_initiating_time_start("2022-01-01 11:22:33") + .apply_initiating_time_end("2022-01-01 11:22:33") + .expected_offboarding_date_start("2022-01-01") + .expected_offboarding_date_end("2022-01-01") + .offboarding_date_start("2022-01-01") + .offboarding_date_end("2022-01-01") + .statuses([]) + .reasons([]) + .employee_reasons([]) + .build()) \ + .build() - # 发起请求 - response: SearchOffboardingResponse = await client.corehr.v1.offboarding.asearch(request) + # 发起请求 + response: SearchOffboardingResponse = await client.corehr.v1.offboarding.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/submit_offboarding_sample.py b/samples/api/corehr/v1/submit_offboarding_sample.py index f42d61f9f..37833ad98 100644 --- a/samples/api/corehr/v1/submit_offboarding_sample.py +++ b/samples/api/corehr/v1/submit_offboarding_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitOffboardingRequest = SubmitOffboardingRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(SubmitOffboardingRequestBody.builder() - .offboarding_mode(1) - .employment_id("6982509313466189342") - .offboarding_date("2022-05-18") - .offboarding_reason_unique_identifier("reason_for_offboarding_option8") - .offboarding_reason_explanation("离职原因说明") - .initiator_id("6982509313466189341") - .add_block_list(False) - .block_reason("红线") - .block_reason_explanation("xx 年 xx 月 xx 日因 xx 原因红线") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SubmitOffboardingRequest = SubmitOffboardingRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(SubmitOffboardingRequestBody.builder() + .offboarding_mode(1) + .employment_id("6982509313466189342") + .offboarding_date("2022-05-18") + .offboarding_reason_unique_identifier("reason_for_offboarding_option8") + .offboarding_reason_explanation("离职原因说明") + .initiator_id("6982509313466189341") + .add_block_list(False) + .block_reason("红线") + .block_reason_explanation("xx 年 xx 月 xx 日因 xx 原因红线") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: SubmitOffboardingResponse = client.corehr.v1.offboarding.submit(request) + # 发起请求 + response: SubmitOffboardingResponse = client.corehr.v1.offboarding.submit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.submit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.submit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitOffboardingRequest = SubmitOffboardingRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(SubmitOffboardingRequestBody.builder() - .offboarding_mode(1) - .employment_id("6982509313466189342") - .offboarding_date("2022-05-18") - .offboarding_reason_unique_identifier("reason_for_offboarding_option8") - .offboarding_reason_explanation("离职原因说明") - .initiator_id("6982509313466189341") - .add_block_list(False) - .block_reason("红线") - .block_reason_explanation("xx 年 xx 月 xx 日因 xx 原因红线") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SubmitOffboardingRequest = SubmitOffboardingRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(SubmitOffboardingRequestBody.builder() + .offboarding_mode(1) + .employment_id("6982509313466189342") + .offboarding_date("2022-05-18") + .offboarding_reason_unique_identifier("reason_for_offboarding_option8") + .offboarding_reason_explanation("离职原因说明") + .initiator_id("6982509313466189341") + .add_block_list(False) + .block_reason("红线") + .block_reason_explanation("xx 年 xx 月 xx 日因 xx 原因红线") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: SubmitOffboardingResponse = await client.corehr.v1.offboarding.asubmit(request) + # 发起请求 + response: SubmitOffboardingResponse = await client.corehr.v1.offboarding.asubmit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.offboarding.asubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.offboarding.asubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/update_role_assign_authorization_sample.py b/samples/api/corehr/v1/update_role_assign_authorization_sample.py index 005900706..7f70ebe3a 100644 --- a/samples/api/corehr/v1/update_role_assign_authorization_sample.py +++ b/samples/api/corehr/v1/update_role_assign_authorization_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateRoleAssignAuthorizationRequest = UpdateRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .request_body(UpdateRoleAssignAuthorizationRequestBody.builder() - .assigned_organization_items([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateRoleAssignAuthorizationRequest = UpdateRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .request_body(UpdateRoleAssignAuthorizationRequestBody.builder() + .assigned_organization_items([]) + .build()) \ + .build() - # 发起请求 - response: UpdateRoleAssignAuthorizationResponse = client.corehr.v1.authorization.update_role_assign(request) + # 发起请求 + response: UpdateRoleAssignAuthorizationResponse = client.corehr.v1.authorization.update_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.update_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.update_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateRoleAssignAuthorizationRequest = UpdateRoleAssignAuthorizationRequest.builder() \ - .employment_id("67489937334909845") \ - .user_id_type("people_corehr_id") \ - .role_id("67489937334909845") \ - .request_body(UpdateRoleAssignAuthorizationRequestBody.builder() - .assigned_organization_items([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateRoleAssignAuthorizationRequest = UpdateRoleAssignAuthorizationRequest.builder() \ + .employment_id("67489937334909845") \ + .user_id_type("people_corehr_id") \ + .role_id("67489937334909845") \ + .request_body(UpdateRoleAssignAuthorizationRequestBody.builder() + .assigned_organization_items([]) + .build()) \ + .build() - # 发起请求 - response: UpdateRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aupdate_role_assign(request) + # 发起请求 + response: UpdateRoleAssignAuthorizationResponse = await client.corehr.v1.authorization.aupdate_role_assign(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.authorization.aupdate_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.authorization.aupdate_role_assign failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v1/upload_person_sample.py b/samples/api/corehr/v1/upload_person_sample.py index 2101b5988..902ec5915 100644 --- a/samples/api/corehr/v1/upload_person_sample.py +++ b/samples/api/corehr/v1/upload_person_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPersonRequest = UploadPersonRequest.builder() \ - .request_body(UploadPersonRequestBody.builder() - .file_content(file) - .file_name("个人信息") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPersonRequest = UploadPersonRequest.builder() \ + .request_body(UploadPersonRequestBody.builder() + .file_content(file) + .file_name("个人信息") + .build()) \ + .build() - # 发起请求 - response: UploadPersonResponse = client.corehr.v1.person.upload(request) + # 发起请求 + response: UploadPersonResponse = client.corehr.v1.person.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPersonRequest = UploadPersonRequest.builder() \ - .request_body(UploadPersonRequestBody.builder() - .file_content(file) - .file_name("个人信息") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPersonRequest = UploadPersonRequest.builder() \ + .request_body(UploadPersonRequestBody.builder() + .file_content(file) + .file_name("个人信息") + .build()) \ + .build() - # 发起请求 - response: UploadPersonResponse = await client.corehr.v1.person.aupload(request) + # 发起请求 + response: UploadPersonResponse = await client.corehr.v1.person.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v1.person.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.person.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_company_sample.py b/samples/api/corehr/v2/batch_get_company_sample.py index c62499cb6..448c5aa97 100644 --- a/samples/api/corehr/v2/batch_get_company_sample.py +++ b/samples/api/corehr/v2/batch_get_company_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetCompanyRequest = BatchGetCompanyRequest.builder() \ - .request_body(BatchGetCompanyRequestBody.builder() - .company_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetCompanyRequest = BatchGetCompanyRequest.builder() \ + .request_body(BatchGetCompanyRequestBody.builder() + .company_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetCompanyResponse = client.corehr.v2.company.batch_get(request) + # 发起请求 + response: BatchGetCompanyResponse = client.corehr.v2.company.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.company.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.company.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetCompanyRequest = BatchGetCompanyRequest.builder() \ - .request_body(BatchGetCompanyRequestBody.builder() - .company_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetCompanyRequest = BatchGetCompanyRequest.builder() \ + .request_body(BatchGetCompanyRequestBody.builder() + .company_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetCompanyResponse = await client.corehr.v2.company.abatch_get(request) + # 发起请求 + response: BatchGetCompanyResponse = await client.corehr.v2.company.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.company.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.company.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_department_sample.py b/samples/api/corehr/v2/batch_get_department_sample.py index d72e464a5..b70013e01 100644 --- a/samples/api/corehr/v2/batch_get_department_sample.py +++ b/samples/api/corehr/v2/batch_get_department_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetDepartmentRequest = BatchGetDepartmentRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchGetDepartmentRequestBody.builder() - .department_id_list([]) - .fields([]) - .department_name_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetDepartmentRequest = BatchGetDepartmentRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchGetDepartmentRequestBody.builder() + .department_id_list([]) + .fields([]) + .department_name_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetDepartmentResponse = client.corehr.v2.department.batch_get(request) + # 发起请求 + response: BatchGetDepartmentResponse = client.corehr.v2.department.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetDepartmentRequest = BatchGetDepartmentRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchGetDepartmentRequestBody.builder() - .department_id_list([]) - .fields([]) - .department_name_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetDepartmentRequest = BatchGetDepartmentRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchGetDepartmentRequestBody.builder() + .department_id_list([]) + .fields([]) + .department_name_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetDepartmentResponse = await client.corehr.v2.department.abatch_get(request) + # 发起请求 + response: BatchGetDepartmentResponse = await client.corehr.v2.department.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_employee_sample.py b/samples/api/corehr/v2/batch_get_employee_sample.py index 651994039..ceca244d9 100644 --- a/samples/api/corehr/v2/batch_get_employee_sample.py +++ b/samples/api/corehr/v2/batch_get_employee_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeeRequest = BatchGetEmployeeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchGetEmployeeRequestBody.builder() - .fields([]) - .employment_ids([]) - .person_ids([]) - .work_emails([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeeRequest = BatchGetEmployeeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchGetEmployeeRequestBody.builder() + .fields([]) + .employment_ids([]) + .person_ids([]) + .work_emails([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeeResponse = client.corehr.v2.employee.batch_get(request) + # 发起请求 + response: BatchGetEmployeeResponse = client.corehr.v2.employee.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeeRequest = BatchGetEmployeeRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchGetEmployeeRequestBody.builder() - .fields([]) - .employment_ids([]) - .person_ids([]) - .work_emails([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeeRequest = BatchGetEmployeeRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchGetEmployeeRequestBody.builder() + .fields([]) + .employment_ids([]) + .person_ids([]) + .work_emails([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeeResponse = await client.corehr.v2.employee.abatch_get(request) + # 发起请求 + response: BatchGetEmployeeResponse = await client.corehr.v2.employee.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_employees_bp_sample.py b/samples/api/corehr/v2/batch_get_employees_bp_sample.py index 7c126b69f..e4af5d632 100644 --- a/samples/api/corehr/v2/batch_get_employees_bp_sample.py +++ b/samples/api/corehr/v2/batch_get_employees_bp_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeesBpRequest = BatchGetEmployeesBpRequest.builder() \ - .user_id_type("open_id") \ - .request_body(BatchGetEmployeesBpRequestBody.builder() - .employment_ids([]) - .get_all(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeesBpRequest = BatchGetEmployeesBpRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BatchGetEmployeesBpRequestBody.builder() + .employment_ids([]) + .get_all(False) + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeesBpResponse = client.corehr.v2.employees_bp.batch_get(request) + # 发起请求 + response: BatchGetEmployeesBpResponse = client.corehr.v2.employees_bp.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_bp.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_bp.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeesBpRequest = BatchGetEmployeesBpRequest.builder() \ - .user_id_type("open_id") \ - .request_body(BatchGetEmployeesBpRequestBody.builder() - .employment_ids([]) - .get_all(False) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeesBpRequest = BatchGetEmployeesBpRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BatchGetEmployeesBpRequestBody.builder() + .employment_ids([]) + .get_all(False) + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeesBpResponse = await client.corehr.v2.employees_bp.abatch_get(request) + # 发起请求 + response: BatchGetEmployeesBpResponse = await client.corehr.v2.employees_bp.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_bp.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_bp.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_employees_job_data_sample.py b/samples/api/corehr/v2/batch_get_employees_job_data_sample.py index e16ec4773..77b7f6e74 100644 --- a/samples/api/corehr/v2/batch_get_employees_job_data_sample.py +++ b/samples/api/corehr/v2/batch_get_employees_job_data_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeesJobDataRequest = BatchGetEmployeesJobDataRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(BatchGetEmployeesJobDataRequestBody.builder() - .employment_ids([]) - .get_all_version(False) - .effective_date_start("2020-01-01") - .effective_date_end("2020-01-01") - .data_date("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeesJobDataRequest = BatchGetEmployeesJobDataRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(BatchGetEmployeesJobDataRequestBody.builder() + .employment_ids([]) + .get_all_version(False) + .effective_date_start("2020-01-01") + .effective_date_end("2020-01-01") + .data_date("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeesJobDataResponse = client.corehr.v2.employees_job_data.batch_get(request) + # 发起请求 + response: BatchGetEmployeesJobDataResponse = client.corehr.v2.employees_job_data.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_job_data.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_job_data.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetEmployeesJobDataRequest = BatchGetEmployeesJobDataRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(BatchGetEmployeesJobDataRequestBody.builder() - .employment_ids([]) - .get_all_version(False) - .effective_date_start("2020-01-01") - .effective_date_end("2020-01-01") - .data_date("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: BatchGetEmployeesJobDataRequest = BatchGetEmployeesJobDataRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(BatchGetEmployeesJobDataRequestBody.builder() + .employment_ids([]) + .get_all_version(False) + .effective_date_start("2020-01-01") + .effective_date_end("2020-01-01") + .data_date("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: BatchGetEmployeesJobDataResponse = await client.corehr.v2.employees_job_data.abatch_get(request) + # 发起请求 + response: BatchGetEmployeesJobDataResponse = await client.corehr.v2.employees_job_data.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_job_data.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_job_data.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_job_family_sample.py b/samples/api/corehr/v2/batch_get_job_family_sample.py index 65d766361..995386f6f 100644 --- a/samples/api/corehr/v2/batch_get_job_family_sample.py +++ b/samples/api/corehr/v2/batch_get_job_family_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetJobFamilyRequest = BatchGetJobFamilyRequest.builder() \ - .request_body(BatchGetJobFamilyRequestBody.builder() - .job_family_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetJobFamilyRequest = BatchGetJobFamilyRequest.builder() \ + .request_body(BatchGetJobFamilyRequestBody.builder() + .job_family_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetJobFamilyResponse = client.corehr.v2.job_family.batch_get(request) + # 发起请求 + response: BatchGetJobFamilyResponse = client.corehr.v2.job_family.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_family.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_family.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetJobFamilyRequest = BatchGetJobFamilyRequest.builder() \ - .request_body(BatchGetJobFamilyRequestBody.builder() - .job_family_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetJobFamilyRequest = BatchGetJobFamilyRequest.builder() \ + .request_body(BatchGetJobFamilyRequestBody.builder() + .job_family_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetJobFamilyResponse = await client.corehr.v2.job_family.abatch_get(request) + # 发起请求 + response: BatchGetJobFamilyResponse = await client.corehr.v2.job_family.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_family.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_family.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_job_level_sample.py b/samples/api/corehr/v2/batch_get_job_level_sample.py index d5466c734..f02de5deb 100644 --- a/samples/api/corehr/v2/batch_get_job_level_sample.py +++ b/samples/api/corehr/v2/batch_get_job_level_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetJobLevelRequest = BatchGetJobLevelRequest.builder() \ - .request_body(BatchGetJobLevelRequestBody.builder() - .job_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetJobLevelRequest = BatchGetJobLevelRequest.builder() \ + .request_body(BatchGetJobLevelRequestBody.builder() + .job_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetJobLevelResponse = client.corehr.v2.job_level.batch_get(request) + # 发起请求 + response: BatchGetJobLevelResponse = client.corehr.v2.job_level.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_level.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_level.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetJobLevelRequest = BatchGetJobLevelRequest.builder() \ - .request_body(BatchGetJobLevelRequestBody.builder() - .job_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetJobLevelRequest = BatchGetJobLevelRequest.builder() \ + .request_body(BatchGetJobLevelRequestBody.builder() + .job_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetJobLevelResponse = await client.corehr.v2.job_level.abatch_get(request) + # 发起请求 + response: BatchGetJobLevelResponse = await client.corehr.v2.job_level.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_level.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_level.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/batch_get_location_sample.py b/samples/api/corehr/v2/batch_get_location_sample.py index d7cd67eec..13e5cc383 100644 --- a/samples/api/corehr/v2/batch_get_location_sample.py +++ b/samples/api/corehr/v2/batch_get_location_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetLocationRequest = BatchGetLocationRequest.builder() \ - .request_body(BatchGetLocationRequestBody.builder() - .location_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetLocationRequest = BatchGetLocationRequest.builder() \ + .request_body(BatchGetLocationRequestBody.builder() + .location_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetLocationResponse = client.corehr.v2.location.batch_get(request) + # 发起请求 + response: BatchGetLocationResponse = client.corehr.v2.location.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.location.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.location.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetLocationRequest = BatchGetLocationRequest.builder() \ - .request_body(BatchGetLocationRequestBody.builder() - .location_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetLocationRequest = BatchGetLocationRequest.builder() \ + .request_body(BatchGetLocationRequestBody.builder() + .location_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetLocationResponse = await client.corehr.v2.location.abatch_get(request) + # 发起请求 + response: BatchGetLocationResponse = await client.corehr.v2.location.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.location.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.location.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/complete_pre_hire_sample.py b/samples/api/corehr/v2/complete_pre_hire_sample.py index 5cf4a03bc..c17ab4687 100644 --- a/samples/api/corehr/v2/complete_pre_hire_sample.py +++ b/samples/api/corehr/v2/complete_pre_hire_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CompletePreHireRequest = CompletePreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .build() + # 构造请求对象 + request: CompletePreHireRequest = CompletePreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .build() - # 发起请求 - response: CompletePreHireResponse = client.corehr.v2.pre_hire.complete(request) + # 发起请求 + response: CompletePreHireResponse = client.corehr.v2.pre_hire.complete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.complete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.complete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CompletePreHireRequest = CompletePreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .build() + # 构造请求对象 + request: CompletePreHireRequest = CompletePreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .build() - # 发起请求 - response: CompletePreHireResponse = await client.corehr.v2.pre_hire.acomplete(request) + # 发起请求 + response: CompletePreHireResponse = await client.corehr.v2.pre_hire.acomplete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.acomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.acomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_cost_center_sample.py b/samples/api/corehr/v2/create_cost_center_sample.py index 720b549b0..2bd899b2d 100644 --- a/samples/api/corehr/v2/create_cost_center_sample.py +++ b/samples/api/corehr/v2/create_cost_center_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCostCenterRequest = CreateCostCenterRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(CostCenter.builder() - .name([]) - .code("MDPD00000023") - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: CreateCostCenterRequest = CreateCostCenterRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(CostCenter.builder() + .name([]) + .code("MDPD00000023") + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: CreateCostCenterResponse = client.corehr.v2.cost_center.create(request) + # 发起请求 + response: CreateCostCenterResponse = client.corehr.v2.cost_center.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCostCenterRequest = CreateCostCenterRequest.builder() \ - .user_id_type("people_corehr_id") \ - .request_body(CostCenter.builder() - .name([]) - .code("MDPD00000023") - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: CreateCostCenterRequest = CreateCostCenterRequest.builder() \ + .user_id_type("people_corehr_id") \ + .request_body(CostCenter.builder() + .name([]) + .code("MDPD00000023") + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: CreateCostCenterResponse = await client.corehr.v2.cost_center.acreate(request) + # 发起请求 + response: CreateCostCenterResponse = await client.corehr.v2.cost_center.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_cost_center_version_sample.py b/samples/api/corehr/v2/create_cost_center_version_sample.py index 2dbd7697d..177304e0f 100644 --- a/samples/api/corehr/v2/create_cost_center_version_sample.py +++ b/samples/api/corehr/v2/create_cost_center_version_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCostCenterVersionRequest = CreateCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(CostCenterVersion.builder() - .name([]) - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .operation_reason("过期作废") - .build()) \ - .build() + # 构造请求对象 + request: CreateCostCenterVersionRequest = CreateCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(CostCenterVersion.builder() + .name([]) + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .operation_reason("过期作废") + .build()) \ + .build() - # 发起请求 - response: CreateCostCenterVersionResponse = client.corehr.v2.cost_center_version.create(request) + # 发起请求 + response: CreateCostCenterVersionResponse = client.corehr.v2.cost_center_version.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCostCenterVersionRequest = CreateCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(CostCenterVersion.builder() - .name([]) - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .operation_reason("过期作废") - .build()) \ - .build() + # 构造请求对象 + request: CreateCostCenterVersionRequest = CreateCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(CostCenterVersion.builder() + .name([]) + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .operation_reason("过期作废") + .build()) \ + .build() - # 发起请求 - response: CreateCostCenterVersionResponse = await client.corehr.v2.cost_center_version.acreate(request) + # 发起请求 + response: CreateCostCenterVersionResponse = await client.corehr.v2.cost_center_version.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_employee_sample.py b/samples/api/corehr/v2/create_employee_sample.py index 20f7e4859..d9473f096 100644 --- a/samples/api/corehr/v2/create_employee_sample.py +++ b/samples/api/corehr/v2/create_employee_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeRequest = CreateEmployeeRequest.builder() \ - .client_token("12454646") \ - .rehire(True) \ - .rehire_employment_id("7140964208476371111") \ - .force_submit(False) \ - .ignore_working_hours_type_rule(False) \ - .request_body(CreateEmployeeRequestBody.builder() - .personal_info(ProfileSettingPersonalInfo.builder().build()) - .employment_info(ProfileSettingEmploymentInfo.builder().build()) - .career(ProfileSettingCareer.builder().build()) - .data_attachment(ProfileSettingDataAttachment.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeRequest = CreateEmployeeRequest.builder() \ + .client_token("12454646") \ + .rehire(True) \ + .rehire_employment_id("7140964208476371111") \ + .force_submit(False) \ + .ignore_working_hours_type_rule(False) \ + .request_body(CreateEmployeeRequestBody.builder() + .personal_info(ProfileSettingPersonalInfo.builder().build()) + .employment_info(ProfileSettingEmploymentInfo.builder().build()) + .career(ProfileSettingCareer.builder().build()) + .data_attachment(ProfileSettingDataAttachment.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeResponse = client.corehr.v2.employee.create(request) + # 发起请求 + response: CreateEmployeeResponse = client.corehr.v2.employee.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEmployeeRequest = CreateEmployeeRequest.builder() \ - .client_token("12454646") \ - .rehire(True) \ - .rehire_employment_id("7140964208476371111") \ - .force_submit(False) \ - .ignore_working_hours_type_rule(False) \ - .request_body(CreateEmployeeRequestBody.builder() - .personal_info(ProfileSettingPersonalInfo.builder().build()) - .employment_info(ProfileSettingEmploymentInfo.builder().build()) - .career(ProfileSettingCareer.builder().build()) - .data_attachment(ProfileSettingDataAttachment.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateEmployeeRequest = CreateEmployeeRequest.builder() \ + .client_token("12454646") \ + .rehire(True) \ + .rehire_employment_id("7140964208476371111") \ + .force_submit(False) \ + .ignore_working_hours_type_rule(False) \ + .request_body(CreateEmployeeRequestBody.builder() + .personal_info(ProfileSettingPersonalInfo.builder().build()) + .employment_info(ProfileSettingEmploymentInfo.builder().build()) + .career(ProfileSettingCareer.builder().build()) + .data_attachment(ProfileSettingDataAttachment.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateEmployeeResponse = await client.corehr.v2.employee.acreate(request) + # 发起请求 + response: CreateEmployeeResponse = await client.corehr.v2.employee.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_person_sample.py b/samples/api/corehr/v2/create_person_sample.py index e88e30bfc..50b6c2368 100644 --- a/samples/api/corehr/v2/create_person_sample.py +++ b/samples/api/corehr/v2/create_person_sample.py @@ -5,126 +5,126 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePersonRequest = CreatePersonRequest.builder() \ - .client_token("12454646") \ - .request_body(PersonInfo.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .personal_profile([]) - .native_region("6863326262618752111") - .hukou_type(Enum.builder().build()) - .hukou_location("山东省平阴县") - .political_affiliations([]) - .talent_id("6863326262618752123") - .custom_fields([]) - .born_country_region("中国") - .is_disabled(True) - .disable_card_number("1110000") - .is_martyr_family(True) - .martyr_card_number("1110000") - .is_old_alone(True) - .resident_taxes([]) - .first_entry_time("2021-01-02") - .leave_time("2022-01-02") - .build()) \ - .build() + # 构造请求对象 + request: CreatePersonRequest = CreatePersonRequest.builder() \ + .client_token("12454646") \ + .request_body(PersonInfo.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .personal_profile([]) + .native_region("6863326262618752111") + .hukou_type(Enum.builder().build()) + .hukou_location("山东省平阴县") + .political_affiliations([]) + .talent_id("6863326262618752123") + .custom_fields([]) + .born_country_region("中国") + .is_disabled(True) + .disable_card_number("1110000") + .is_martyr_family(True) + .martyr_card_number("1110000") + .is_old_alone(True) + .resident_taxes([]) + .first_entry_time("2021-01-02") + .leave_time("2022-01-02") + .build()) \ + .build() - # 发起请求 - response: CreatePersonResponse = client.corehr.v2.person.create(request) + # 发起请求 + response: CreatePersonResponse = client.corehr.v2.person.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.person.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.person.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePersonRequest = CreatePersonRequest.builder() \ - .client_token("12454646") \ - .request_body(PersonInfo.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .personal_profile([]) - .native_region("6863326262618752111") - .hukou_type(Enum.builder().build()) - .hukou_location("山东省平阴县") - .political_affiliations([]) - .talent_id("6863326262618752123") - .custom_fields([]) - .born_country_region("中国") - .is_disabled(True) - .disable_card_number("1110000") - .is_martyr_family(True) - .martyr_card_number("1110000") - .is_old_alone(True) - .resident_taxes([]) - .first_entry_time("2021-01-02") - .leave_time("2022-01-02") - .build()) \ - .build() + # 构造请求对象 + request: CreatePersonRequest = CreatePersonRequest.builder() \ + .client_token("12454646") \ + .request_body(PersonInfo.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .personal_profile([]) + .native_region("6863326262618752111") + .hukou_type(Enum.builder().build()) + .hukou_location("山东省平阴县") + .political_affiliations([]) + .talent_id("6863326262618752123") + .custom_fields([]) + .born_country_region("中国") + .is_disabled(True) + .disable_card_number("1110000") + .is_martyr_family(True) + .martyr_card_number("1110000") + .is_old_alone(True) + .resident_taxes([]) + .first_entry_time("2021-01-02") + .leave_time("2022-01-02") + .build()) \ + .build() - # 发起请求 - response: CreatePersonResponse = await client.corehr.v2.person.acreate(request) + # 发起请求 + response: CreatePersonResponse = await client.corehr.v2.person.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.person.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.person.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_pre_hire_sample.py b/samples/api/corehr/v2/create_pre_hire_sample.py index 7964cf36c..39af87881 100644 --- a/samples/api/corehr/v2/create_pre_hire_sample.py +++ b/samples/api/corehr/v2/create_pre_hire_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePreHireRequest = CreatePreHireRequest.builder() \ - .request_body(PrehireCreate.builder() - .basic_info(BasicInfo.builder().build()) - .offer_info(OfferInfo.builder().build()) - .education_info([]) - .work_experience([]) - .ats_application_id("7140946969586010376") - .out_biz_id("7140946969586010376") - .build()) \ - .build() + # 构造请求对象 + request: CreatePreHireRequest = CreatePreHireRequest.builder() \ + .request_body(PrehireCreate.builder() + .basic_info(BasicInfo.builder().build()) + .offer_info(OfferInfo.builder().build()) + .education_info([]) + .work_experience([]) + .ats_application_id("7140946969586010376") + .out_biz_id("7140946969586010376") + .build()) \ + .build() - # 发起请求 - response: CreatePreHireResponse = client.corehr.v2.pre_hire.create(request) + # 发起请求 + response: CreatePreHireResponse = client.corehr.v2.pre_hire.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePreHireRequest = CreatePreHireRequest.builder() \ - .request_body(PrehireCreate.builder() - .basic_info(BasicInfo.builder().build()) - .offer_info(OfferInfo.builder().build()) - .education_info([]) - .work_experience([]) - .ats_application_id("7140946969586010376") - .out_biz_id("7140946969586010376") - .build()) \ - .build() + # 构造请求对象 + request: CreatePreHireRequest = CreatePreHireRequest.builder() \ + .request_body(PrehireCreate.builder() + .basic_info(BasicInfo.builder().build()) + .offer_info(OfferInfo.builder().build()) + .education_info([]) + .work_experience([]) + .ats_application_id("7140946969586010376") + .out_biz_id("7140946969586010376") + .build()) \ + .build() - # 发起请求 - response: CreatePreHireResponse = await client.corehr.v2.pre_hire.acreate(request) + # 发起请求 + response: CreatePreHireResponse = await client.corehr.v2.pre_hire.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/create_probation_assessment_sample.py b/samples/api/corehr/v2/create_probation_assessment_sample.py index 562e7fea7..e5f31f491 100644 --- a/samples/api/corehr/v2/create_probation_assessment_sample.py +++ b/samples/api/corehr/v2/create_probation_assessment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateProbationAssessmentRequest = CreateProbationAssessmentRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(CreateProbationAssessmentRequestBody.builder() - .employment_id("7140964208476371111") - .assessments([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateProbationAssessmentRequest = CreateProbationAssessmentRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(CreateProbationAssessmentRequestBody.builder() + .employment_id("7140964208476371111") + .assessments([]) + .build()) \ + .build() - # 发起请求 - response: CreateProbationAssessmentResponse = client.corehr.v2.probation_assessment.create(request) + # 发起请求 + response: CreateProbationAssessmentResponse = client.corehr.v2.probation_assessment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateProbationAssessmentRequest = CreateProbationAssessmentRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(CreateProbationAssessmentRequestBody.builder() - .employment_id("7140964208476371111") - .assessments([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateProbationAssessmentRequest = CreateProbationAssessmentRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(CreateProbationAssessmentRequestBody.builder() + .employment_id("7140964208476371111") + .assessments([]) + .build()) \ + .build() - # 发起请求 - response: CreateProbationAssessmentResponse = await client.corehr.v2.probation_assessment.acreate(request) + # 发起请求 + response: CreateProbationAssessmentResponse = await client.corehr.v2.probation_assessment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/delete_cost_center_sample.py b/samples/api/corehr/v2/delete_cost_center_sample.py index 2923c247d..2e65afb3a 100644 --- a/samples/api/corehr/v2/delete_cost_center_sample.py +++ b/samples/api/corehr/v2/delete_cost_center_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCostCenterRequest = DeleteCostCenterRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .request_body(DeleteCostCenterRequestBody.builder() - .operation_reason("随着组织架构调整,该成本中心不再使用") - .build()) \ - .build() + # 构造请求对象 + request: DeleteCostCenterRequest = DeleteCostCenterRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .request_body(DeleteCostCenterRequestBody.builder() + .operation_reason("随着组织架构调整,该成本中心不再使用") + .build()) \ + .build() - # 发起请求 - response: DeleteCostCenterResponse = client.corehr.v2.cost_center.delete(request) + # 发起请求 + response: DeleteCostCenterResponse = client.corehr.v2.cost_center.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCostCenterRequest = DeleteCostCenterRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .request_body(DeleteCostCenterRequestBody.builder() - .operation_reason("随着组织架构调整,该成本中心不再使用") - .build()) \ - .build() + # 构造请求对象 + request: DeleteCostCenterRequest = DeleteCostCenterRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .request_body(DeleteCostCenterRequestBody.builder() + .operation_reason("随着组织架构调整,该成本中心不再使用") + .build()) \ + .build() - # 发起请求 - response: DeleteCostCenterResponse = await client.corehr.v2.cost_center.adelete(request) + # 发起请求 + response: DeleteCostCenterResponse = await client.corehr.v2.cost_center.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/delete_cost_center_version_sample.py b/samples/api/corehr/v2/delete_cost_center_version_sample.py index 346dbeb94..e30ff1bf4 100644 --- a/samples/api/corehr/v2/delete_cost_center_version_sample.py +++ b/samples/api/corehr/v2/delete_cost_center_version_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCostCenterVersionRequest = DeleteCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .version_id("6862995757234914824") \ - .request_body(DeleteCostCenterVersionRequestBody.builder() - .operation_reason("随着组织架构调整,该成本中心不再使用") - .build()) \ - .build() + # 构造请求对象 + request: DeleteCostCenterVersionRequest = DeleteCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .version_id("6862995757234914824") \ + .request_body(DeleteCostCenterVersionRequestBody.builder() + .operation_reason("随着组织架构调整,该成本中心不再使用") + .build()) \ + .build() - # 发起请求 - response: DeleteCostCenterVersionResponse = client.corehr.v2.cost_center_version.delete(request) + # 发起请求 + response: DeleteCostCenterVersionResponse = client.corehr.v2.cost_center_version.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCostCenterVersionRequest = DeleteCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .version_id("6862995757234914824") \ - .request_body(DeleteCostCenterVersionRequestBody.builder() - .operation_reason("随着组织架构调整,该成本中心不再使用") - .build()) \ - .build() + # 构造请求对象 + request: DeleteCostCenterVersionRequest = DeleteCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .version_id("6862995757234914824") \ + .request_body(DeleteCostCenterVersionRequestBody.builder() + .operation_reason("随着组织架构调整,该成本中心不再使用") + .build()) \ + .build() - # 发起请求 - response: DeleteCostCenterVersionResponse = await client.corehr.v2.cost_center_version.adelete(request) + # 发起请求 + response: DeleteCostCenterVersionResponse = await client.corehr.v2.cost_center_version.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/delete_pre_hire_sample.py b/samples/api/corehr/v2/delete_pre_hire_sample.py index a07e6b4a6..b50fb6f0a 100644 --- a/samples/api/corehr/v2/delete_pre_hire_sample.py +++ b/samples/api/corehr/v2/delete_pre_hire_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePreHireRequest = DeletePreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .build() + # 构造请求对象 + request: DeletePreHireRequest = DeletePreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .build() - # 发起请求 - response: DeletePreHireResponse = client.corehr.v2.pre_hire.delete(request) + # 发起请求 + response: DeletePreHireResponse = client.corehr.v2.pre_hire.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePreHireRequest = DeletePreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .build() + # 构造请求对象 + request: DeletePreHireRequest = DeletePreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .build() - # 发起请求 - response: DeletePreHireResponse = await client.corehr.v2.pre_hire.adelete(request) + # 发起请求 + response: DeletePreHireResponse = await client.corehr.v2.pre_hire.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/delete_probation_assessment_sample.py b/samples/api/corehr/v2/delete_probation_assessment_sample.py index 9565a2ee4..e485cdb47 100644 --- a/samples/api/corehr/v2/delete_probation_assessment_sample.py +++ b/samples/api/corehr/v2/delete_probation_assessment_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteProbationAssessmentRequest = DeleteProbationAssessmentRequest.builder() \ - .assessment_id("7140964208476371331") \ - .build() + # 构造请求对象 + request: DeleteProbationAssessmentRequest = DeleteProbationAssessmentRequest.builder() \ + .assessment_id("7140964208476371331") \ + .build() - # 发起请求 - response: DeleteProbationAssessmentResponse = client.corehr.v2.probation_assessment.delete(request) + # 发起请求 + response: DeleteProbationAssessmentResponse = client.corehr.v2.probation_assessment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteProbationAssessmentRequest = DeleteProbationAssessmentRequest.builder() \ - .assessment_id("7140964208476371331") \ - .build() + # 构造请求对象 + request: DeleteProbationAssessmentRequest = DeleteProbationAssessmentRequest.builder() \ + .assessment_id("7140964208476371331") \ + .build() - # 发起请求 - response: DeleteProbationAssessmentResponse = await client.corehr.v2.probation_assessment.adelete(request) + # 发起请求 + response: DeleteProbationAssessmentResponse = await client.corehr.v2.probation_assessment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py b/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py index d6f239b40..54cc488e1 100644 --- a/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py +++ b/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py @@ -5,67 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EnableDisableAssessmentProbationRequest = EnableDisableAssessmentProbationRequest.builder() \ - .request_body(EnableDisableAssessmentProbationRequestBody.builder() - .active(True) - .app_url( - "https://qwe111.feishuapp.bytedance.net/ae/ui/apps/176612345027111/appPages/l11bsrwss13yt?dataGrid%41pye4fsbajo21l=%7B%7D&key=ffm41o1&dataGrid%41wmv98t29vif3kj=%1B%7D") - .build()) \ - .build() + # 构造请求对象 + request: EnableDisableAssessmentProbationRequest = EnableDisableAssessmentProbationRequest.builder() \ + .request_body(EnableDisableAssessmentProbationRequestBody.builder() + .active(True) + .app_url("https://qwe111.feishuapp.bytedance.net/ae/ui/apps/176612345027111/appPages/l11bsrwss13yt?dataGrid%41pye4fsbajo21l=%7B%7D&key=ffm41o1&dataGrid%41wmv98t29vif3kj=%1B%7D") + .build()) \ + .build() - # 发起请求 - response: EnableDisableAssessmentProbationResponse = client.corehr.v2.probation.enable_disable_assessment(request) + # 发起请求 + response: EnableDisableAssessmentProbationResponse = client.corehr.v2.probation.enable_disable_assessment(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.enable_disable_assessment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.enable_disable_assessment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EnableDisableAssessmentProbationRequest = EnableDisableAssessmentProbationRequest.builder() \ - .request_body(EnableDisableAssessmentProbationRequestBody.builder() - .active(True) - .app_url( - "https://qwe111.feishuapp.bytedance.net/ae/ui/apps/176612345027111/appPages/l11bsrwss13yt?dataGrid%41pye4fsbajo21l=%7B%7D&key=ffm41o1&dataGrid%41wmv98t29vif3kj=%1B%7D") - .build()) \ - .build() + # 构造请求对象 + request: EnableDisableAssessmentProbationRequest = EnableDisableAssessmentProbationRequest.builder() \ + .request_body(EnableDisableAssessmentProbationRequestBody.builder() + .active(True) + .app_url("https://qwe111.feishuapp.bytedance.net/ae/ui/apps/176612345027111/appPages/l11bsrwss13yt?dataGrid%41pye4fsbajo21l=%7B%7D&key=ffm41o1&dataGrid%41wmv98t29vif3kj=%1B%7D") + .build()) \ + .build() - # 发起请求 - response: EnableDisableAssessmentProbationResponse = await client.corehr.v2.probation.aenable_disable_assessment( - request) + # 发起请求 + response: EnableDisableAssessmentProbationResponse = await client.corehr.v2.probation.aenable_disable_assessment(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.aenable_disable_assessment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.aenable_disable_assessment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/get_by_department_bp_sample.py b/samples/api/corehr/v2/get_by_department_bp_sample.py index cdb16b239..25d43ba90 100644 --- a/samples/api/corehr/v2/get_by_department_bp_sample.py +++ b/samples/api/corehr/v2/get_by_department_bp_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByDepartmentBpRequest = GetByDepartmentBpRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(GetByDepartmentBpRequestBody.builder() - .department_id("6893014062142064111") - .build()) \ - .build() + # 构造请求对象 + request: GetByDepartmentBpRequest = GetByDepartmentBpRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(GetByDepartmentBpRequestBody.builder() + .department_id("6893014062142064111") + .build()) \ + .build() - # 发起请求 - response: GetByDepartmentBpResponse = client.corehr.v2.bp.get_by_department(request) + # 发起请求 + response: GetByDepartmentBpResponse = client.corehr.v2.bp.get_by_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.bp.get_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.bp.get_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByDepartmentBpRequest = GetByDepartmentBpRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(GetByDepartmentBpRequestBody.builder() - .department_id("6893014062142064111") - .build()) \ - .build() + # 构造请求对象 + request: GetByDepartmentBpRequest = GetByDepartmentBpRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(GetByDepartmentBpRequestBody.builder() + .department_id("6893014062142064111") + .build()) \ + .build() - # 发起请求 - response: GetByDepartmentBpResponse = await client.corehr.v2.bp.aget_by_department(request) + # 发起请求 + response: GetByDepartmentBpResponse = await client.corehr.v2.bp.aget_by_department(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.bp.aget_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.bp.aget_by_department failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/get_job_sample.py b/samples/api/corehr/v2/get_job_sample.py index 6636cdbfe..b04e53893 100644 --- a/samples/api/corehr/v2/get_job_sample.py +++ b/samples/api/corehr/v2/get_job_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("151515") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("151515") \ + .build() - # 发起请求 - response: GetJobResponse = client.corehr.v2.job.get(request) + # 发起请求 + response: GetJobResponse = client.corehr.v2.job.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("151515") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("151515") \ + .build() - # 发起请求 - response: GetJobResponse = await client.corehr.v2.job.aget(request) + # 发起请求 + response: GetJobResponse = await client.corehr.v2.job.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/get_process_form_variable_data_sample.py b/samples/api/corehr/v2/get_process_form_variable_data_sample.py index b50ccd94d..447453eb8 100644 --- a/samples/api/corehr/v2/get_process_form_variable_data_sample.py +++ b/samples/api/corehr/v2/get_process_form_variable_data_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ - .process_id("7341373094948242956") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ + .process_id("7341373094948242956") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetProcessFormVariableDataResponse = client.corehr.v2.process_form_variable_data.get(request) + # 发起请求 + response: GetProcessFormVariableDataResponse = client.corehr.v2.process_form_variable_data.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process_form_variable_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process_form_variable_data.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ - .process_id("7341373094948242956") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .build() + # 构造请求对象 + request: GetProcessFormVariableDataRequest = GetProcessFormVariableDataRequest.builder() \ + .process_id("7341373094948242956") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .build() - # 发起请求 - response: GetProcessFormVariableDataResponse = await client.corehr.v2.process_form_variable_data.aget(request) + # 发起请求 + response: GetProcessFormVariableDataResponse = await client.corehr.v2.process_form_variable_data.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process_form_variable_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process_form_variable_data.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/get_process_sample.py b/samples/api/corehr/v2/get_process_sample.py index 4decddbd9..24b8f2f75 100644 --- a/samples/api/corehr/v2/get_process_sample.py +++ b/samples/api/corehr/v2/get_process_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessRequest = GetProcessRequest.builder() \ - .process_id("7278949005675988535") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetProcessRequest = GetProcessRequest.builder() \ + .process_id("7278949005675988535") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetProcessResponse = client.corehr.v2.process.get(request) + # 发起请求 + response: GetProcessResponse = client.corehr.v2.process.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProcessRequest = GetProcessRequest.builder() \ - .process_id("7278949005675988535") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetProcessRequest = GetProcessRequest.builder() \ + .process_id("7278949005675988535") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetProcessResponse = await client.corehr.v2.process.aget(request) + # 发起请求 + response: GetProcessResponse = await client.corehr.v2.process.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/list_bp_sample.py b/samples/api/corehr/v2/list_bp_sample.py index e7e5b3972..ea07712b9 100644 --- a/samples/api/corehr/v2/list_bp_sample.py +++ b/samples/api/corehr/v2/list_bp_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBpRequest = ListBpRequest.builder() \ - .page_size(500) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: ListBpRequest = ListBpRequest.builder() \ + .page_size(500) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: ListBpResponse = client.corehr.v2.bp.list(request) + # 发起请求 + response: ListBpResponse = client.corehr.v2.bp.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.bp.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.bp.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBpRequest = ListBpRequest.builder() \ - .page_size(500) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: ListBpRequest = ListBpRequest.builder() \ + .page_size(500) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: ListBpResponse = await client.corehr.v2.bp.alist(request) + # 发起请求 + response: ListBpResponse = await client.corehr.v2.bp.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.bp.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.bp.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/list_job_sample.py b/samples/api/corehr/v2/list_job_sample.py index 20370253e..873fe4a92 100644 --- a/samples/api/corehr/v2/list_job_sample.py +++ b/samples/api/corehr/v2/list_job_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .name("keyword") \ - .query_language("zh") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .name("keyword") \ + .query_language("zh") \ + .build() - # 发起请求 - response: ListJobResponse = client.corehr.v2.job.list(request) + # 发起请求 + response: ListJobResponse = client.corehr.v2.job.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .page_token("1231231987") \ - .page_size("100") \ - .name("keyword") \ - .query_language("zh") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .page_token("1231231987") \ + .page_size("100") \ + .name("keyword") \ + .query_language("zh") \ + .build() - # 发起请求 - response: ListJobResponse = await client.corehr.v2.job.alist(request) + # 发起请求 + response: ListJobResponse = await client.corehr.v2.job.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/list_process_sample.py b/samples/api/corehr/v2/list_process_sample.py index 5d7ab8edb..df800f90b 100644 --- a/samples/api/corehr/v2/list_process_sample.py +++ b/samples/api/corehr/v2/list_process_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListProcessRequest = ListProcessRequest.builder() \ - .modify_time_to("1547654251506") \ - .statuses([]) \ - .page_token("7278949005675988535") \ - .page_size(100) \ - .modify_time_from("1547654251506") \ - .flow_definition_id("people_6961286846093788680_7081951411982077732") \ - .build() + # 构造请求对象 + request: ListProcessRequest = ListProcessRequest.builder() \ + .modify_time_to("1547654251506") \ + .statuses([]) \ + .page_token("7278949005675988535") \ + .page_size(100) \ + .modify_time_from("1547654251506") \ + .flow_definition_id("people_6961286846093788680_7081951411982077732") \ + .build() - # 发起请求 - response: ListProcessResponse = client.corehr.v2.process.list(request) + # 发起请求 + response: ListProcessResponse = client.corehr.v2.process.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListProcessRequest = ListProcessRequest.builder() \ - .modify_time_to("1547654251506") \ - .statuses([]) \ - .page_token("7278949005675988535") \ - .page_size(100) \ - .modify_time_from("1547654251506") \ - .flow_definition_id("people_6961286846093788680_7081951411982077732") \ - .build() + # 构造请求对象 + request: ListProcessRequest = ListProcessRequest.builder() \ + .modify_time_to("1547654251506") \ + .statuses([]) \ + .page_token("7278949005675988535") \ + .page_size(100) \ + .modify_time_from("1547654251506") \ + .flow_definition_id("people_6961286846093788680_7081951411982077732") \ + .build() - # 发起请求 - response: ListProcessResponse = await client.corehr.v2.process.alist(request) + # 发起请求 + response: ListProcessResponse = await client.corehr.v2.process.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/parents_department_sample.py b/samples/api/corehr/v2/parents_department_sample.py index 4336c7f9c..0ccd96c40 100644 --- a/samples/api/corehr/v2/parents_department_sample.py +++ b/samples/api/corehr/v2/parents_department_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParentsDepartmentRequest = ParentsDepartmentRequest.builder() \ - .department_id_type("open_department_id") \ - .request_body(ParentsDepartmentRequestBody.builder() - .department_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: ParentsDepartmentRequest = ParentsDepartmentRequest.builder() \ + .department_id_type("open_department_id") \ + .request_body(ParentsDepartmentRequestBody.builder() + .department_id_list([]) + .build()) \ + .build() - # 发起请求 - response: ParentsDepartmentResponse = client.corehr.v2.department.parents(request) + # 发起请求 + response: ParentsDepartmentResponse = client.corehr.v2.department.parents(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.parents failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.parents failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParentsDepartmentRequest = ParentsDepartmentRequest.builder() \ - .department_id_type("open_department_id") \ - .request_body(ParentsDepartmentRequestBody.builder() - .department_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: ParentsDepartmentRequest = ParentsDepartmentRequest.builder() \ + .department_id_type("open_department_id") \ + .request_body(ParentsDepartmentRequestBody.builder() + .department_id_list([]) + .build()) \ + .build() - # 发起请求 - response: ParentsDepartmentResponse = await client.corehr.v2.department.aparents(request) + # 发起请求 + response: ParentsDepartmentResponse = await client.corehr.v2.department.aparents(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.aparents failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.aparents failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/patch_cost_center_sample.py b/samples/api/corehr/v2/patch_cost_center_sample.py index fd09ea30e..fbdaee956 100644 --- a/samples/api/corehr/v2/patch_cost_center_sample.py +++ b/samples/api/corehr/v2/patch_cost_center_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCostCenterRequest = PatchCostCenterRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(PatchCostCenterRequestBody.builder() - .effective_time("2020-01-01") - .active(True) - .operation_reason("强行操作") - .build()) \ - .build() + # 构造请求对象 + request: PatchCostCenterRequest = PatchCostCenterRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(PatchCostCenterRequestBody.builder() + .effective_time("2020-01-01") + .active(True) + .operation_reason("强行操作") + .build()) \ + .build() - # 发起请求 - response: PatchCostCenterResponse = client.corehr.v2.cost_center.patch(request) + # 发起请求 + response: PatchCostCenterResponse = client.corehr.v2.cost_center.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCostCenterRequest = PatchCostCenterRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(PatchCostCenterRequestBody.builder() - .effective_time("2020-01-01") - .active(True) - .operation_reason("强行操作") - .build()) \ - .build() + # 构造请求对象 + request: PatchCostCenterRequest = PatchCostCenterRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(PatchCostCenterRequestBody.builder() + .effective_time("2020-01-01") + .active(True) + .operation_reason("强行操作") + .build()) \ + .build() - # 发起请求 - response: PatchCostCenterResponse = await client.corehr.v2.cost_center.apatch(request) + # 发起请求 + response: PatchCostCenterResponse = await client.corehr.v2.cost_center.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/patch_cost_center_version_sample.py b/samples/api/corehr/v2/patch_cost_center_version_sample.py index 9853d8813..b10e56807 100644 --- a/samples/api/corehr/v2/patch_cost_center_version_sample.py +++ b/samples/api/corehr/v2/patch_cost_center_version_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCostCenterVersionRequest = PatchCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .version_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(PatchCostCenterVersionRequestBody.builder() - .name([]) - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .operation_reason("强行操作") - .build()) \ - .build() + # 构造请求对象 + request: PatchCostCenterVersionRequest = PatchCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .version_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(PatchCostCenterVersionRequestBody.builder() + .name([]) + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .operation_reason("强行操作") + .build()) \ + .build() - # 发起请求 - response: PatchCostCenterVersionResponse = client.corehr.v2.cost_center_version.patch(request) + # 发起请求 + response: PatchCostCenterVersionResponse = client.corehr.v2.cost_center_version.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCostCenterVersionRequest = PatchCostCenterVersionRequest.builder() \ - .cost_center_id("6862995757234914824") \ - .version_id("6862995757234914824") \ - .user_id_type("people_corehr_id") \ - .request_body(PatchCostCenterVersionRequestBody.builder() - .name([]) - .parent_cost_center_id("6862995757234914824") - .managers([]) - .description([]) - .effective_time("2020-01-01") - .operation_reason("强行操作") - .build()) \ - .build() + # 构造请求对象 + request: PatchCostCenterVersionRequest = PatchCostCenterVersionRequest.builder() \ + .cost_center_id("6862995757234914824") \ + .version_id("6862995757234914824") \ + .user_id_type("people_corehr_id") \ + .request_body(PatchCostCenterVersionRequestBody.builder() + .name([]) + .parent_cost_center_id("6862995757234914824") + .managers([]) + .description([]) + .effective_time("2020-01-01") + .operation_reason("强行操作") + .build()) \ + .build() - # 发起请求 - response: PatchCostCenterVersionResponse = await client.corehr.v2.cost_center_version.apatch(request) + # 发起请求 + response: PatchCostCenterVersionResponse = await client.corehr.v2.cost_center_version.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center_version.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center_version.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/patch_person_sample.py b/samples/api/corehr/v2/patch_person_sample.py index 17a00d38e..833b9c596 100644 --- a/samples/api/corehr/v2/patch_person_sample.py +++ b/samples/api/corehr/v2/patch_person_sample.py @@ -5,130 +5,130 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPersonRequest = PatchPersonRequest.builder() \ - .person_id("12454646") \ - .client_token("12454646") \ - .no_need_query(False) \ - .request_body(PersonInfo.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .personal_profile([]) - .native_region("6863326262618752111") - .hukou_type(Enum.builder().build()) - .hukou_location("山东省平阴县") - .political_affiliations([]) - .talent_id("6863326262618752123") - .custom_fields([]) - .born_country_region("中国") - .is_disabled(True) - .disable_card_number("1110000") - .is_martyr_family(True) - .martyr_card_number("1110000") - .is_old_alone(True) - .resident_taxes([]) - .first_entry_time("2021-01-02") - .leave_time("2022-01-02") - .build()) \ - .build() + # 构造请求对象 + request: PatchPersonRequest = PatchPersonRequest.builder() \ + .person_id("12454646") \ + .client_token("12454646") \ + .no_need_query(False) \ + .request_body(PersonInfo.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .personal_profile([]) + .native_region("6863326262618752111") + .hukou_type(Enum.builder().build()) + .hukou_location("山东省平阴县") + .political_affiliations([]) + .talent_id("6863326262618752123") + .custom_fields([]) + .born_country_region("中国") + .is_disabled(True) + .disable_card_number("1110000") + .is_martyr_family(True) + .martyr_card_number("1110000") + .is_old_alone(True) + .resident_taxes([]) + .first_entry_time("2021-01-02") + .leave_time("2022-01-02") + .build()) \ + .build() - # 发起请求 - response: PatchPersonResponse = client.corehr.v2.person.patch(request) + # 发起请求 + response: PatchPersonResponse = client.corehr.v2.person.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.person.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.person.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPersonRequest = PatchPersonRequest.builder() \ - .person_id("12454646") \ - .client_token("12454646") \ - .no_need_query(False) \ - .request_body(PersonInfo.builder() - .name_list([]) - .gender(Enum.builder().build()) - .date_of_birth("2020-01-01") - .race(Enum.builder().build()) - .marital_status(Enum.builder().build()) - .phone_list([]) - .address_list([]) - .email_list([]) - .work_experience_list([]) - .education_list([]) - .bank_account_list([]) - .national_id_list([]) - .dependent_list([]) - .emergency_contact_list([]) - .date_entered_workforce("2020-10-01") - .profile_image_id("dfysuc8x76dsfsw") - .personal_profile([]) - .native_region("6863326262618752111") - .hukou_type(Enum.builder().build()) - .hukou_location("山东省平阴县") - .political_affiliations([]) - .talent_id("6863326262618752123") - .custom_fields([]) - .born_country_region("中国") - .is_disabled(True) - .disable_card_number("1110000") - .is_martyr_family(True) - .martyr_card_number("1110000") - .is_old_alone(True) - .resident_taxes([]) - .first_entry_time("2021-01-02") - .leave_time("2022-01-02") - .build()) \ - .build() + # 构造请求对象 + request: PatchPersonRequest = PatchPersonRequest.builder() \ + .person_id("12454646") \ + .client_token("12454646") \ + .no_need_query(False) \ + .request_body(PersonInfo.builder() + .name_list([]) + .gender(Enum.builder().build()) + .date_of_birth("2020-01-01") + .race(Enum.builder().build()) + .marital_status(Enum.builder().build()) + .phone_list([]) + .address_list([]) + .email_list([]) + .work_experience_list([]) + .education_list([]) + .bank_account_list([]) + .national_id_list([]) + .dependent_list([]) + .emergency_contact_list([]) + .date_entered_workforce("2020-10-01") + .profile_image_id("dfysuc8x76dsfsw") + .personal_profile([]) + .native_region("6863326262618752111") + .hukou_type(Enum.builder().build()) + .hukou_location("山东省平阴县") + .political_affiliations([]) + .talent_id("6863326262618752123") + .custom_fields([]) + .born_country_region("中国") + .is_disabled(True) + .disable_card_number("1110000") + .is_martyr_family(True) + .martyr_card_number("1110000") + .is_old_alone(True) + .resident_taxes([]) + .first_entry_time("2021-01-02") + .leave_time("2022-01-02") + .build()) \ + .build() - # 发起请求 - response: PatchPersonResponse = await client.corehr.v2.person.apatch(request) + # 发起请求 + response: PatchPersonResponse = await client.corehr.v2.person.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.person.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.person.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/patch_pre_hire_sample.py b/samples/api/corehr/v2/patch_pre_hire_sample.py index 80a388826..303554be7 100644 --- a/samples/api/corehr/v2/patch_pre_hire_sample.py +++ b/samples/api/corehr/v2/patch_pre_hire_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPreHireRequest = PatchPreHireRequest.builder() \ - .pre_hire_id("7345005664477775411") \ - .request_body(PrehireUpdate.builder() - .basic_info_update(BasicInfoUpdate.builder().build()) - .offer_info_update(OfferInfoUpdate.builder().build()) - .standard_update_fields([]) - .custom_update_fields([]) - .person_custom_update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchPreHireRequest = PatchPreHireRequest.builder() \ + .pre_hire_id("7345005664477775411") \ + .request_body(PrehireUpdate.builder() + .basic_info_update(BasicInfoUpdate.builder().build()) + .offer_info_update(OfferInfoUpdate.builder().build()) + .standard_update_fields([]) + .custom_update_fields([]) + .person_custom_update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchPreHireResponse = client.corehr.v2.pre_hire.patch(request) + # 发起请求 + response: PatchPreHireResponse = client.corehr.v2.pre_hire.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPreHireRequest = PatchPreHireRequest.builder() \ - .pre_hire_id("7345005664477775411") \ - .request_body(PrehireUpdate.builder() - .basic_info_update(BasicInfoUpdate.builder().build()) - .offer_info_update(OfferInfoUpdate.builder().build()) - .standard_update_fields([]) - .custom_update_fields([]) - .person_custom_update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchPreHireRequest = PatchPreHireRequest.builder() \ + .pre_hire_id("7345005664477775411") \ + .request_body(PrehireUpdate.builder() + .basic_info_update(BasicInfoUpdate.builder().build()) + .offer_info_update(OfferInfoUpdate.builder().build()) + .standard_update_fields([]) + .custom_update_fields([]) + .person_custom_update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchPreHireResponse = await client.corehr.v2.pre_hire.apatch(request) + # 发起请求 + response: PatchPreHireResponse = await client.corehr.v2.pre_hire.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/patch_probation_assessment_sample.py b/samples/api/corehr/v2/patch_probation_assessment_sample.py index 04746bf98..03a5ad7ad 100644 --- a/samples/api/corehr/v2/patch_probation_assessment_sample.py +++ b/samples/api/corehr/v2/patch_probation_assessment_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchProbationAssessmentRequest = PatchProbationAssessmentRequest.builder() \ - .assessment_id("7140964208476371331") \ - .client_token("6822122262122064111") \ - .request_body(AssessmentForCreate.builder() - .assessment_status("completed") - .assessment_result("approved") - .assessment_score(99.9) - .assessment_grade("grade_a") - .assessment_comment("超出预期") - .assessment_detail("暂无示例") - .is_final_asssessment(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchProbationAssessmentRequest = PatchProbationAssessmentRequest.builder() \ + .assessment_id("7140964208476371331") \ + .client_token("6822122262122064111") \ + .request_body(AssessmentForCreate.builder() + .assessment_status("completed") + .assessment_result("approved") + .assessment_score(99.9) + .assessment_grade("grade_a") + .assessment_comment("超出预期") + .assessment_detail("暂无示例") + .is_final_asssessment(False) + .build()) \ + .build() - # 发起请求 - response: PatchProbationAssessmentResponse = client.corehr.v2.probation_assessment.patch(request) + # 发起请求 + response: PatchProbationAssessmentResponse = client.corehr.v2.probation_assessment.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchProbationAssessmentRequest = PatchProbationAssessmentRequest.builder() \ - .assessment_id("7140964208476371331") \ - .client_token("6822122262122064111") \ - .request_body(AssessmentForCreate.builder() - .assessment_status("completed") - .assessment_result("approved") - .assessment_score(99.9) - .assessment_grade("grade_a") - .assessment_comment("超出预期") - .assessment_detail("暂无示例") - .is_final_asssessment(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchProbationAssessmentRequest = PatchProbationAssessmentRequest.builder() \ + .assessment_id("7140964208476371331") \ + .client_token("6822122262122064111") \ + .request_body(AssessmentForCreate.builder() + .assessment_status("completed") + .assessment_result("approved") + .assessment_score(99.9) + .assessment_grade("grade_a") + .assessment_comment("超出预期") + .assessment_detail("暂无示例") + .is_final_asssessment(False) + .build()) \ + .build() - # 发起请求 - response: PatchProbationAssessmentResponse = await client.corehr.v2.probation_assessment.apatch(request) + # 发起请求 + response: PatchProbationAssessmentResponse = await client.corehr.v2.probation_assessment.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation_assessment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation_assessment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/query_employees_job_data_sample.py b/samples/api/corehr/v2/query_employees_job_data_sample.py index 4b5e35a7c..e697a6968 100644 --- a/samples/api/corehr/v2/query_employees_job_data_sample.py +++ b/samples/api/corehr/v2/query_employees_job_data_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryEmployeesJobDataRequest = QueryEmployeesJobDataRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryEmployeesJobDataRequestBody.builder() - .get_all_version(False) - .data_date("2020-01-01") - .effective_date_start("2020-01-01") - .effective_date_end("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: QueryEmployeesJobDataRequest = QueryEmployeesJobDataRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryEmployeesJobDataRequestBody.builder() + .get_all_version(False) + .data_date("2020-01-01") + .effective_date_start("2020-01-01") + .effective_date_end("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: QueryEmployeesJobDataResponse = client.corehr.v2.employees_job_data.query(request) + # 发起请求 + response: QueryEmployeesJobDataResponse = client.corehr.v2.employees_job_data.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_job_data.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_job_data.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryEmployeesJobDataRequest = QueryEmployeesJobDataRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryEmployeesJobDataRequestBody.builder() - .get_all_version(False) - .data_date("2020-01-01") - .effective_date_start("2020-01-01") - .effective_date_end("2020-01-01") - .build()) \ - .build() + # 构造请求对象 + request: QueryEmployeesJobDataRequest = QueryEmployeesJobDataRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryEmployeesJobDataRequestBody.builder() + .get_all_version(False) + .data_date("2020-01-01") + .effective_date_start("2020-01-01") + .effective_date_end("2020-01-01") + .build()) \ + .build() - # 发起请求 - response: QueryEmployeesJobDataResponse = await client.corehr.v2.employees_job_data.aquery(request) + # 发起请求 + response: QueryEmployeesJobDataResponse = await client.corehr.v2.employees_job_data.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employees_job_data.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employees_job_data.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/query_job_grade_sample.py b/samples/api/corehr/v2/query_job_grade_sample.py index 25d21ac8f..6aeb01159 100644 --- a/samples/api/corehr/v2/query_job_grade_sample.py +++ b/samples/api/corehr/v2/query_job_grade_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryJobGradeRequest = QueryJobGradeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(QueryJobGradeRequestBody.builder() - .ids([]) - .codes([]) - .active(True) - .build()) \ - .build() + # 构造请求对象 + request: QueryJobGradeRequest = QueryJobGradeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(QueryJobGradeRequestBody.builder() + .ids([]) + .codes([]) + .active(True) + .build()) \ + .build() - # 发起请求 - response: QueryJobGradeResponse = client.corehr.v2.job_grade.query(request) + # 发起请求 + response: QueryJobGradeResponse = client.corehr.v2.job_grade.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_grade.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_grade.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryJobGradeRequest = QueryJobGradeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(QueryJobGradeRequestBody.builder() - .ids([]) - .codes([]) - .active(True) - .build()) \ - .build() + # 构造请求对象 + request: QueryJobGradeRequest = QueryJobGradeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(QueryJobGradeRequestBody.builder() + .ids([]) + .codes([]) + .active(True) + .build()) \ + .build() - # 发起请求 - response: QueryJobGradeResponse = await client.corehr.v2.job_grade.aquery(request) + # 发起请求 + response: QueryJobGradeResponse = await client.corehr.v2.job_grade.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_grade.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_grade.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/query_multi_timeline_department_sample.py b/samples/api/corehr/v2/query_multi_timeline_department_sample.py index 6d3f4d59e..dc5a3a147 100644 --- a/samples/api/corehr/v2/query_multi_timeline_department_sample.py +++ b/samples/api/corehr/v2/query_multi_timeline_department_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryMultiTimelineDepartmentRequest = QueryMultiTimelineDepartmentRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryMultiTimelineDepartmentRequestBody.builder() - .department_ids([]) - .effective_date_start("2024-01-01") - .effective_date_end("2024-12-31") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryMultiTimelineDepartmentRequest = QueryMultiTimelineDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryMultiTimelineDepartmentRequestBody.builder() + .department_ids([]) + .effective_date_start("2024-01-01") + .effective_date_end("2024-12-31") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryMultiTimelineDepartmentResponse = client.corehr.v2.department.query_multi_timeline(request) + # 发起请求 + response: QueryMultiTimelineDepartmentResponse = client.corehr.v2.department.query_multi_timeline(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.query_multi_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.query_multi_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryMultiTimelineDepartmentRequest = QueryMultiTimelineDepartmentRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryMultiTimelineDepartmentRequestBody.builder() - .department_ids([]) - .effective_date_start("2024-01-01") - .effective_date_end("2024-12-31") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryMultiTimelineDepartmentRequest = QueryMultiTimelineDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryMultiTimelineDepartmentRequestBody.builder() + .department_ids([]) + .effective_date_start("2024-01-01") + .effective_date_end("2024-12-31") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryMultiTimelineDepartmentResponse = await client.corehr.v2.department.aquery_multi_timeline(request) + # 发起请求 + response: QueryMultiTimelineDepartmentResponse = await client.corehr.v2.department.aquery_multi_timeline(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.aquery_multi_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.aquery_multi_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/query_pre_hire_sample.py b/samples/api/corehr/v2/query_pre_hire_sample.py index 8785bbd4c..441658f9d 100644 --- a/samples/api/corehr/v2/query_pre_hire_sample.py +++ b/samples/api/corehr/v2/query_pre_hire_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryPreHireRequest = QueryPreHireRequest.builder() \ - .page_size(10) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(QueryPreHireRequestBody.builder() - .pre_hire_ids([]) - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryPreHireRequest = QueryPreHireRequest.builder() \ + .page_size(10) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(QueryPreHireRequestBody.builder() + .pre_hire_ids([]) + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryPreHireResponse = client.corehr.v2.pre_hire.query(request) + # 发起请求 + response: QueryPreHireResponse = client.corehr.v2.pre_hire.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryPreHireRequest = QueryPreHireRequest.builder() \ - .page_size(10) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(QueryPreHireRequestBody.builder() - .pre_hire_ids([]) - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryPreHireRequest = QueryPreHireRequest.builder() \ + .page_size(10) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(QueryPreHireRequestBody.builder() + .pre_hire_ids([]) + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryPreHireResponse = await client.corehr.v2.pre_hire.aquery(request) + # 发起请求 + response: QueryPreHireResponse = await client.corehr.v2.pre_hire.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/query_timeline_department_sample.py b/samples/api/corehr/v2/query_timeline_department_sample.py index dcc2490f6..8b6440a8f 100644 --- a/samples/api/corehr/v2/query_timeline_department_sample.py +++ b/samples/api/corehr/v2/query_timeline_department_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTimelineDepartmentRequest = QueryTimelineDepartmentRequest.builder() \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryTimelineDepartmentRequestBody.builder() - .department_ids([]) - .effective_date("2020-01-01") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryTimelineDepartmentRequest = QueryTimelineDepartmentRequest.builder() \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryTimelineDepartmentRequestBody.builder() + .department_ids([]) + .effective_date("2020-01-01") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryTimelineDepartmentResponse = client.corehr.v2.department.query_timeline(request) + # 发起请求 + response: QueryTimelineDepartmentResponse = client.corehr.v2.department.query_timeline(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.query_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.query_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTimelineDepartmentRequest = QueryTimelineDepartmentRequest.builder() \ - .user_id_type("people_corehr_id") \ - .department_id_type("people_corehr_department_id") \ - .request_body(QueryTimelineDepartmentRequestBody.builder() - .department_ids([]) - .effective_date("2020-01-01") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryTimelineDepartmentRequest = QueryTimelineDepartmentRequest.builder() \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(QueryTimelineDepartmentRequestBody.builder() + .department_ids([]) + .effective_date("2020-01-01") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: QueryTimelineDepartmentResponse = await client.corehr.v2.department.aquery_timeline(request) + # 发起请求 + response: QueryTimelineDepartmentResponse = await client.corehr.v2.department.aquery_timeline(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.aquery_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.aquery_timeline failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_bank_branch_sample.py b/samples/api/corehr/v2/search_basic_info_bank_branch_sample.py index b02d73815..8461ae435 100644 --- a/samples/api/corehr/v2/search_basic_info_bank_branch_sample.py +++ b/samples/api/corehr/v2/search_basic_info_bank_branch_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoBankBranchRequest = SearchBasicInfoBankBranchRequest.builder() \ - .page_size(100) \ - .page_token("MDBK00000120") \ - .request_body(SearchBasicInfoBankBranchRequestBody.builder() - .bank_id_list([]) - .bank_branch_id_list([]) - .bank_branch_name_list([]) - .status_list([]) - .update_start_time("2020-01-01 00:00:00") - .update_end_time("2024-01-01 00:00:00") - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoBankBranchRequest = SearchBasicInfoBankBranchRequest.builder() \ + .page_size(100) \ + .page_token("MDBK00000120") \ + .request_body(SearchBasicInfoBankBranchRequestBody.builder() + .bank_id_list([]) + .bank_branch_id_list([]) + .bank_branch_name_list([]) + .status_list([]) + .update_start_time("2020-01-01 00:00:00") + .update_end_time("2024-01-01 00:00:00") + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoBankBranchResponse = client.corehr.v2.basic_info_bank_branch.search(request) + # 发起请求 + response: SearchBasicInfoBankBranchResponse = client.corehr.v2.basic_info_bank_branch.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_bank_branch.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_bank_branch.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoBankBranchRequest = SearchBasicInfoBankBranchRequest.builder() \ - .page_size(100) \ - .page_token("MDBK00000120") \ - .request_body(SearchBasicInfoBankBranchRequestBody.builder() - .bank_id_list([]) - .bank_branch_id_list([]) - .bank_branch_name_list([]) - .status_list([]) - .update_start_time("2020-01-01 00:00:00") - .update_end_time("2024-01-01 00:00:00") - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoBankBranchRequest = SearchBasicInfoBankBranchRequest.builder() \ + .page_size(100) \ + .page_token("MDBK00000120") \ + .request_body(SearchBasicInfoBankBranchRequestBody.builder() + .bank_id_list([]) + .bank_branch_id_list([]) + .bank_branch_name_list([]) + .status_list([]) + .update_start_time("2020-01-01 00:00:00") + .update_end_time("2024-01-01 00:00:00") + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoBankBranchResponse = await client.corehr.v2.basic_info_bank_branch.asearch(request) + # 发起请求 + response: SearchBasicInfoBankBranchResponse = await client.corehr.v2.basic_info_bank_branch.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_bank_branch.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_bank_branch.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_bank_sample.py b/samples/api/corehr/v2/search_basic_info_bank_sample.py index 52d9a1dc6..ad57ff9f3 100644 --- a/samples/api/corehr/v2/search_basic_info_bank_sample.py +++ b/samples/api/corehr/v2/search_basic_info_bank_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoBankRequest = SearchBasicInfoBankRequest.builder() \ - .page_size(100) \ - .page_token("MDBH00000100") \ - .request_body(SearchBasicInfoBankRequestBody.builder() - .bank_id_list([]) - .bank_name_list([]) - .status_list([]) - .update_start_time("2020-01-01 00:00:00") - .update_end_time("2024-01-01 00:00:00") - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoBankRequest = SearchBasicInfoBankRequest.builder() \ + .page_size(100) \ + .page_token("MDBH00000100") \ + .request_body(SearchBasicInfoBankRequestBody.builder() + .bank_id_list([]) + .bank_name_list([]) + .status_list([]) + .update_start_time("2020-01-01 00:00:00") + .update_end_time("2024-01-01 00:00:00") + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoBankResponse = client.corehr.v2.basic_info_bank.search(request) + # 发起请求 + response: SearchBasicInfoBankResponse = client.corehr.v2.basic_info_bank.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_bank.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_bank.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoBankRequest = SearchBasicInfoBankRequest.builder() \ - .page_size(100) \ - .page_token("MDBH00000100") \ - .request_body(SearchBasicInfoBankRequestBody.builder() - .bank_id_list([]) - .bank_name_list([]) - .status_list([]) - .update_start_time("2020-01-01 00:00:00") - .update_end_time("2024-01-01 00:00:00") - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoBankRequest = SearchBasicInfoBankRequest.builder() \ + .page_size(100) \ + .page_token("MDBH00000100") \ + .request_body(SearchBasicInfoBankRequestBody.builder() + .bank_id_list([]) + .bank_name_list([]) + .status_list([]) + .update_start_time("2020-01-01 00:00:00") + .update_end_time("2024-01-01 00:00:00") + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoBankResponse = await client.corehr.v2.basic_info_bank.asearch(request) + # 发起请求 + response: SearchBasicInfoBankResponse = await client.corehr.v2.basic_info_bank.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_bank.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_bank.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_city_sample.py b/samples/api/corehr/v2/search_basic_info_city_sample.py index 8c7d4f81d..3194cadd7 100644 --- a/samples/api/corehr/v2/search_basic_info_city_sample.py +++ b/samples/api/corehr/v2/search_basic_info_city_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCityRequest = SearchBasicInfoCityRequest.builder() \ - .page_size(100) \ - .page_token("7316867189967963685") \ - .request_body(SearchBasicInfoCityRequestBody.builder() - .country_region_subdivision_id_list([]) - .city_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCityRequest = SearchBasicInfoCityRequest.builder() \ + .page_size(100) \ + .page_token("7316867189967963685") \ + .request_body(SearchBasicInfoCityRequestBody.builder() + .country_region_subdivision_id_list([]) + .city_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCityResponse = client.corehr.v2.basic_info_city.search(request) + # 发起请求 + response: SearchBasicInfoCityResponse = client.corehr.v2.basic_info_city.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_city.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_city.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCityRequest = SearchBasicInfoCityRequest.builder() \ - .page_size(100) \ - .page_token("7316867189967963685") \ - .request_body(SearchBasicInfoCityRequestBody.builder() - .country_region_subdivision_id_list([]) - .city_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCityRequest = SearchBasicInfoCityRequest.builder() \ + .page_size(100) \ + .page_token("7316867189967963685") \ + .request_body(SearchBasicInfoCityRequestBody.builder() + .country_region_subdivision_id_list([]) + .city_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCityResponse = await client.corehr.v2.basic_info_city.asearch(request) + # 发起请求 + response: SearchBasicInfoCityResponse = await client.corehr.v2.basic_info_city.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_city.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_city.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_country_region_sample.py b/samples/api/corehr/v2/search_basic_info_country_region_sample.py index c19ee7bb7..e435f6c61 100644 --- a/samples/api/corehr/v2/search_basic_info_country_region_sample.py +++ b/samples/api/corehr/v2/search_basic_info_country_region_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCountryRegionRequest = SearchBasicInfoCountryRegionRequest.builder() \ - .page_size(100) \ - .page_token("6862995772275688974") \ - .request_body(SearchBasicInfoCountryRegionRequestBody.builder() - .country_region_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCountryRegionRequest = SearchBasicInfoCountryRegionRequest.builder() \ + .page_size(100) \ + .page_token("6862995772275688974") \ + .request_body(SearchBasicInfoCountryRegionRequestBody.builder() + .country_region_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCountryRegionResponse = client.corehr.v2.basic_info_country_region.search(request) + # 发起请求 + response: SearchBasicInfoCountryRegionResponse = client.corehr.v2.basic_info_country_region.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_country_region.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_country_region.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCountryRegionRequest = SearchBasicInfoCountryRegionRequest.builder() \ - .page_size(100) \ - .page_token("6862995772275688974") \ - .request_body(SearchBasicInfoCountryRegionRequestBody.builder() - .country_region_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCountryRegionRequest = SearchBasicInfoCountryRegionRequest.builder() \ + .page_size(100) \ + .page_token("6862995772275688974") \ + .request_body(SearchBasicInfoCountryRegionRequestBody.builder() + .country_region_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCountryRegionResponse = await client.corehr.v2.basic_info_country_region.asearch(request) + # 发起请求 + response: SearchBasicInfoCountryRegionResponse = await client.corehr.v2.basic_info_country_region.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_country_region.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_country_region.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_country_region_subdivision_sample.py b/samples/api/corehr/v2/search_basic_info_country_region_subdivision_sample.py index 668b6e283..776974f7d 100644 --- a/samples/api/corehr/v2/search_basic_info_country_region_subdivision_sample.py +++ b/samples/api/corehr/v2/search_basic_info_country_region_subdivision_sample.py @@ -5,72 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCountryRegionSubdivisionRequest = SearchBasicInfoCountryRegionSubdivisionRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(SearchBasicInfoCountryRegionSubdivisionRequestBody.builder() - .country_region_id_list([]) - .country_region_subdivision_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCountryRegionSubdivisionRequest = SearchBasicInfoCountryRegionSubdivisionRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(SearchBasicInfoCountryRegionSubdivisionRequestBody.builder() + .country_region_id_list([]) + .country_region_subdivision_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCountryRegionSubdivisionResponse = client.corehr.v2.basic_info_country_region_subdivision.search( - request) + # 发起请求 + response: SearchBasicInfoCountryRegionSubdivisionResponse = client.corehr.v2.basic_info_country_region_subdivision.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_country_region_subdivision.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_country_region_subdivision.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCountryRegionSubdivisionRequest = SearchBasicInfoCountryRegionSubdivisionRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(SearchBasicInfoCountryRegionSubdivisionRequestBody.builder() - .country_region_id_list([]) - .country_region_subdivision_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCountryRegionSubdivisionRequest = SearchBasicInfoCountryRegionSubdivisionRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(SearchBasicInfoCountryRegionSubdivisionRequestBody.builder() + .country_region_id_list([]) + .country_region_subdivision_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCountryRegionSubdivisionResponse = await client.corehr.v2.basic_info_country_region_subdivision.asearch( - request) + # 发起请求 + response: SearchBasicInfoCountryRegionSubdivisionResponse = await client.corehr.v2.basic_info_country_region_subdivision.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_country_region_subdivision.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_country_region_subdivision.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_currency_sample.py b/samples/api/corehr/v2/search_basic_info_currency_sample.py index 2c844630e..2fe9866b3 100644 --- a/samples/api/corehr/v2/search_basic_info_currency_sample.py +++ b/samples/api/corehr/v2/search_basic_info_currency_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCurrencyRequest = SearchBasicInfoCurrencyRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(SearchBasicInfoCurrencyRequestBody.builder() - .currency_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCurrencyRequest = SearchBasicInfoCurrencyRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(SearchBasicInfoCurrencyRequestBody.builder() + .currency_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCurrencyResponse = client.corehr.v2.basic_info_currency.search(request) + # 发起请求 + response: SearchBasicInfoCurrencyResponse = client.corehr.v2.basic_info_currency.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_currency.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_currency.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoCurrencyRequest = SearchBasicInfoCurrencyRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .request_body(SearchBasicInfoCurrencyRequestBody.builder() - .currency_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoCurrencyRequest = SearchBasicInfoCurrencyRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .request_body(SearchBasicInfoCurrencyRequestBody.builder() + .currency_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoCurrencyResponse = await client.corehr.v2.basic_info_currency.asearch(request) + # 发起请求 + response: SearchBasicInfoCurrencyResponse = await client.corehr.v2.basic_info_currency.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_currency.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_currency.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_district_sample.py b/samples/api/corehr/v2/search_basic_info_district_sample.py index adfb42c1a..05b0a51f7 100644 --- a/samples/api/corehr/v2/search_basic_info_district_sample.py +++ b/samples/api/corehr/v2/search_basic_info_district_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoDistrictRequest = SearchBasicInfoDistrictRequest.builder() \ - .page_size(100) \ - .page_token("6863333352758314504") \ - .request_body(SearchBasicInfoDistrictRequestBody.builder() - .city_id_list([]) - .district_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoDistrictRequest = SearchBasicInfoDistrictRequest.builder() \ + .page_size(100) \ + .page_token("6863333352758314504") \ + .request_body(SearchBasicInfoDistrictRequestBody.builder() + .city_id_list([]) + .district_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoDistrictResponse = client.corehr.v2.basic_info_district.search(request) + # 发起请求 + response: SearchBasicInfoDistrictResponse = client.corehr.v2.basic_info_district.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_district.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_district.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoDistrictRequest = SearchBasicInfoDistrictRequest.builder() \ - .page_size(100) \ - .page_token("6863333352758314504") \ - .request_body(SearchBasicInfoDistrictRequestBody.builder() - .city_id_list([]) - .district_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoDistrictRequest = SearchBasicInfoDistrictRequest.builder() \ + .page_size(100) \ + .page_token("6863333352758314504") \ + .request_body(SearchBasicInfoDistrictRequestBody.builder() + .city_id_list([]) + .district_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoDistrictResponse = await client.corehr.v2.basic_info_district.asearch(request) + # 发起请求 + response: SearchBasicInfoDistrictResponse = await client.corehr.v2.basic_info_district.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_district.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_district.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_basic_info_nationality_sample.py b/samples/api/corehr/v2/search_basic_info_nationality_sample.py index edb6ea163..553d5857a 100644 --- a/samples/api/corehr/v2/search_basic_info_nationality_sample.py +++ b/samples/api/corehr/v2/search_basic_info_nationality_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoNationalityRequest = SearchBasicInfoNationalityRequest.builder() \ - .page_size(100) \ - .page_token("7075702743846897196") \ - .request_body(SearchBasicInfoNationalityRequestBody.builder() - .nationality_id_list([]) - .country_region_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoNationalityRequest = SearchBasicInfoNationalityRequest.builder() \ + .page_size(100) \ + .page_token("7075702743846897196") \ + .request_body(SearchBasicInfoNationalityRequestBody.builder() + .nationality_id_list([]) + .country_region_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoNationalityResponse = client.corehr.v2.basic_info_nationality.search(request) + # 发起请求 + response: SearchBasicInfoNationalityResponse = client.corehr.v2.basic_info_nationality.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_nationality.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_nationality.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchBasicInfoNationalityRequest = SearchBasicInfoNationalityRequest.builder() \ - .page_size(100) \ - .page_token("7075702743846897196") \ - .request_body(SearchBasicInfoNationalityRequestBody.builder() - .nationality_id_list([]) - .country_region_id_list([]) - .status_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchBasicInfoNationalityRequest = SearchBasicInfoNationalityRequest.builder() \ + .page_size(100) \ + .page_token("7075702743846897196") \ + .request_body(SearchBasicInfoNationalityRequestBody.builder() + .nationality_id_list([]) + .country_region_id_list([]) + .status_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchBasicInfoNationalityResponse = await client.corehr.v2.basic_info_nationality.asearch(request) + # 发起请求 + response: SearchBasicInfoNationalityResponse = await client.corehr.v2.basic_info_nationality.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.basic_info_nationality.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.basic_info_nationality.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_contract_sample.py b/samples/api/corehr/v2/search_contract_sample.py index 51833c0d4..4eb603442 100644 --- a/samples/api/corehr/v2/search_contract_sample.py +++ b/samples/api/corehr/v2/search_contract_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchContractRequest = SearchContractRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .request_body(SearchContractRequestBody.builder() - .employment_id_list([]) - .contract_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchContractRequest = SearchContractRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .request_body(SearchContractRequestBody.builder() + .employment_id_list([]) + .contract_id_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchContractResponse = client.corehr.v2.contract.search(request) + # 发起请求 + response: SearchContractResponse = client.corehr.v2.contract.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.contract.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.contract.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchContractRequest = SearchContractRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .request_body(SearchContractRequestBody.builder() - .employment_id_list([]) - .contract_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchContractRequest = SearchContractRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .request_body(SearchContractRequestBody.builder() + .employment_id_list([]) + .contract_id_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchContractResponse = await client.corehr.v2.contract.asearch(request) + # 发起请求 + response: SearchContractResponse = await client.corehr.v2.contract.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.contract.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.contract.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_cost_center_sample.py b/samples/api/corehr/v2/search_cost_center_sample.py index 51c4a9198..159566142 100644 --- a/samples/api/corehr/v2/search_cost_center_sample.py +++ b/samples/api/corehr/v2/search_cost_center_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCostCenterRequest = SearchCostCenterRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("people_corehr_id") \ - .request_body(SearchCostCenterRequestBody.builder() - .cost_center_id_list([]) - .name_list([]) - .code("MDPD00000023") - .parent_cost_center_id("6862995757234914824") - .get_all_version(False) - .build()) \ - .build() + # 构造请求对象 + request: SearchCostCenterRequest = SearchCostCenterRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("people_corehr_id") \ + .request_body(SearchCostCenterRequestBody.builder() + .cost_center_id_list([]) + .name_list([]) + .code("MDPD00000023") + .parent_cost_center_id("6862995757234914824") + .get_all_version(False) + .build()) \ + .build() - # 发起请求 - response: SearchCostCenterResponse = client.corehr.v2.cost_center.search(request) + # 发起请求 + response: SearchCostCenterResponse = client.corehr.v2.cost_center.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCostCenterRequest = SearchCostCenterRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("people_corehr_id") \ - .request_body(SearchCostCenterRequestBody.builder() - .cost_center_id_list([]) - .name_list([]) - .code("MDPD00000023") - .parent_cost_center_id("6862995757234914824") - .get_all_version(False) - .build()) \ - .build() + # 构造请求对象 + request: SearchCostCenterRequest = SearchCostCenterRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("people_corehr_id") \ + .request_body(SearchCostCenterRequestBody.builder() + .cost_center_id_list([]) + .name_list([]) + .code("MDPD00000023") + .parent_cost_center_id("6862995757234914824") + .get_all_version(False) + .build()) \ + .build() - # 发起请求 - response: SearchCostCenterResponse = await client.corehr.v2.cost_center.asearch(request) + # 发起请求 + response: SearchCostCenterResponse = await client.corehr.v2.cost_center.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.cost_center.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.cost_center.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_department_sample.py b/samples/api/corehr/v2/search_department_sample.py index aadc71238..1d088ab9a 100644 --- a/samples/api/corehr/v2/search_department_sample.py +++ b/samples/api/corehr/v2/search_department_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchDepartmentRequestBody.builder() - .active(True) - .get_all_children(False) - .manager_list([]) - .department_id_list([]) - .name_list([]) - .parent_department_id("7094136522860922222") - .code_list([]) - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchDepartmentRequestBody.builder() + .active(True) + .get_all_children(False) + .manager_list([]) + .department_id_list([]) + .name_list([]) + .parent_department_id("7094136522860922222") + .code_list([]) + .fields([]) + .build()) \ + .build() - # 发起请求 - response: SearchDepartmentResponse = client.corehr.v2.department.search(request) + # 发起请求 + response: SearchDepartmentResponse = client.corehr.v2.department.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchDepartmentRequestBody.builder() - .active(True) - .get_all_children(False) - .manager_list([]) - .department_id_list([]) - .name_list([]) - .parent_department_id("7094136522860922222") - .code_list([]) - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchDepartmentRequest = SearchDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchDepartmentRequestBody.builder() + .active(True) + .get_all_children(False) + .manager_list([]) + .department_id_list([]) + .name_list([]) + .parent_department_id("7094136522860922222") + .code_list([]) + .fields([]) + .build()) \ + .build() - # 发起请求 - response: SearchDepartmentResponse = await client.corehr.v2.department.asearch(request) + # 发起请求 + response: SearchDepartmentResponse = await client.corehr.v2.department.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.department.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_employee_sample.py b/samples/api/corehr/v2/search_employee_sample.py index ef73e2bdb..19483ac4a 100644 --- a/samples/api/corehr/v2/search_employee_sample.py +++ b/samples/api/corehr/v2/search_employee_sample.py @@ -5,112 +5,112 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEmployeeRequest = SearchEmployeeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchEmployeeRequestBody.builder() - .fields([]) - .employment_id_list([]) - .employee_number_list([]) - .work_email("13312345678@qq.com") - .phone_number("16760342300") - .key_word("张三") - .employment_status("hired") - .employee_type_id("6971090097697521314") - .department_id_list([]) - .direct_manager_id_list([]) - .dotted_line_manager_id_list([]) - .regular_employee_start_date_start("2020-01-01") - .regular_employee_start_date_end("2020-01-01") - .effective_time_start("2020-01-01") - .effective_time_end("2020-01-01") - .work_location_id_list_include_sub([]) - .preferred_english_full_name_list([]) - .preferred_local_full_name_list([]) - .national_id_number_list([]) - .phone_number_list([]) - .email_address_list([]) - .department_id_list_include_sub([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEmployeeRequest = SearchEmployeeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchEmployeeRequestBody.builder() + .fields([]) + .employment_id_list([]) + .employee_number_list([]) + .work_email("13312345678@qq.com") + .phone_number("16760342300") + .key_word("张三") + .employment_status("hired") + .employee_type_id("6971090097697521314") + .department_id_list([]) + .direct_manager_id_list([]) + .dotted_line_manager_id_list([]) + .regular_employee_start_date_start("2020-01-01") + .regular_employee_start_date_end("2020-01-01") + .effective_time_start("2020-01-01") + .effective_time_end("2020-01-01") + .work_location_id_list_include_sub([]) + .preferred_english_full_name_list([]) + .preferred_local_full_name_list([]) + .national_id_number_list([]) + .phone_number_list([]) + .email_address_list([]) + .department_id_list_include_sub([]) + .build()) \ + .build() - # 发起请求 - response: SearchEmployeeResponse = client.corehr.v2.employee.search(request) + # 发起请求 + response: SearchEmployeeResponse = client.corehr.v2.employee.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEmployeeRequest = SearchEmployeeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchEmployeeRequestBody.builder() - .fields([]) - .employment_id_list([]) - .employee_number_list([]) - .work_email("13312345678@qq.com") - .phone_number("16760342300") - .key_word("张三") - .employment_status("hired") - .employee_type_id("6971090097697521314") - .department_id_list([]) - .direct_manager_id_list([]) - .dotted_line_manager_id_list([]) - .regular_employee_start_date_start("2020-01-01") - .regular_employee_start_date_end("2020-01-01") - .effective_time_start("2020-01-01") - .effective_time_end("2020-01-01") - .work_location_id_list_include_sub([]) - .preferred_english_full_name_list([]) - .preferred_local_full_name_list([]) - .national_id_number_list([]) - .phone_number_list([]) - .email_address_list([]) - .department_id_list_include_sub([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEmployeeRequest = SearchEmployeeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchEmployeeRequestBody.builder() + .fields([]) + .employment_id_list([]) + .employee_number_list([]) + .work_email("13312345678@qq.com") + .phone_number("16760342300") + .key_word("张三") + .employment_status("hired") + .employee_type_id("6971090097697521314") + .department_id_list([]) + .direct_manager_id_list([]) + .dotted_line_manager_id_list([]) + .regular_employee_start_date_start("2020-01-01") + .regular_employee_start_date_end("2020-01-01") + .effective_time_start("2020-01-01") + .effective_time_end("2020-01-01") + .work_location_id_list_include_sub([]) + .preferred_english_full_name_list([]) + .preferred_local_full_name_list([]) + .national_id_number_list([]) + .phone_number_list([]) + .email_address_list([]) + .department_id_list_include_sub([]) + .build()) \ + .build() - # 发起请求 - response: SearchEmployeeResponse = await client.corehr.v2.employee.asearch(request) + # 发起请求 + response: SearchEmployeeResponse = await client.corehr.v2.employee.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.employee.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.employee.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_job_change_sample.py b/samples/api/corehr/v2/search_job_change_sample.py index 9a0c0e58f..8d4d303b7 100644 --- a/samples/api/corehr/v2/search_job_change_sample.py +++ b/samples/api/corehr/v2/search_job_change_sample.py @@ -5,82 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchJobChangeRequest = SearchJobChangeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchJobChangeRequestBody.builder() - .employment_ids([]) - .job_change_ids([]) - .statuses([]) - .effective_date_start("2022-01-01") - .effective_date_end("2022-01-01") - .updated_time_start("1704084635000") - .updated_time_end("1704084635000") - .build()) \ - .build() + # 构造请求对象 + request: SearchJobChangeRequest = SearchJobChangeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchJobChangeRequestBody.builder() + .employment_ids([]) + .job_change_ids([]) + .statuses([]) + .effective_date_start("2022-01-01") + .effective_date_end("2022-01-01") + .updated_time_start("1704084635000") + .updated_time_end("1704084635000") + .target_department_ids([]) + .build()) \ + .build() - # 发起请求 - response: SearchJobChangeResponse = client.corehr.v2.job_change.search(request) + # 发起请求 + response: SearchJobChangeResponse = client.corehr.v2.job_change.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_change.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_change.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchJobChangeRequest = SearchJobChangeRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchJobChangeRequestBody.builder() - .employment_ids([]) - .job_change_ids([]) - .statuses([]) - .effective_date_start("2022-01-01") - .effective_date_end("2022-01-01") - .updated_time_start("1704084635000") - .updated_time_end("1704084635000") - .build()) \ - .build() + # 构造请求对象 + request: SearchJobChangeRequest = SearchJobChangeRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchJobChangeRequestBody.builder() + .employment_ids([]) + .job_change_ids([]) + .statuses([]) + .effective_date_start("2022-01-01") + .effective_date_end("2022-01-01") + .updated_time_start("1704084635000") + .updated_time_end("1704084635000") + .target_department_ids([]) + .build()) \ + .build() - # 发起请求 - response: SearchJobChangeResponse = await client.corehr.v2.job_change.asearch(request) + # 发起请求 + response: SearchJobChangeResponse = await client.corehr.v2.job_change.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.job_change.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.job_change.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_pre_hire_sample.py b/samples/api/corehr/v2/search_pre_hire_sample.py index c77d985b8..f54d68a2b 100644 --- a/samples/api/corehr/v2/search_pre_hire_sample.py +++ b/samples/api/corehr/v2/search_pre_hire_sample.py @@ -5,98 +5,98 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchPreHireRequest = SearchPreHireRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchPreHireRequestBody.builder() - .worker_ids([]) - .pre_hire_ids([]) - .onboarding_date_start("2006-01-02") - .onboarding_date_end("2006-01-02") - .updated_date_start("2006-01-02") - .updated_date_end("2006-01-02") - .onboarding_location_ids([]) - .onboarding_status("待入职(preboarding)") - .department_ids([]) - .direct_manager_ids([]) - .employee_type_ids([]) - .job_family_ids([]) - .key_word("张三") - .rehire("张三") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchPreHireRequest = SearchPreHireRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchPreHireRequestBody.builder() + .worker_ids([]) + .pre_hire_ids([]) + .onboarding_date_start("2006-01-02") + .onboarding_date_end("2006-01-02") + .updated_date_start("2006-01-02") + .updated_date_end("2006-01-02") + .onboarding_location_ids([]) + .onboarding_status("待入职(preboarding)") + .department_ids([]) + .direct_manager_ids([]) + .employee_type_ids([]) + .job_family_ids([]) + .key_word("张三") + .rehire("张三") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: SearchPreHireResponse = client.corehr.v2.pre_hire.search(request) + # 发起请求 + response: SearchPreHireResponse = client.corehr.v2.pre_hire.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchPreHireRequest = SearchPreHireRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchPreHireRequestBody.builder() - .worker_ids([]) - .pre_hire_ids([]) - .onboarding_date_start("2006-01-02") - .onboarding_date_end("2006-01-02") - .updated_date_start("2006-01-02") - .updated_date_end("2006-01-02") - .onboarding_location_ids([]) - .onboarding_status("待入职(preboarding)") - .department_ids([]) - .direct_manager_ids([]) - .employee_type_ids([]) - .job_family_ids([]) - .key_word("张三") - .rehire("张三") - .fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchPreHireRequest = SearchPreHireRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchPreHireRequestBody.builder() + .worker_ids([]) + .pre_hire_ids([]) + .onboarding_date_start("2006-01-02") + .onboarding_date_end("2006-01-02") + .updated_date_start("2006-01-02") + .updated_date_end("2006-01-02") + .onboarding_location_ids([]) + .onboarding_status("待入职(preboarding)") + .department_ids([]) + .direct_manager_ids([]) + .employee_type_ids([]) + .job_family_ids([]) + .key_word("张三") + .rehire("张三") + .fields([]) + .build()) \ + .build() - # 发起请求 - response: SearchPreHireResponse = await client.corehr.v2.pre_hire.asearch(request) + # 发起请求 + response: SearchPreHireResponse = await client.corehr.v2.pre_hire.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/search_probation_sample.py b/samples/api/corehr/v2/search_probation_sample.py index 1657a533b..99c94236d 100644 --- a/samples/api/corehr/v2/search_probation_sample.py +++ b/samples/api/corehr/v2/search_probation_sample.py @@ -5,94 +5,94 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchProbationRequest = SearchProbationRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchProbationRequestBody.builder() - .employment_ids([]) - .department_ids([]) - .probation_start_date_start("2022-05-18") - .probation_start_date_end("2022-05-20") - .probation_expected_end_date_start("2022-06-20") - .probation_expected_end_date_end("2022-07-20") - .actual_probation_end_date_start("2022-08-20") - .actual_probation_end_date_end("2022-09-20") - .initiating_time_start("2022-10-20") - .initiating_time_end("2022-11-20") - .probation_status("approved") - .final_assessment_result("approved") - .final_assessment_grade("grade_a") - .build()) \ - .build() + # 构造请求对象 + request: SearchProbationRequest = SearchProbationRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchProbationRequestBody.builder() + .employment_ids([]) + .department_ids([]) + .probation_start_date_start("2022-05-18") + .probation_start_date_end("2022-05-20") + .probation_expected_end_date_start("2022-06-20") + .probation_expected_end_date_end("2022-07-20") + .actual_probation_end_date_start("2022-08-20") + .actual_probation_end_date_end("2022-09-20") + .initiating_time_start("2022-10-20") + .initiating_time_end("2022-11-20") + .probation_status("approved") + .final_assessment_result("approved") + .final_assessment_grade("grade_a") + .build()) \ + .build() - # 发起请求 - response: SearchProbationResponse = client.corehr.v2.probation.search(request) + # 发起请求 + response: SearchProbationResponse = client.corehr.v2.probation.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchProbationRequest = SearchProbationRequest.builder() \ - .page_size(100) \ - .page_token("6891251722631890445") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(SearchProbationRequestBody.builder() - .employment_ids([]) - .department_ids([]) - .probation_start_date_start("2022-05-18") - .probation_start_date_end("2022-05-20") - .probation_expected_end_date_start("2022-06-20") - .probation_expected_end_date_end("2022-07-20") - .actual_probation_end_date_start("2022-08-20") - .actual_probation_end_date_end("2022-09-20") - .initiating_time_start("2022-10-20") - .initiating_time_end("2022-11-20") - .probation_status("approved") - .final_assessment_result("approved") - .final_assessment_grade("grade_a") - .build()) \ - .build() + # 构造请求对象 + request: SearchProbationRequest = SearchProbationRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(SearchProbationRequestBody.builder() + .employment_ids([]) + .department_ids([]) + .probation_start_date_start("2022-05-18") + .probation_start_date_end("2022-05-20") + .probation_expected_end_date_start("2022-06-20") + .probation_expected_end_date_end("2022-07-20") + .actual_probation_end_date_start("2022-08-20") + .actual_probation_end_date_end("2022-09-20") + .initiating_time_start("2022-10-20") + .initiating_time_end("2022-11-20") + .probation_status("approved") + .final_assessment_result("approved") + .final_assessment_grade("grade_a") + .build()) \ + .build() - # 发起请求 - response: SearchProbationResponse = await client.corehr.v2.probation.asearch(request) + # 发起请求 + response: SearchProbationResponse = await client.corehr.v2.probation.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/submit_probation_sample.py b/samples/api/corehr/v2/submit_probation_sample.py index 242c88593..764194791 100644 --- a/samples/api/corehr/v2/submit_probation_sample.py +++ b/samples/api/corehr/v2/submit_probation_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitProbationRequest = SubmitProbationRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(SubmitProbationRequestBody.builder() - .employment_id("7140964208476371111") - .conversion_mode(1) - .actual_probation_end_date("2022-05-20") - .submission_type("system") - .initiator_id("7140964208476371111") - .notes("符合预期") - .self_review("符合预期") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SubmitProbationRequest = SubmitProbationRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(SubmitProbationRequestBody.builder() + .employment_id("7140964208476371111") + .conversion_mode(1) + .actual_probation_end_date("2022-05-20") + .submission_type("system") + .initiator_id("7140964208476371111") + .notes("符合预期") + .self_review("符合预期") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: SubmitProbationResponse = client.corehr.v2.probation.submit(request) + # 发起请求 + response: SubmitProbationResponse = client.corehr.v2.probation.submit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.submit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.submit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitProbationRequest = SubmitProbationRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(SubmitProbationRequestBody.builder() - .employment_id("7140964208476371111") - .conversion_mode(1) - .actual_probation_end_date("2022-05-20") - .submission_type("system") - .initiator_id("7140964208476371111") - .notes("符合预期") - .self_review("符合预期") - .custom_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: SubmitProbationRequest = SubmitProbationRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(SubmitProbationRequestBody.builder() + .employment_id("7140964208476371111") + .conversion_mode(1) + .actual_probation_end_date("2022-05-20") + .submission_type("system") + .initiator_id("7140964208476371111") + .notes("符合预期") + .self_review("符合预期") + .custom_fields([]) + .build()) \ + .build() - # 发起请求 - response: SubmitProbationResponse = await client.corehr.v2.probation.asubmit(request) + # 发起请求 + response: SubmitProbationResponse = await client.corehr.v2.probation.asubmit(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.asubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.asubmit failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/transit_task_pre_hire_sample.py b/samples/api/corehr/v2/transit_task_pre_hire_sample.py index 1d84c62db..e6b95350b 100644 --- a/samples/api/corehr/v2/transit_task_pre_hire_sample.py +++ b/samples/api/corehr/v2/transit_task_pre_hire_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransitTaskPreHireRequest = TransitTaskPreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .request_body(TransitTaskPreHireRequestBody.builder() - .task_id("1") - .build()) \ - .build() + # 构造请求对象 + request: TransitTaskPreHireRequest = TransitTaskPreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .request_body(TransitTaskPreHireRequestBody.builder() + .task_id("1") + .build()) \ + .build() - # 发起请求 - response: TransitTaskPreHireResponse = client.corehr.v2.pre_hire.transit_task(request) + # 发起请求 + response: TransitTaskPreHireResponse = client.corehr.v2.pre_hire.transit_task(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.transit_task failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.transit_task failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransitTaskPreHireRequest = TransitTaskPreHireRequest.builder() \ - .pre_hire_id("7345005664477775407") \ - .request_body(TransitTaskPreHireRequestBody.builder() - .task_id("1") - .build()) \ - .build() + # 构造请求对象 + request: TransitTaskPreHireRequest = TransitTaskPreHireRequest.builder() \ + .pre_hire_id("7345005664477775407") \ + .request_body(TransitTaskPreHireRequestBody.builder() + .task_id("1") + .build()) \ + .build() - # 发起请求 - response: TransitTaskPreHireResponse = await client.corehr.v2.pre_hire.atransit_task(request) + # 发起请求 + response: TransitTaskPreHireResponse = await client.corehr.v2.pre_hire.atransit_task(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.pre_hire.atransit_task failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.pre_hire.atransit_task failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/tree_department_sample.py b/samples/api/corehr/v2/tree_department_sample.py new file mode 100644 index 000000000..e15f70316 --- /dev/null +++ b/samples/api/corehr/v2/tree_department_sample.py @@ -0,0 +1,76 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.corehr.v2 import * + + +def main(): + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() + + # 构造请求对象 + request: TreeDepartmentRequest = TreeDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .department_id_type("people_corehr_department_id") \ + .request_body(TreeDepartmentRequestBody.builder() + .department_id("6893014062142064111") + .need_inactive(False) + .effective_date("2024-01-01") + .build()) \ + .build() + + # 发起请求 + response: TreeDepartmentResponse = client.corehr.v2.department.tree(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.tree failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return + + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + + +# 异步方式 +async def amain(): + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() + + # 构造请求对象 + request: TreeDepartmentRequest = TreeDepartmentRequest.builder() \ + .page_size(100) \ + .page_token("6891251722631890445") \ + .department_id_type("people_corehr_department_id") \ + .request_body(TreeDepartmentRequestBody.builder() + .department_id("6893014062142064111") + .need_inactive(False) + .effective_date("2024-01-01") + .build()) \ + .build() + + # 发起请求 + response: TreeDepartmentResponse = await client.corehr.v2.department.atree(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.department.atree failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return + + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + + +if __name__ == "__main__": + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/update_process_approver_sample.py b/samples/api/corehr/v2/update_process_approver_sample.py index ccb695495..ed4f4e2a9 100644 --- a/samples/api/corehr/v2/update_process_approver_sample.py +++ b/samples/api/corehr/v2/update_process_approver_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProcessApproverRequest = UpdateProcessApproverRequest.builder() \ - .process_id("7328345170959681068") \ - .approver_id("7328345235136726572") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ProcessApprover.builder() - .status(2) - .user_id("ou_91791271921729102012") - .system_approval(False) - .reason("原因自定义字符串") - .field_values_v2([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProcessApproverRequest = UpdateProcessApproverRequest.builder() \ + .process_id("7328345170959681068") \ + .approver_id("7328345235136726572") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ProcessApprover.builder() + .status(2) + .user_id("ou_91791271921729102012") + .system_approval(False) + .reason("原因自定义字符串") + .field_values_v2([]) + .build()) \ + .build() - # 发起请求 - response: UpdateProcessApproverResponse = client.corehr.v2.process_approver.update(request) + # 发起请求 + response: UpdateProcessApproverResponse = client.corehr.v2.process_approver.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process_approver.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process_approver.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProcessApproverRequest = UpdateProcessApproverRequest.builder() \ - .process_id("7328345170959681068") \ - .approver_id("7328345235136726572") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(ProcessApprover.builder() - .status(2) - .user_id("ou_91791271921729102012") - .system_approval(False) - .reason("原因自定义字符串") - .field_values_v2([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProcessApproverRequest = UpdateProcessApproverRequest.builder() \ + .process_id("7328345170959681068") \ + .approver_id("7328345235136726572") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(ProcessApprover.builder() + .status(2) + .user_id("ou_91791271921729102012") + .system_approval(False) + .reason("原因自定义字符串") + .field_values_v2([]) + .build()) \ + .build() - # 发起请求 - response: UpdateProcessApproverResponse = await client.corehr.v2.process_approver.aupdate(request) + # 发起请求 + response: UpdateProcessApproverResponse = await client.corehr.v2.process_approver.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.process_approver.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.process_approver.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/corehr/v2/withdraw_probation_sample.py b/samples/api/corehr/v2/withdraw_probation_sample.py index adfe0ae24..e1b78eb5e 100644 --- a/samples/api/corehr/v2/withdraw_probation_sample.py +++ b/samples/api/corehr/v2/withdraw_probation_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: WithdrawProbationRequest = WithdrawProbationRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(WithdrawProbationRequestBody.builder() - .employment_id("7140964208476371111") - .build()) \ - .build() + # 构造请求对象 + request: WithdrawProbationRequest = WithdrawProbationRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(WithdrawProbationRequestBody.builder() + .employment_id("7140964208476371111") + .build()) \ + .build() - # 发起请求 - response: WithdrawProbationResponse = client.corehr.v2.probation.withdraw(request) + # 发起请求 + response: WithdrawProbationResponse = client.corehr.v2.probation.withdraw(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.withdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.withdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: WithdrawProbationRequest = WithdrawProbationRequest.builder() \ - .client_token("6822122262122064111") \ - .user_id_type("open_id") \ - .request_body(WithdrawProbationRequestBody.builder() - .employment_id("7140964208476371111") - .build()) \ - .build() + # 构造请求对象 + request: WithdrawProbationRequest = WithdrawProbationRequest.builder() \ + .client_token("6822122262122064111") \ + .user_id_type("open_id") \ + .request_body(WithdrawProbationRequestBody.builder() + .employment_id("7140964208476371111") + .build()) \ + .build() - # 发起请求 - response: WithdrawProbationResponse = await client.corehr.v2.probation.awithdraw(request) + # 发起请求 + response: WithdrawProbationResponse = await client.corehr.v2.probation.awithdraw(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.corehr.v2.probation.awithdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.probation.awithdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/field_extraction_contract_sample.py b/samples/api/document_ai/v1/field_extraction_contract_sample.py index c33ee77a8..5f4179eac 100644 --- a/samples/api/document_ai/v1/field_extraction_contract_sample.py +++ b/samples/api/document_ai/v1/field_extraction_contract_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: FieldExtractionContractRequest = FieldExtractionContractRequest.builder() \ - .request_body(FieldExtractionContractRequestBody.builder() - .file(file) - .pdf_page_limit(15) - .ocr_mode("auto") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: FieldExtractionContractRequest = FieldExtractionContractRequest.builder() \ + .request_body(FieldExtractionContractRequestBody.builder() + .file(file) + .pdf_page_limit(15) + .ocr_mode("auto") + .build()) \ + .build() - # 发起请求 - response: FieldExtractionContractResponse = client.document_ai.v1.contract.field_extraction(request) + # 发起请求 + response: FieldExtractionContractResponse = client.document_ai.v1.contract.field_extraction(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.contract.field_extraction failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.contract.field_extraction failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: FieldExtractionContractRequest = FieldExtractionContractRequest.builder() \ - .request_body(FieldExtractionContractRequestBody.builder() - .file(file) - .pdf_page_limit(15) - .ocr_mode("auto") - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: FieldExtractionContractRequest = FieldExtractionContractRequest.builder() \ + .request_body(FieldExtractionContractRequestBody.builder() + .file(file) + .pdf_page_limit(15) + .ocr_mode("auto") + .build()) \ + .build() - # 发起请求 - response: FieldExtractionContractResponse = await client.document_ai.v1.contract.afield_extraction(request) + # 发起请求 + response: FieldExtractionContractResponse = await client.document_ai.v1.contract.afield_extraction(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.contract.afield_extraction failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.contract.afield_extraction failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/parse_resume_sample.py b/samples/api/document_ai/v1/parse_resume_sample.py index 047f245af..301660a26 100644 --- a/samples/api/document_ai/v1/parse_resume_sample.py +++ b/samples/api/document_ai/v1/parse_resume_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: ParseResumeRequest = ParseResumeRequest.builder() \ - .request_body(ParseResumeRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: ParseResumeRequest = ParseResumeRequest.builder() \ + .request_body(ParseResumeRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: ParseResumeResponse = client.document_ai.v1.resume.parse(request) + # 发起请求 + response: ParseResumeResponse = client.document_ai.v1.resume.parse(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.resume.parse failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.resume.parse failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: ParseResumeRequest = ParseResumeRequest.builder() \ - .request_body(ParseResumeRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: ParseResumeRequest = ParseResumeRequest.builder() \ + .request_body(ParseResumeRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: ParseResumeResponse = await client.document_ai.v1.resume.aparse(request) + # 发起请求 + response: ParseResumeResponse = await client.document_ai.v1.resume.aparse(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.resume.aparse failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.resume.aparse failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_bank_card_sample.py b/samples/api/document_ai/v1/recognize_bank_card_sample.py index 5b351fb0f..1dba9f3d0 100644 --- a/samples/api/document_ai/v1/recognize_bank_card_sample.py +++ b/samples/api/document_ai/v1/recognize_bank_card_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBankCardRequest = RecognizeBankCardRequest.builder() \ - .request_body(RecognizeBankCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBankCardRequest = RecognizeBankCardRequest.builder() \ + .request_body(RecognizeBankCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBankCardResponse = client.document_ai.v1.bank_card.recognize(request) + # 发起请求 + response: RecognizeBankCardResponse = client.document_ai.v1.bank_card.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.bank_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.bank_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBankCardRequest = RecognizeBankCardRequest.builder() \ - .request_body(RecognizeBankCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBankCardRequest = RecognizeBankCardRequest.builder() \ + .request_body(RecognizeBankCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBankCardResponse = await client.document_ai.v1.bank_card.arecognize(request) + # 发起请求 + response: RecognizeBankCardResponse = await client.document_ai.v1.bank_card.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.bank_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.bank_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_business_card_sample.py b/samples/api/document_ai/v1/recognize_business_card_sample.py index cf293ab4e..b680fe7e4 100644 --- a/samples/api/document_ai/v1/recognize_business_card_sample.py +++ b/samples/api/document_ai/v1/recognize_business_card_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBusinessCardRequest = RecognizeBusinessCardRequest.builder() \ - .request_body(RecognizeBusinessCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBusinessCardRequest = RecognizeBusinessCardRequest.builder() \ + .request_body(RecognizeBusinessCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBusinessCardResponse = client.document_ai.v1.business_card.recognize(request) + # 发起请求 + response: RecognizeBusinessCardResponse = client.document_ai.v1.business_card.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.business_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.business_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBusinessCardRequest = RecognizeBusinessCardRequest.builder() \ - .request_body(RecognizeBusinessCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBusinessCardRequest = RecognizeBusinessCardRequest.builder() \ + .request_body(RecognizeBusinessCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBusinessCardResponse = await client.document_ai.v1.business_card.arecognize(request) + # 发起请求 + response: RecognizeBusinessCardResponse = await client.document_ai.v1.business_card.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.business_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.business_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_business_license_sample.py b/samples/api/document_ai/v1/recognize_business_license_sample.py index 0576ad927..659f7da1b 100644 --- a/samples/api/document_ai/v1/recognize_business_license_sample.py +++ b/samples/api/document_ai/v1/recognize_business_license_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBusinessLicenseRequest = RecognizeBusinessLicenseRequest.builder() \ - .request_body(RecognizeBusinessLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBusinessLicenseRequest = RecognizeBusinessLicenseRequest.builder() \ + .request_body(RecognizeBusinessLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBusinessLicenseResponse = client.document_ai.v1.business_license.recognize(request) + # 发起请求 + response: RecognizeBusinessLicenseResponse = client.document_ai.v1.business_license.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.business_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.business_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeBusinessLicenseRequest = RecognizeBusinessLicenseRequest.builder() \ - .request_body(RecognizeBusinessLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeBusinessLicenseRequest = RecognizeBusinessLicenseRequest.builder() \ + .request_body(RecognizeBusinessLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeBusinessLicenseResponse = await client.document_ai.v1.business_license.arecognize(request) + # 发起请求 + response: RecognizeBusinessLicenseResponse = await client.document_ai.v1.business_license.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.business_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.business_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_chinese_passport_sample.py b/samples/api/document_ai/v1/recognize_chinese_passport_sample.py index dd0e7f585..d6f10af47 100644 --- a/samples/api/document_ai/v1/recognize_chinese_passport_sample.py +++ b/samples/api/document_ai/v1/recognize_chinese_passport_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeChinesePassportRequest = RecognizeChinesePassportRequest.builder() \ - .request_body(RecognizeChinesePassportRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeChinesePassportRequest = RecognizeChinesePassportRequest.builder() \ + .request_body(RecognizeChinesePassportRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeChinesePassportResponse = client.document_ai.v1.chinese_passport.recognize(request) + # 发起请求 + response: RecognizeChinesePassportResponse = client.document_ai.v1.chinese_passport.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.chinese_passport.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.chinese_passport.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeChinesePassportRequest = RecognizeChinesePassportRequest.builder() \ - .request_body(RecognizeChinesePassportRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeChinesePassportRequest = RecognizeChinesePassportRequest.builder() \ + .request_body(RecognizeChinesePassportRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeChinesePassportResponse = await client.document_ai.v1.chinese_passport.arecognize(request) + # 发起请求 + response: RecognizeChinesePassportResponse = await client.document_ai.v1.chinese_passport.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.chinese_passport.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.chinese_passport.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_driving_license_sample.py b/samples/api/document_ai/v1/recognize_driving_license_sample.py index 26f31253f..c0c65f0e5 100644 --- a/samples/api/document_ai/v1/recognize_driving_license_sample.py +++ b/samples/api/document_ai/v1/recognize_driving_license_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeDrivingLicenseRequest = RecognizeDrivingLicenseRequest.builder() \ - .request_body(RecognizeDrivingLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeDrivingLicenseRequest = RecognizeDrivingLicenseRequest.builder() \ + .request_body(RecognizeDrivingLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeDrivingLicenseResponse = client.document_ai.v1.driving_license.recognize(request) + # 发起请求 + response: RecognizeDrivingLicenseResponse = client.document_ai.v1.driving_license.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.driving_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.driving_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeDrivingLicenseRequest = RecognizeDrivingLicenseRequest.builder() \ - .request_body(RecognizeDrivingLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeDrivingLicenseRequest = RecognizeDrivingLicenseRequest.builder() \ + .request_body(RecognizeDrivingLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeDrivingLicenseResponse = await client.document_ai.v1.driving_license.arecognize(request) + # 发起请求 + response: RecognizeDrivingLicenseResponse = await client.document_ai.v1.driving_license.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.driving_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.driving_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_food_manage_license_sample.py b/samples/api/document_ai/v1/recognize_food_manage_license_sample.py index aa942bc4f..b958a35b8 100644 --- a/samples/api/document_ai/v1/recognize_food_manage_license_sample.py +++ b/samples/api/document_ai/v1/recognize_food_manage_license_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeFoodManageLicenseRequest = RecognizeFoodManageLicenseRequest.builder() \ - .request_body(RecognizeFoodManageLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeFoodManageLicenseRequest = RecognizeFoodManageLicenseRequest.builder() \ + .request_body(RecognizeFoodManageLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeFoodManageLicenseResponse = client.document_ai.v1.food_manage_license.recognize(request) + # 发起请求 + response: RecognizeFoodManageLicenseResponse = client.document_ai.v1.food_manage_license.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.food_manage_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.food_manage_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeFoodManageLicenseRequest = RecognizeFoodManageLicenseRequest.builder() \ - .request_body(RecognizeFoodManageLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeFoodManageLicenseRequest = RecognizeFoodManageLicenseRequest.builder() \ + .request_body(RecognizeFoodManageLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeFoodManageLicenseResponse = await client.document_ai.v1.food_manage_license.arecognize(request) + # 发起请求 + response: RecognizeFoodManageLicenseResponse = await client.document_ai.v1.food_manage_license.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.food_manage_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.food_manage_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_food_produce_license_sample.py b/samples/api/document_ai/v1/recognize_food_produce_license_sample.py index 4da4e06c1..eb7aba611 100644 --- a/samples/api/document_ai/v1/recognize_food_produce_license_sample.py +++ b/samples/api/document_ai/v1/recognize_food_produce_license_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeFoodProduceLicenseRequest = RecognizeFoodProduceLicenseRequest.builder() \ - .request_body(RecognizeFoodProduceLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeFoodProduceLicenseRequest = RecognizeFoodProduceLicenseRequest.builder() \ + .request_body(RecognizeFoodProduceLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeFoodProduceLicenseResponse = client.document_ai.v1.food_produce_license.recognize(request) + # 发起请求 + response: RecognizeFoodProduceLicenseResponse = client.document_ai.v1.food_produce_license.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.food_produce_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.food_produce_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeFoodProduceLicenseRequest = RecognizeFoodProduceLicenseRequest.builder() \ - .request_body(RecognizeFoodProduceLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeFoodProduceLicenseRequest = RecognizeFoodProduceLicenseRequest.builder() \ + .request_body(RecognizeFoodProduceLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeFoodProduceLicenseResponse = await client.document_ai.v1.food_produce_license.arecognize(request) + # 发起请求 + response: RecognizeFoodProduceLicenseResponse = await client.document_ai.v1.food_produce_license.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.food_produce_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.food_produce_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_health_certificate_sample.py b/samples/api/document_ai/v1/recognize_health_certificate_sample.py index 6cb800077..e78b8809c 100644 --- a/samples/api/document_ai/v1/recognize_health_certificate_sample.py +++ b/samples/api/document_ai/v1/recognize_health_certificate_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeHealthCertificateRequest = RecognizeHealthCertificateRequest.builder() \ - .request_body(RecognizeHealthCertificateRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeHealthCertificateRequest = RecognizeHealthCertificateRequest.builder() \ + .request_body(RecognizeHealthCertificateRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeHealthCertificateResponse = client.document_ai.v1.health_certificate.recognize(request) + # 发起请求 + response: RecognizeHealthCertificateResponse = client.document_ai.v1.health_certificate.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.health_certificate.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.health_certificate.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeHealthCertificateRequest = RecognizeHealthCertificateRequest.builder() \ - .request_body(RecognizeHealthCertificateRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeHealthCertificateRequest = RecognizeHealthCertificateRequest.builder() \ + .request_body(RecognizeHealthCertificateRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeHealthCertificateResponse = await client.document_ai.v1.health_certificate.arecognize(request) + # 发起请求 + response: RecognizeHealthCertificateResponse = await client.document_ai.v1.health_certificate.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.health_certificate.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.health_certificate.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_hkm_mainland_travel_permit_sample.py b/samples/api/document_ai/v1/recognize_hkm_mainland_travel_permit_sample.py index 9a4312f1f..6313bcc48 100644 --- a/samples/api/document_ai/v1/recognize_hkm_mainland_travel_permit_sample.py +++ b/samples/api/document_ai/v1/recognize_hkm_mainland_travel_permit_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeHkmMainlandTravelPermitRequest = RecognizeHkmMainlandTravelPermitRequest.builder() \ - .request_body(RecognizeHkmMainlandTravelPermitRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeHkmMainlandTravelPermitRequest = RecognizeHkmMainlandTravelPermitRequest.builder() \ + .request_body(RecognizeHkmMainlandTravelPermitRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeHkmMainlandTravelPermitResponse = client.document_ai.v1.hkm_mainland_travel_permit.recognize( - request) + # 发起请求 + response: RecognizeHkmMainlandTravelPermitResponse = client.document_ai.v1.hkm_mainland_travel_permit.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.hkm_mainland_travel_permit.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.hkm_mainland_travel_permit.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeHkmMainlandTravelPermitRequest = RecognizeHkmMainlandTravelPermitRequest.builder() \ - .request_body(RecognizeHkmMainlandTravelPermitRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeHkmMainlandTravelPermitRequest = RecognizeHkmMainlandTravelPermitRequest.builder() \ + .request_body(RecognizeHkmMainlandTravelPermitRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeHkmMainlandTravelPermitResponse = await client.document_ai.v1.hkm_mainland_travel_permit.arecognize( - request) + # 发起请求 + response: RecognizeHkmMainlandTravelPermitResponse = await client.document_ai.v1.hkm_mainland_travel_permit.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.hkm_mainland_travel_permit.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.hkm_mainland_travel_permit.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_id_card_sample.py b/samples/api/document_ai/v1/recognize_id_card_sample.py index 2b654eb7d..92f51fce6 100644 --- a/samples/api/document_ai/v1/recognize_id_card_sample.py +++ b/samples/api/document_ai/v1/recognize_id_card_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeIdCardRequest = RecognizeIdCardRequest.builder() \ - .request_body(RecognizeIdCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeIdCardRequest = RecognizeIdCardRequest.builder() \ + .request_body(RecognizeIdCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeIdCardResponse = client.document_ai.v1.id_card.recognize(request) + # 发起请求 + response: RecognizeIdCardResponse = client.document_ai.v1.id_card.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.id_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.id_card.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeIdCardRequest = RecognizeIdCardRequest.builder() \ - .request_body(RecognizeIdCardRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeIdCardRequest = RecognizeIdCardRequest.builder() \ + .request_body(RecognizeIdCardRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeIdCardResponse = await client.document_ai.v1.id_card.arecognize(request) + # 发起请求 + response: RecognizeIdCardResponse = await client.document_ai.v1.id_card.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.id_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.id_card.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_taxi_invoice_sample.py b/samples/api/document_ai/v1/recognize_taxi_invoice_sample.py index b831c3665..46c33694a 100644 --- a/samples/api/document_ai/v1/recognize_taxi_invoice_sample.py +++ b/samples/api/document_ai/v1/recognize_taxi_invoice_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTaxiInvoiceRequest = RecognizeTaxiInvoiceRequest.builder() \ - .request_body(RecognizeTaxiInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTaxiInvoiceRequest = RecognizeTaxiInvoiceRequest.builder() \ + .request_body(RecognizeTaxiInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTaxiInvoiceResponse = client.document_ai.v1.taxi_invoice.recognize(request) + # 发起请求 + response: RecognizeTaxiInvoiceResponse = client.document_ai.v1.taxi_invoice.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.taxi_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.taxi_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTaxiInvoiceRequest = RecognizeTaxiInvoiceRequest.builder() \ - .request_body(RecognizeTaxiInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTaxiInvoiceRequest = RecognizeTaxiInvoiceRequest.builder() \ + .request_body(RecognizeTaxiInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTaxiInvoiceResponse = await client.document_ai.v1.taxi_invoice.arecognize(request) + # 发起请求 + response: RecognizeTaxiInvoiceResponse = await client.document_ai.v1.taxi_invoice.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.taxi_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.taxi_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_train_invoice_sample.py b/samples/api/document_ai/v1/recognize_train_invoice_sample.py index 4275c3823..ac966c458 100644 --- a/samples/api/document_ai/v1/recognize_train_invoice_sample.py +++ b/samples/api/document_ai/v1/recognize_train_invoice_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTrainInvoiceRequest = RecognizeTrainInvoiceRequest.builder() \ - .request_body(RecognizeTrainInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTrainInvoiceRequest = RecognizeTrainInvoiceRequest.builder() \ + .request_body(RecognizeTrainInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTrainInvoiceResponse = client.document_ai.v1.train_invoice.recognize(request) + # 发起请求 + response: RecognizeTrainInvoiceResponse = client.document_ai.v1.train_invoice.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.train_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.train_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTrainInvoiceRequest = RecognizeTrainInvoiceRequest.builder() \ - .request_body(RecognizeTrainInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTrainInvoiceRequest = RecognizeTrainInvoiceRequest.builder() \ + .request_body(RecognizeTrainInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTrainInvoiceResponse = await client.document_ai.v1.train_invoice.arecognize(request) + # 发起请求 + response: RecognizeTrainInvoiceResponse = await client.document_ai.v1.train_invoice.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.train_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.train_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_tw_mainland_travel_permit_sample.py b/samples/api/document_ai/v1/recognize_tw_mainland_travel_permit_sample.py index fdd4ac8f4..decf04207 100644 --- a/samples/api/document_ai/v1/recognize_tw_mainland_travel_permit_sample.py +++ b/samples/api/document_ai/v1/recognize_tw_mainland_travel_permit_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTwMainlandTravelPermitRequest = RecognizeTwMainlandTravelPermitRequest.builder() \ - .request_body(RecognizeTwMainlandTravelPermitRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTwMainlandTravelPermitRequest = RecognizeTwMainlandTravelPermitRequest.builder() \ + .request_body(RecognizeTwMainlandTravelPermitRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTwMainlandTravelPermitResponse = client.document_ai.v1.tw_mainland_travel_permit.recognize( - request) + # 发起请求 + response: RecognizeTwMainlandTravelPermitResponse = client.document_ai.v1.tw_mainland_travel_permit.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.tw_mainland_travel_permit.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.tw_mainland_travel_permit.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeTwMainlandTravelPermitRequest = RecognizeTwMainlandTravelPermitRequest.builder() \ - .request_body(RecognizeTwMainlandTravelPermitRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeTwMainlandTravelPermitRequest = RecognizeTwMainlandTravelPermitRequest.builder() \ + .request_body(RecognizeTwMainlandTravelPermitRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeTwMainlandTravelPermitResponse = await client.document_ai.v1.tw_mainland_travel_permit.arecognize( - request) + # 发起请求 + response: RecognizeTwMainlandTravelPermitResponse = await client.document_ai.v1.tw_mainland_travel_permit.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.tw_mainland_travel_permit.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.tw_mainland_travel_permit.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_vat_invoice_sample.py b/samples/api/document_ai/v1/recognize_vat_invoice_sample.py index cb5337424..09615982c 100644 --- a/samples/api/document_ai/v1/recognize_vat_invoice_sample.py +++ b/samples/api/document_ai/v1/recognize_vat_invoice_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVatInvoiceRequest = RecognizeVatInvoiceRequest.builder() \ - .request_body(RecognizeVatInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVatInvoiceRequest = RecognizeVatInvoiceRequest.builder() \ + .request_body(RecognizeVatInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVatInvoiceResponse = client.document_ai.v1.vat_invoice.recognize(request) + # 发起请求 + response: RecognizeVatInvoiceResponse = client.document_ai.v1.vat_invoice.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vat_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vat_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVatInvoiceRequest = RecognizeVatInvoiceRequest.builder() \ - .request_body(RecognizeVatInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVatInvoiceRequest = RecognizeVatInvoiceRequest.builder() \ + .request_body(RecognizeVatInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVatInvoiceResponse = await client.document_ai.v1.vat_invoice.arecognize(request) + # 发起请求 + response: RecognizeVatInvoiceResponse = await client.document_ai.v1.vat_invoice.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vat_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vat_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_vehicle_invoice_sample.py b/samples/api/document_ai/v1/recognize_vehicle_invoice_sample.py index c25691661..20255adfc 100644 --- a/samples/api/document_ai/v1/recognize_vehicle_invoice_sample.py +++ b/samples/api/document_ai/v1/recognize_vehicle_invoice_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVehicleInvoiceRequest = RecognizeVehicleInvoiceRequest.builder() \ - .request_body(RecognizeVehicleInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVehicleInvoiceRequest = RecognizeVehicleInvoiceRequest.builder() \ + .request_body(RecognizeVehicleInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVehicleInvoiceResponse = client.document_ai.v1.vehicle_invoice.recognize(request) + # 发起请求 + response: RecognizeVehicleInvoiceResponse = client.document_ai.v1.vehicle_invoice.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vehicle_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vehicle_invoice.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVehicleInvoiceRequest = RecognizeVehicleInvoiceRequest.builder() \ - .request_body(RecognizeVehicleInvoiceRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVehicleInvoiceRequest = RecognizeVehicleInvoiceRequest.builder() \ + .request_body(RecognizeVehicleInvoiceRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVehicleInvoiceResponse = await client.document_ai.v1.vehicle_invoice.arecognize(request) + # 发起请求 + response: RecognizeVehicleInvoiceResponse = await client.document_ai.v1.vehicle_invoice.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vehicle_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vehicle_invoice.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/document_ai/v1/recognize_vehicle_license_sample.py b/samples/api/document_ai/v1/recognize_vehicle_license_sample.py index 8b19aa849..21c915497 100644 --- a/samples/api/document_ai/v1/recognize_vehicle_license_sample.py +++ b/samples/api/document_ai/v1/recognize_vehicle_license_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVehicleLicenseRequest = RecognizeVehicleLicenseRequest.builder() \ - .request_body(RecognizeVehicleLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVehicleLicenseRequest = RecognizeVehicleLicenseRequest.builder() \ + .request_body(RecognizeVehicleLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVehicleLicenseResponse = client.document_ai.v1.vehicle_license.recognize(request) + # 发起请求 + response: RecognizeVehicleLicenseResponse = client.document_ai.v1.vehicle_license.recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vehicle_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vehicle_license.recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: RecognizeVehicleLicenseRequest = RecognizeVehicleLicenseRequest.builder() \ - .request_body(RecognizeVehicleLicenseRequestBody.builder() - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: RecognizeVehicleLicenseRequest = RecognizeVehicleLicenseRequest.builder() \ + .request_body(RecognizeVehicleLicenseRequestBody.builder() + .file(file) + .build()) \ + .build() - # 发起请求 - response: RecognizeVehicleLicenseResponse = await client.document_ai.v1.vehicle_license.arecognize(request) + # 发起请求 + response: RecognizeVehicleLicenseResponse = await client.document_ai.v1.vehicle_license.arecognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.document_ai.v1.vehicle_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.document_ai.v1.vehicle_license.arecognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/batch_delete_document_block_children_sample.py b/samples/api/docx/v1/batch_delete_document_block_children_sample.py index 39692b2a1..cec2b026d 100644 --- a/samples/api/docx/v1/batch_delete_document_block_children_sample.py +++ b/samples/api/docx/v1/batch_delete_document_block_children_sample.py @@ -5,73 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteDocumentBlockChildrenRequest = BatchDeleteDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(BatchDeleteDocumentBlockChildrenRequestBody.builder() - .start_index(0) - .end_index(1) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteDocumentBlockChildrenRequest = BatchDeleteDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(BatchDeleteDocumentBlockChildrenRequestBody.builder() + .start_index(0) + .end_index(1) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteDocumentBlockChildrenResponse = client.docx.v1.document_block_children.batch_delete(request) + # 发起请求 + response: BatchDeleteDocumentBlockChildrenResponse = client.docx.v1.document_block_children.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteDocumentBlockChildrenRequest = BatchDeleteDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .request_body(BatchDeleteDocumentBlockChildrenRequestBody.builder() - .start_index(0) - .end_index(1) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteDocumentBlockChildrenRequest = BatchDeleteDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .request_body(BatchDeleteDocumentBlockChildrenRequestBody.builder() + .start_index(0) + .end_index(1) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.abatch_delete( - request) + # 发起请求 + response: BatchDeleteDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/batch_update_document_block_sample.py b/samples/api/docx/v1/batch_update_document_block_sample.py index 9a87f7f94..1442bde48 100644 --- a/samples/api/docx/v1/batch_update_document_block_sample.py +++ b/samples/api/docx/v1/batch_update_document_block_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateDocumentBlockRequest = BatchUpdateDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .document_revision_id(-1) \ - .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ - .user_id_type("user_id") \ - .request_body(BatchUpdateDocumentBlockRequestBody.builder() - .requests([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateDocumentBlockRequest = BatchUpdateDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .document_revision_id(-1) \ + .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ + .user_id_type("user_id") \ + .request_body(BatchUpdateDocumentBlockRequestBody.builder() + .requests([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateDocumentBlockResponse = client.docx.v1.document_block.batch_update(request) + # 发起请求 + response: BatchUpdateDocumentBlockResponse = client.docx.v1.document_block.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateDocumentBlockRequest = BatchUpdateDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .document_revision_id(-1) \ - .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ - .user_id_type("user_id") \ - .request_body(BatchUpdateDocumentBlockRequestBody.builder() - .requests([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateDocumentBlockRequest = BatchUpdateDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .document_revision_id(-1) \ + .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ + .user_id_type("user_id") \ + .request_body(BatchUpdateDocumentBlockRequestBody.builder() + .requests([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateDocumentBlockResponse = await client.docx.v1.document_block.abatch_update(request) + # 发起请求 + response: BatchUpdateDocumentBlockResponse = await client.docx.v1.document_block.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/create_document_block_children_sample.py b/samples/api/docx/v1/create_document_block_children_sample.py index 70515e18c..cb3071a4b 100644 --- a/samples/api/docx/v1/create_document_block_children_sample.py +++ b/samples/api/docx/v1/create_document_block_children_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDocumentBlockChildrenRequest = CreateDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .user_id_type("user_id") \ - .request_body(CreateDocumentBlockChildrenRequestBody.builder() - .children([]) - .index(-1) - .build()) \ - .build() + # 构造请求对象 + request: CreateDocumentBlockChildrenRequest = CreateDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .user_id_type("user_id") \ + .request_body(CreateDocumentBlockChildrenRequestBody.builder() + .children([]) + .index(-1) + .build()) \ + .build() - # 发起请求 - response: CreateDocumentBlockChildrenResponse = client.docx.v1.document_block_children.create(request) + # 发起请求 + response: CreateDocumentBlockChildrenResponse = client.docx.v1.document_block_children.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDocumentBlockChildrenRequest = CreateDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ - .user_id_type("user_id") \ - .request_body(CreateDocumentBlockChildrenRequestBody.builder() - .children([]) - .index(-1) - .build()) \ - .build() + # 构造请求对象 + request: CreateDocumentBlockChildrenRequest = CreateDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("fe599b60-450f-46ff-b2ef-9f6675625b97") \ + .user_id_type("user_id") \ + .request_body(CreateDocumentBlockChildrenRequestBody.builder() + .children([]) + .index(-1) + .build()) \ + .build() - # 发起请求 - response: CreateDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.acreate(request) + # 发起请求 + response: CreateDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/create_document_sample.py b/samples/api/docx/v1/create_document_sample.py index f31548b85..aae08f870 100644 --- a/samples/api/docx/v1/create_document_sample.py +++ b/samples/api/docx/v1/create_document_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDocumentRequest = CreateDocumentRequest.builder() \ - .request_body(CreateDocumentRequestBody.builder() - .folder_token("fldcnqquW1svRIYVT2Np6IuLCKd") - .title("undefined") - .build()) \ - .build() + # 构造请求对象 + request: CreateDocumentRequest = CreateDocumentRequest.builder() \ + .request_body(CreateDocumentRequestBody.builder() + .folder_token("fldcnqquW1svRIYVT2Np6IuLCKd") + .title("undefined") + .build()) \ + .build() - # 发起请求 - response: CreateDocumentResponse = client.docx.v1.document.create(request) + # 发起请求 + response: CreateDocumentResponse = client.docx.v1.document.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDocumentRequest = CreateDocumentRequest.builder() \ - .request_body(CreateDocumentRequestBody.builder() - .folder_token("fldcnqquW1svRIYVT2Np6IuLCKd") - .title("undefined") - .build()) \ - .build() + # 构造请求对象 + request: CreateDocumentRequest = CreateDocumentRequest.builder() \ + .request_body(CreateDocumentRequestBody.builder() + .folder_token("fldcnqquW1svRIYVT2Np6IuLCKd") + .title("undefined") + .build()) \ + .build() - # 发起请求 - response: CreateDocumentResponse = await client.docx.v1.document.acreate(request) + # 发起请求 + response: CreateDocumentResponse = await client.docx.v1.document.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/get_document_block_children_sample.py b/samples/api/docx/v1/get_document_block_children_sample.py index e5ea51ff9..07a053935 100644 --- a/samples/api/docx/v1/get_document_block_children_sample.py +++ b/samples/api/docx/v1/get_document_block_children_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentBlockChildrenRequest = GetDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .page_token( - "aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ - .page_size(500) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetDocumentBlockChildrenRequest = GetDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .page_token("aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ + .page_size(500) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetDocumentBlockChildrenResponse = client.docx.v1.document_block_children.get(request) + # 发起请求 + response: GetDocumentBlockChildrenResponse = client.docx.v1.document_block_children.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentBlockChildrenRequest = GetDocumentBlockChildrenRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .page_token( - "aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ - .page_size(500) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetDocumentBlockChildrenRequest = GetDocumentBlockChildrenRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .page_token("aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ + .page_size(500) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.aget(request) + # 发起请求 + response: GetDocumentBlockChildrenResponse = await client.docx.v1.document_block_children.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block_children.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block_children.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/get_document_block_sample.py b/samples/api/docx/v1/get_document_block_sample.py index 5a7a94536..1b239a03b 100644 --- a/samples/api/docx/v1/get_document_block_sample.py +++ b/samples/api/docx/v1/get_document_block_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentBlockRequest = GetDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetDocumentBlockRequest = GetDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetDocumentBlockResponse = client.docx.v1.document_block.get(request) + # 发起请求 + response: GetDocumentBlockResponse = client.docx.v1.document_block.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentBlockRequest = GetDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetDocumentBlockRequest = GetDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetDocumentBlockResponse = await client.docx.v1.document_block.aget(request) + # 发起请求 + response: GetDocumentBlockResponse = await client.docx.v1.document_block.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/get_document_sample.py b/samples/api/docx/v1/get_document_sample.py index 3606eb9c8..246731a01 100644 --- a/samples/api/docx/v1/get_document_sample.py +++ b/samples/api/docx/v1/get_document_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentRequest = GetDocumentRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .build() + # 构造请求对象 + request: GetDocumentRequest = GetDocumentRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .build() - # 发起请求 - response: GetDocumentResponse = client.docx.v1.document.get(request) + # 发起请求 + response: GetDocumentResponse = client.docx.v1.document.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDocumentRequest = GetDocumentRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .build() + # 构造请求对象 + request: GetDocumentRequest = GetDocumentRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .build() - # 发起请求 - response: GetDocumentResponse = await client.docx.v1.document.aget(request) + # 发起请求 + response: GetDocumentResponse = await client.docx.v1.document.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/list_document_block_sample.py b/samples/api/docx/v1/list_document_block_sample.py index 2d7eca9af..07387a762 100644 --- a/samples/api/docx/v1/list_document_block_sample.py +++ b/samples/api/docx/v1/list_document_block_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDocumentBlockRequest = ListDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .page_size(500) \ - .page_token( - "aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ - .document_revision_id(-1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListDocumentBlockRequest = ListDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .page_size(500) \ + .page_token("aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ + .document_revision_id(-1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListDocumentBlockResponse = client.docx.v1.document_block.list(request) + # 发起请求 + response: ListDocumentBlockResponse = client.docx.v1.document_block.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDocumentBlockRequest = ListDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .page_size(500) \ - .page_token( - "aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ - .document_revision_id(-1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListDocumentBlockRequest = ListDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .page_size(500) \ + .page_token("aw7DoMKBFMOGwqHCrcO8w6jCmMOvw6ILeADCvsKNw57Di8O5XGV3LG4_w5HCqhFxSnDCrCzCn0BgZcOYUg85EMOYcEAcwqYOw4ojw5QFwofCu8KoIMO3K8Ktw4IuNMOBBHNYw4bCgCV3U1zDu8K-J8KSR8Kgw7Y0fsKZdsKvW3d9w53DnkHDrcO5bDkYwrvDisOEPcOtVFJ-I03CnsOILMOoAmLDknd6dsKqG1bClAjDuS3CvcOTwo7Dg8OrwovDsRdqIcKxw5HDohTDtXN9w5rCkWo") \ + .document_revision_id(-1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListDocumentBlockResponse = await client.docx.v1.document_block.alist(request) + # 发起请求 + response: ListDocumentBlockResponse = await client.docx.v1.document_block.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/patch_document_block_sample.py b/samples/api/docx/v1/patch_document_block_sample.py index 2213366da..4f6a60963 100644 --- a/samples/api/docx/v1/patch_document_block_sample.py +++ b/samples/api/docx/v1/patch_document_block_sample.py @@ -5,102 +5,102 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDocumentBlockRequest = PatchDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ - .user_id_type("user_id") \ - .request_body(UpdateBlockRequest.builder() - .update_text_elements(UpdateTextElementsRequest.builder().build()) - .update_text_style(UpdateTextStyleRequest.builder().build()) - .update_table_property(UpdateTablePropertyRequest.builder().build()) - .insert_table_row(InsertTableRowRequest.builder().build()) - .insert_table_column(InsertTableColumnRequest.builder().build()) - .delete_table_rows(DeleteTableRowsRequest.builder().build()) - .delete_table_columns(DeleteTableColumnsRequest.builder().build()) - .merge_table_cells(MergeTableCellsRequest.builder().build()) - .unmerge_table_cells(UnmergeTableCellsRequest.builder().build()) - .insert_grid_column(InsertGridColumnRequest.builder().build()) - .delete_grid_column(DeleteGridColumnRequest.builder().build()) - .update_grid_column_width_ratio(UpdateGridColumnWidthRatioRequest.builder().build()) - .replace_image(ReplaceImageRequest.builder().build()) - .replace_file(ReplaceFileRequest.builder().build()) - .update_text(UpdateTextRequest.builder().build()) - .update_task(UpdateTaskRequest.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchDocumentBlockRequest = PatchDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ + .user_id_type("user_id") \ + .request_body(UpdateBlockRequest.builder() + .update_text_elements(UpdateTextElementsRequest.builder().build()) + .update_text_style(UpdateTextStyleRequest.builder().build()) + .update_table_property(UpdateTablePropertyRequest.builder().build()) + .insert_table_row(InsertTableRowRequest.builder().build()) + .insert_table_column(InsertTableColumnRequest.builder().build()) + .delete_table_rows(DeleteTableRowsRequest.builder().build()) + .delete_table_columns(DeleteTableColumnsRequest.builder().build()) + .merge_table_cells(MergeTableCellsRequest.builder().build()) + .unmerge_table_cells(UnmergeTableCellsRequest.builder().build()) + .insert_grid_column(InsertGridColumnRequest.builder().build()) + .delete_grid_column(DeleteGridColumnRequest.builder().build()) + .update_grid_column_width_ratio(UpdateGridColumnWidthRatioRequest.builder().build()) + .replace_image(ReplaceImageRequest.builder().build()) + .replace_file(ReplaceFileRequest.builder().build()) + .update_text(UpdateTextRequest.builder().build()) + .update_task(UpdateTaskRequest.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchDocumentBlockResponse = client.docx.v1.document_block.patch(request) + # 发起请求 + response: PatchDocumentBlockResponse = client.docx.v1.document_block.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDocumentBlockRequest = PatchDocumentBlockRequest.builder() \ - .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ - .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ - .document_revision_id(-1) \ - .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ - .user_id_type("user_id") \ - .request_body(UpdateBlockRequest.builder() - .update_text_elements(UpdateTextElementsRequest.builder().build()) - .update_text_style(UpdateTextStyleRequest.builder().build()) - .update_table_property(UpdateTablePropertyRequest.builder().build()) - .insert_table_row(InsertTableRowRequest.builder().build()) - .insert_table_column(InsertTableColumnRequest.builder().build()) - .delete_table_rows(DeleteTableRowsRequest.builder().build()) - .delete_table_columns(DeleteTableColumnsRequest.builder().build()) - .merge_table_cells(MergeTableCellsRequest.builder().build()) - .unmerge_table_cells(UnmergeTableCellsRequest.builder().build()) - .insert_grid_column(InsertGridColumnRequest.builder().build()) - .delete_grid_column(DeleteGridColumnRequest.builder().build()) - .update_grid_column_width_ratio(UpdateGridColumnWidthRatioRequest.builder().build()) - .replace_image(ReplaceImageRequest.builder().build()) - .replace_file(ReplaceFileRequest.builder().build()) - .update_text(UpdateTextRequest.builder().build()) - .update_task(UpdateTaskRequest.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchDocumentBlockRequest = PatchDocumentBlockRequest.builder() \ + .document_id("doxcnePuYufKa49ISjhD8Ih0ikh") \ + .block_id("doxcnO6UW6wAw2qIcYf4hZpFIth") \ + .document_revision_id(-1) \ + .client_token("0e2633a3-aa1a-4171-af9e-0768ff863566") \ + .user_id_type("user_id") \ + .request_body(UpdateBlockRequest.builder() + .update_text_elements(UpdateTextElementsRequest.builder().build()) + .update_text_style(UpdateTextStyleRequest.builder().build()) + .update_table_property(UpdateTablePropertyRequest.builder().build()) + .insert_table_row(InsertTableRowRequest.builder().build()) + .insert_table_column(InsertTableColumnRequest.builder().build()) + .delete_table_rows(DeleteTableRowsRequest.builder().build()) + .delete_table_columns(DeleteTableColumnsRequest.builder().build()) + .merge_table_cells(MergeTableCellsRequest.builder().build()) + .unmerge_table_cells(UnmergeTableCellsRequest.builder().build()) + .insert_grid_column(InsertGridColumnRequest.builder().build()) + .delete_grid_column(DeleteGridColumnRequest.builder().build()) + .update_grid_column_width_ratio(UpdateGridColumnWidthRatioRequest.builder().build()) + .replace_image(ReplaceImageRequest.builder().build()) + .replace_file(ReplaceFileRequest.builder().build()) + .update_text(UpdateTextRequest.builder().build()) + .update_task(UpdateTaskRequest.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchDocumentBlockResponse = await client.docx.v1.document_block.apatch(request) + # 发起请求 + response: PatchDocumentBlockResponse = await client.docx.v1.document_block.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document_block.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document_block.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/docx/v1/raw_content_document_sample.py b/samples/api/docx/v1/raw_content_document_sample.py index 257df42a8..010533be8 100644 --- a/samples/api/docx/v1/raw_content_document_sample.py +++ b/samples/api/docx/v1/raw_content_document_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RawContentDocumentRequest = RawContentDocumentRequest.builder() \ - .document_id("doxbcmEtbFrbbq10nPNu8gO1F3b") \ - .lang(0) \ - .build() + # 构造请求对象 + request: RawContentDocumentRequest = RawContentDocumentRequest.builder() \ + .document_id("doxbcmEtbFrbbq10nPNu8gO1F3b") \ + .lang(0) \ + .build() - # 发起请求 - response: RawContentDocumentResponse = client.docx.v1.document.raw_content(request) + # 发起请求 + response: RawContentDocumentResponse = client.docx.v1.document.raw_content(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.raw_content failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.raw_content failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RawContentDocumentRequest = RawContentDocumentRequest.builder() \ - .document_id("doxbcmEtbFrbbq10nPNu8gO1F3b") \ - .lang(0) \ - .build() + # 构造请求对象 + request: RawContentDocumentRequest = RawContentDocumentRequest.builder() \ + .document_id("doxbcmEtbFrbbq10nPNu8gO1F3b") \ + .lang(0) \ + .build() - # 发起请求 - response: RawContentDocumentResponse = await client.docx.v1.document.araw_content(request) + # 发起请求 + response: RawContentDocumentResponse = await client.docx.v1.document.araw_content(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.docx.v1.document.araw_content failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.docx.v1.document.araw_content failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/auth_permission_member_sample.py b/samples/api/drive/v1/auth_permission_member_sample.py index 3012c5fcf..bedbde7b6 100644 --- a/samples/api/drive/v1/auth_permission_member_sample.py +++ b/samples/api/drive/v1/auth_permission_member_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AuthPermissionMemberRequest = AuthPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .action("view") \ - .build() + # 构造请求对象 + request: AuthPermissionMemberRequest = AuthPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .action("view") \ + .build() - # 发起请求 - response: AuthPermissionMemberResponse = client.drive.v1.permission_member.auth(request) + # 发起请求 + response: AuthPermissionMemberResponse = client.drive.v1.permission_member.auth(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.auth failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.auth failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AuthPermissionMemberRequest = AuthPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .action("view") \ - .build() + # 构造请求对象 + request: AuthPermissionMemberRequest = AuthPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .action("view") \ + .build() - # 发起请求 - response: AuthPermissionMemberResponse = await client.drive.v1.permission_member.aauth(request) + # 发起请求 + response: AuthPermissionMemberResponse = await client.drive.v1.permission_member.aauth(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.aauth failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.aauth failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/batch_create_permission_member_sample.py b/samples/api/drive/v1/batch_create_permission_member_sample.py index 38b71d262..9d106cf96 100644 --- a/samples/api/drive/v1/batch_create_permission_member_sample.py +++ b/samples/api/drive/v1/batch_create_permission_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreatePermissionMemberRequest = BatchCreatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(False) \ - .request_body(BatchCreatePermissionMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreatePermissionMemberRequest = BatchCreatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(False) \ + .request_body(BatchCreatePermissionMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreatePermissionMemberResponse = client.drive.v1.permission_member.batch_create(request) + # 发起请求 + response: BatchCreatePermissionMemberResponse = client.drive.v1.permission_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreatePermissionMemberRequest = BatchCreatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(False) \ - .request_body(BatchCreatePermissionMemberRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreatePermissionMemberRequest = BatchCreatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(False) \ + .request_body(BatchCreatePermissionMemberRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreatePermissionMemberResponse = await client.drive.v1.permission_member.abatch_create(request) + # 发起请求 + response: BatchCreatePermissionMemberResponse = await client.drive.v1.permission_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/batch_get_tmp_download_url_media_sample.py b/samples/api/drive/v1/batch_get_tmp_download_url_media_sample.py index 7b6168dfe..730868d2b 100644 --- a/samples/api/drive/v1/batch_get_tmp_download_url_media_sample.py +++ b/samples/api/drive/v1/batch_get_tmp_download_url_media_sample.py @@ -5,62 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetTmpDownloadUrlMediaRequest = BatchGetTmpDownloadUrlMediaRequest.builder() \ - .file_tokens([]) \ - .extra( - "[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ - .build() + # 构造请求对象 + request: BatchGetTmpDownloadUrlMediaRequest = BatchGetTmpDownloadUrlMediaRequest.builder() \ + .file_tokens([]) \ + .extra("[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ + .build() - # 发起请求 - response: BatchGetTmpDownloadUrlMediaResponse = client.drive.v1.media.batch_get_tmp_download_url(request) + # 发起请求 + response: BatchGetTmpDownloadUrlMediaResponse = client.drive.v1.media.batch_get_tmp_download_url(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.batch_get_tmp_download_url failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.batch_get_tmp_download_url failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetTmpDownloadUrlMediaRequest = BatchGetTmpDownloadUrlMediaRequest.builder() \ - .file_tokens([]) \ - .extra( - "[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ - .build() + # 构造请求对象 + request: BatchGetTmpDownloadUrlMediaRequest = BatchGetTmpDownloadUrlMediaRequest.builder() \ + .file_tokens([]) \ + .extra("[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ + .build() - # 发起请求 - response: BatchGetTmpDownloadUrlMediaResponse = await client.drive.v1.media.abatch_get_tmp_download_url(request) + # 发起请求 + response: BatchGetTmpDownloadUrlMediaResponse = await client.drive.v1.media.abatch_get_tmp_download_url(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.abatch_get_tmp_download_url failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.abatch_get_tmp_download_url failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/batch_query_file_comment_sample.py b/samples/api/drive/v1/batch_query_file_comment_sample.py index a739a2f0d..6fd973b26 100644 --- a/samples/api/drive/v1/batch_query_file_comment_sample.py +++ b/samples/api/drive/v1/batch_query_file_comment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchQueryFileCommentRequest = BatchQueryFileCommentRequest.builder() \ - .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ - .file_type("doc;docx;sheet;file") \ - .user_id_type("user_id") \ - .request_body(BatchQueryFileCommentRequestBody.builder() - .comment_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchQueryFileCommentRequest = BatchQueryFileCommentRequest.builder() \ + .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ + .file_type("doc;docx;sheet;file") \ + .user_id_type("user_id") \ + .request_body(BatchQueryFileCommentRequestBody.builder() + .comment_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchQueryFileCommentResponse = client.drive.v1.file_comment.batch_query(request) + # 发起请求 + response: BatchQueryFileCommentResponse = client.drive.v1.file_comment.batch_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.batch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.batch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchQueryFileCommentRequest = BatchQueryFileCommentRequest.builder() \ - .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ - .file_type("doc;docx;sheet;file") \ - .user_id_type("user_id") \ - .request_body(BatchQueryFileCommentRequestBody.builder() - .comment_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchQueryFileCommentRequest = BatchQueryFileCommentRequest.builder() \ + .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ + .file_type("doc;docx;sheet;file") \ + .user_id_type("user_id") \ + .request_body(BatchQueryFileCommentRequestBody.builder() + .comment_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchQueryFileCommentResponse = await client.drive.v1.file_comment.abatch_query(request) + # 发起请求 + response: BatchQueryFileCommentResponse = await client.drive.v1.file_comment.abatch_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.abatch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.abatch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/batch_query_meta_sample.py b/samples/api/drive/v1/batch_query_meta_sample.py index 86d3481ac..2380dd75d 100644 --- a/samples/api/drive/v1/batch_query_meta_sample.py +++ b/samples/api/drive/v1/batch_query_meta_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchQueryMetaRequest = BatchQueryMetaRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MetaRequest.builder() - .request_docs([]) - .with_url(bool) - .build()) \ - .build() + # 构造请求对象 + request: BatchQueryMetaRequest = BatchQueryMetaRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MetaRequest.builder() + .request_docs([]) + .with_url(bool) + .build()) \ + .build() - # 发起请求 - response: BatchQueryMetaResponse = client.drive.v1.meta.batch_query(request) + # 发起请求 + response: BatchQueryMetaResponse = client.drive.v1.meta.batch_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.meta.batch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.meta.batch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchQueryMetaRequest = BatchQueryMetaRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MetaRequest.builder() - .request_docs([]) - .with_url(bool) - .build()) \ - .build() + # 构造请求对象 + request: BatchQueryMetaRequest = BatchQueryMetaRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MetaRequest.builder() + .request_docs([]) + .with_url(bool) + .build()) \ + .build() - # 发起请求 - response: BatchQueryMetaResponse = await client.drive.v1.meta.abatch_query(request) + # 发起请求 + response: BatchQueryMetaResponse = await client.drive.v1.meta.abatch_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.meta.abatch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.meta.abatch_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/copy_file_sample.py b/samples/api/drive/v1/copy_file_sample.py index eb22a6d08..700a983d2 100644 --- a/samples/api/drive/v1/copy_file_sample.py +++ b/samples/api/drive/v1/copy_file_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyFileRequest = CopyFileRequest.builder() \ - .file_token("doccngpahSdXrFPIBD4XdIabcef") \ - .user_id_type("user_id") \ - .request_body(CopyFileRequestBody.builder() - .name("test.txt") - .type("doc") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .extra([]) - .build()) \ - .build() + # 构造请求对象 + request: CopyFileRequest = CopyFileRequest.builder() \ + .file_token("doccngpahSdXrFPIBD4XdIabcef") \ + .user_id_type("user_id") \ + .request_body(CopyFileRequestBody.builder() + .name("test.txt") + .type("doc") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .extra([]) + .build()) \ + .build() - # 发起请求 - response: CopyFileResponse = client.drive.v1.file.copy(request) + # 发起请求 + response: CopyFileResponse = client.drive.v1.file.copy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopyFileRequest = CopyFileRequest.builder() \ - .file_token("doccngpahSdXrFPIBD4XdIabcef") \ - .user_id_type("user_id") \ - .request_body(CopyFileRequestBody.builder() - .name("test.txt") - .type("doc") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .extra([]) - .build()) \ - .build() + # 构造请求对象 + request: CopyFileRequest = CopyFileRequest.builder() \ + .file_token("doccngpahSdXrFPIBD4XdIabcef") \ + .user_id_type("user_id") \ + .request_body(CopyFileRequestBody.builder() + .name("test.txt") + .type("doc") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .extra([]) + .build()) \ + .build() - # 发起请求 - response: CopyFileResponse = await client.drive.v1.file.acopy(request) + # 发起请求 + response: CopyFileResponse = await client.drive.v1.file.acopy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_export_task_sample.py b/samples/api/drive/v1/create_export_task_sample.py index 57619e8cd..9c3d89f98 100644 --- a/samples/api/drive/v1/create_export_task_sample.py +++ b/samples/api/drive/v1/create_export_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExportTaskRequest = CreateExportTaskRequest.builder() \ - .request_body(ExportTask.builder() - .file_extension("pdf") - .token("doccnxe5OxxxxxxxSNdsJviENsk") - .type("doc") - .sub_id("tblKz5D60T4JlfcT") - .build()) \ - .build() + # 构造请求对象 + request: CreateExportTaskRequest = CreateExportTaskRequest.builder() \ + .request_body(ExportTask.builder() + .file_extension("pdf") + .token("doccnxe5OxxxxxxxSNdsJviENsk") + .type("doc") + .sub_id("tblKz5D60T4JlfcT") + .build()) \ + .build() - # 发起请求 - response: CreateExportTaskResponse = client.drive.v1.export_task.create(request) + # 发起请求 + response: CreateExportTaskResponse = client.drive.v1.export_task.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExportTaskRequest = CreateExportTaskRequest.builder() \ - .request_body(ExportTask.builder() - .file_extension("pdf") - .token("doccnxe5OxxxxxxxSNdsJviENsk") - .type("doc") - .sub_id("tblKz5D60T4JlfcT") - .build()) \ - .build() + # 构造请求对象 + request: CreateExportTaskRequest = CreateExportTaskRequest.builder() \ + .request_body(ExportTask.builder() + .file_extension("pdf") + .token("doccnxe5OxxxxxxxSNdsJviENsk") + .type("doc") + .sub_id("tblKz5D60T4JlfcT") + .build()) \ + .build() - # 发起请求 - response: CreateExportTaskResponse = await client.drive.v1.export_task.acreate(request) + # 发起请求 + response: CreateExportTaskResponse = await client.drive.v1.export_task.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_file_comment_sample.py b/samples/api/drive/v1/create_file_comment_sample.py index f79d19127..93005f2ea 100644 --- a/samples/api/drive/v1/create_file_comment_sample.py +++ b/samples/api/drive/v1/create_file_comment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileCommentRequest = CreateFileCommentRequest.builder() \ - .file_token("doccnGp4UK1UskrOEJwBXd3****") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .request_body(FileComment.builder() - .reply_list(ReplyList.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateFileCommentRequest = CreateFileCommentRequest.builder() \ + .file_token("doccnGp4UK1UskrOEJwBXd3****") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .request_body(FileComment.builder() + .reply_list(ReplyList.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateFileCommentResponse = client.drive.v1.file_comment.create(request) + # 发起请求 + response: CreateFileCommentResponse = client.drive.v1.file_comment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileCommentRequest = CreateFileCommentRequest.builder() \ - .file_token("doccnGp4UK1UskrOEJwBXd3****") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .request_body(FileComment.builder() - .reply_list(ReplyList.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateFileCommentRequest = CreateFileCommentRequest.builder() \ + .file_token("doccnGp4UK1UskrOEJwBXd3****") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .request_body(FileComment.builder() + .reply_list(ReplyList.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateFileCommentResponse = await client.drive.v1.file_comment.acreate(request) + # 发起请求 + response: CreateFileCommentResponse = await client.drive.v1.file_comment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_file_subscription_sample.py b/samples/api/drive/v1/create_file_subscription_sample.py index ea9e5bee9..274477ea5 100644 --- a/samples/api/drive/v1/create_file_subscription_sample.py +++ b/samples/api/drive/v1/create_file_subscription_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileSubscriptionRequest = CreateFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .request_body(FileSubscription.builder() - .subscription_id("1234567890987654321") - .subscription_type("comment_update") - .is_subcribe(True) - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: CreateFileSubscriptionRequest = CreateFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .request_body(FileSubscription.builder() + .subscription_id("1234567890987654321") + .subscription_type("comment_update") + .is_subcribe(True) + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: CreateFileSubscriptionResponse = client.drive.v1.file_subscription.create(request) + # 发起请求 + response: CreateFileSubscriptionResponse = client.drive.v1.file_subscription.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileSubscriptionRequest = CreateFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .request_body(FileSubscription.builder() - .subscription_id("1234567890987654321") - .subscription_type("comment_update") - .is_subcribe(True) - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: CreateFileSubscriptionRequest = CreateFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .request_body(FileSubscription.builder() + .subscription_id("1234567890987654321") + .subscription_type("comment_update") + .is_subcribe(True) + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: CreateFileSubscriptionResponse = await client.drive.v1.file_subscription.acreate(request) + # 发起请求 + response: CreateFileSubscriptionResponse = await client.drive.v1.file_subscription.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_file_version_sample.py b/samples/api/drive/v1/create_file_version_sample.py index a12fa8a0a..8ae2027b5 100644 --- a/samples/api/drive/v1/create_file_version_sample.py +++ b/samples/api/drive/v1/create_file_version_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileVersionRequest = CreateFileVersionRequest.builder() \ - .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ - .user_id_type("user_id") \ - .request_body(Version.builder() - .name("文档标题") - .obj_type("docx") - .build()) \ - .build() + # 构造请求对象 + request: CreateFileVersionRequest = CreateFileVersionRequest.builder() \ + .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ + .user_id_type("user_id") \ + .request_body(Version.builder() + .name("文档标题") + .obj_type("docx") + .build()) \ + .build() - # 发起请求 - response: CreateFileVersionResponse = client.drive.v1.file_version.create(request) + # 发起请求 + response: CreateFileVersionResponse = client.drive.v1.file_version.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFileVersionRequest = CreateFileVersionRequest.builder() \ - .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ - .user_id_type("user_id") \ - .request_body(Version.builder() - .name("文档标题") - .obj_type("docx") - .build()) \ - .build() + # 构造请求对象 + request: CreateFileVersionRequest = CreateFileVersionRequest.builder() \ + .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ + .user_id_type("user_id") \ + .request_body(Version.builder() + .name("文档标题") + .obj_type("docx") + .build()) \ + .build() - # 发起请求 - response: CreateFileVersionResponse = await client.drive.v1.file_version.acreate(request) + # 发起请求 + response: CreateFileVersionResponse = await client.drive.v1.file_version.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_folder_file_sample.py b/samples/api/drive/v1/create_folder_file_sample.py index db7e6d429..22001c38f 100644 --- a/samples/api/drive/v1/create_folder_file_sample.py +++ b/samples/api/drive/v1/create_folder_file_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFolderFileRequest = CreateFolderFileRequest.builder() \ - .request_body(CreateFolderFileRequestBody.builder() - .name("New Folder") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .build()) \ - .build() + # 构造请求对象 + request: CreateFolderFileRequest = CreateFolderFileRequest.builder() \ + .request_body(CreateFolderFileRequestBody.builder() + .name("New Folder") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .build()) \ + .build() - # 发起请求 - response: CreateFolderFileResponse = client.drive.v1.file.create_folder(request) + # 发起请求 + response: CreateFolderFileResponse = client.drive.v1.file.create_folder(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.create_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.create_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFolderFileRequest = CreateFolderFileRequest.builder() \ - .request_body(CreateFolderFileRequestBody.builder() - .name("New Folder") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .build()) \ - .build() + # 构造请求对象 + request: CreateFolderFileRequest = CreateFolderFileRequest.builder() \ + .request_body(CreateFolderFileRequestBody.builder() + .name("New Folder") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .build()) \ + .build() - # 发起请求 - response: CreateFolderFileResponse = await client.drive.v1.file.acreate_folder(request) + # 发起请求 + response: CreateFolderFileResponse = await client.drive.v1.file.acreate_folder(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.acreate_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.acreate_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_import_task_sample.py b/samples/api/drive/v1/create_import_task_sample.py index e94657969..e628cbf6b 100644 --- a/samples/api/drive/v1/create_import_task_sample.py +++ b/samples/api/drive/v1/create_import_task_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateImportTaskRequest = CreateImportTaskRequest.builder() \ - .request_body(ImportTask.builder() - .file_extension("txt") - .file_token("boxbcHgfxdfxxxxxxxxxxxfMky") - .type("docx") - .file_name("文件名") - .point(ImportTaskMountPoint.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateImportTaskRequest = CreateImportTaskRequest.builder() \ + .request_body(ImportTask.builder() + .file_extension("txt") + .file_token("boxbcHgfxdfxxxxxxxxxxxfMky") + .type("docx") + .file_name("文件名") + .point(ImportTaskMountPoint.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateImportTaskResponse = client.drive.v1.import_task.create(request) + # 发起请求 + response: CreateImportTaskResponse = client.drive.v1.import_task.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.import_task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.import_task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateImportTaskRequest = CreateImportTaskRequest.builder() \ - .request_body(ImportTask.builder() - .file_extension("txt") - .file_token("boxbcHgfxdfxxxxxxxxxxxfMky") - .type("docx") - .file_name("文件名") - .point(ImportTaskMountPoint.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateImportTaskRequest = CreateImportTaskRequest.builder() \ + .request_body(ImportTask.builder() + .file_extension("txt") + .file_token("boxbcHgfxdfxxxxxxxxxxxfMky") + .type("docx") + .file_name("文件名") + .point(ImportTaskMountPoint.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateImportTaskResponse = await client.drive.v1.import_task.acreate(request) + # 发起请求 + response: CreateImportTaskResponse = await client.drive.v1.import_task.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.import_task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.import_task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_permission_member_sample.py b/samples/api/drive/v1/create_permission_member_sample.py index ab52bb26d..7d57ea7fc 100644 --- a/samples/api/drive/v1/create_permission_member_sample.py +++ b/samples/api/drive/v1/create_permission_member_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePermissionMemberRequest = CreatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(False) \ - .request_body(BaseMember.builder() - .member_type("openid") - .member_id("string") - .perm("view") - .perm_type("container") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: CreatePermissionMemberRequest = CreatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(False) \ + .request_body(BaseMember.builder() + .member_type("openid") + .member_id("string") + .perm("view") + .perm_type("container") + .type("user") + .build()) \ + .build() - # 发起请求 - response: CreatePermissionMemberResponse = client.drive.v1.permission_member.create(request) + # 发起请求 + response: CreatePermissionMemberResponse = client.drive.v1.permission_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePermissionMemberRequest = CreatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(False) \ - .request_body(BaseMember.builder() - .member_type("openid") - .member_id("string") - .perm("view") - .perm_type("container") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: CreatePermissionMemberRequest = CreatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(False) \ + .request_body(BaseMember.builder() + .member_type("openid") + .member_id("string") + .perm("view") + .perm_type("container") + .type("user") + .build()) \ + .build() - # 发起请求 - response: CreatePermissionMemberResponse = await client.drive.v1.permission_member.acreate(request) + # 发起请求 + response: CreatePermissionMemberResponse = await client.drive.v1.permission_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_permission_public_password_sample.py b/samples/api/drive/v1/create_permission_public_password_sample.py index 4224bcbb7..2491d824c 100644 --- a/samples/api/drive/v1/create_permission_public_password_sample.py +++ b/samples/api/drive/v1/create_permission_public_password_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePermissionPublicPasswordRequest = CreatePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: CreatePermissionPublicPasswordRequest = CreatePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: CreatePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.create(request) + # 发起请求 + response: CreatePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePermissionPublicPasswordRequest = CreatePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: CreatePermissionPublicPasswordRequest = CreatePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: CreatePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.acreate(request) + # 发起请求 + response: CreatePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/create_shortcut_file_sample.py b/samples/api/drive/v1/create_shortcut_file_sample.py index c0b45c1fa..5021ccf49 100644 --- a/samples/api/drive/v1/create_shortcut_file_sample.py +++ b/samples/api/drive/v1/create_shortcut_file_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateShortcutFileRequest = CreateShortcutFileRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateShortcutFileRequestBody.builder() - .parent_token("fldbc5qgwyQnO0uedNllWuF3fAd") - .refer_entity(ReferEntity.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateShortcutFileRequest = CreateShortcutFileRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateShortcutFileRequestBody.builder() + .parent_token("fldbc5qgwyQnO0uedNllWuF3fAd") + .refer_entity(ReferEntity.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateShortcutFileResponse = client.drive.v1.file.create_shortcut(request) + # 发起请求 + response: CreateShortcutFileResponse = client.drive.v1.file.create_shortcut(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.create_shortcut failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.create_shortcut failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateShortcutFileRequest = CreateShortcutFileRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateShortcutFileRequestBody.builder() - .parent_token("fldbc5qgwyQnO0uedNllWuF3fAd") - .refer_entity(ReferEntity.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateShortcutFileRequest = CreateShortcutFileRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateShortcutFileRequestBody.builder() + .parent_token("fldbc5qgwyQnO0uedNllWuF3fAd") + .refer_entity(ReferEntity.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateShortcutFileResponse = await client.drive.v1.file.acreate_shortcut(request) + # 发起请求 + response: CreateShortcutFileResponse = await client.drive.v1.file.acreate_shortcut(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.acreate_shortcut failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.acreate_shortcut failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_file_comment_reply_sample.py b/samples/api/drive/v1/delete_file_comment_reply_sample.py index c32719892..3aee9236f 100644 --- a/samples/api/drive/v1/delete_file_comment_reply_sample.py +++ b/samples/api/drive/v1/delete_file_comment_reply_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileCommentReplyRequest = DeleteFileCommentReplyRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .reply_id("6916106822734594568") \ - .file_type("doc") \ - .build() + # 构造请求对象 + request: DeleteFileCommentReplyRequest = DeleteFileCommentReplyRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .reply_id("6916106822734594568") \ + .file_type("doc") \ + .build() - # 发起请求 - response: DeleteFileCommentReplyResponse = client.drive.v1.file_comment_reply.delete(request) + # 发起请求 + response: DeleteFileCommentReplyResponse = client.drive.v1.file_comment_reply.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileCommentReplyRequest = DeleteFileCommentReplyRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .reply_id("6916106822734594568") \ - .file_type("doc") \ - .build() + # 构造请求对象 + request: DeleteFileCommentReplyRequest = DeleteFileCommentReplyRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .reply_id("6916106822734594568") \ + .file_type("doc") \ + .build() - # 发起请求 - response: DeleteFileCommentReplyResponse = await client.drive.v1.file_comment_reply.adelete(request) + # 发起请求 + response: DeleteFileCommentReplyResponse = await client.drive.v1.file_comment_reply.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_file_sample.py b/samples/api/drive/v1/delete_file_sample.py index be01e3a79..af7efb059 100644 --- a/samples/api/drive/v1/delete_file_sample.py +++ b/samples/api/drive/v1/delete_file_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileRequest = DeleteFileRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .type("file") \ - .build() + # 构造请求对象 + request: DeleteFileRequest = DeleteFileRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .type("file") \ + .build() - # 发起请求 - response: DeleteFileResponse = client.drive.v1.file.delete(request) + # 发起请求 + response: DeleteFileResponse = client.drive.v1.file.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileRequest = DeleteFileRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .type("file") \ - .build() + # 构造请求对象 + request: DeleteFileRequest = DeleteFileRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .type("file") \ + .build() - # 发起请求 - response: DeleteFileResponse = await client.drive.v1.file.adelete(request) + # 发起请求 + response: DeleteFileResponse = await client.drive.v1.file.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_file_version_sample.py b/samples/api/drive/v1/delete_file_version_sample.py index 23226c7e1..a73b2ab98 100644 --- a/samples/api/drive/v1/delete_file_version_sample.py +++ b/samples/api/drive/v1/delete_file_version_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileVersionRequest = DeleteFileVersionRequest.builder() \ - .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ - .version_id("file_version") \ - .obj_type("doc/docs/sheet/bitable") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: DeleteFileVersionRequest = DeleteFileVersionRequest.builder() \ + .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ + .version_id("file_version") \ + .obj_type("doc/docs/sheet/bitable") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: DeleteFileVersionResponse = client.drive.v1.file_version.delete(request) + # 发起请求 + response: DeleteFileVersionResponse = client.drive.v1.file_version.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFileVersionRequest = DeleteFileVersionRequest.builder() \ - .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ - .version_id("file_version") \ - .obj_type("doc/docs/sheet/bitable") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: DeleteFileVersionRequest = DeleteFileVersionRequest.builder() \ + .file_token("doxbcyvqZlSc9WlHvQMlSJwUrsb") \ + .version_id("file_version") \ + .obj_type("doc/docs/sheet/bitable") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: DeleteFileVersionResponse = await client.drive.v1.file_version.adelete(request) + # 发起请求 + response: DeleteFileVersionResponse = await client.drive.v1.file_version.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_permission_member_sample.py b/samples/api/drive/v1/delete_permission_member_sample.py index 89e34e21d..9ef0e47c3 100644 --- a/samples/api/drive/v1/delete_permission_member_sample.py +++ b/samples/api/drive/v1/delete_permission_member_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePermissionMemberRequest = DeletePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .type("doc") \ - .member_type("openid") \ - .request_body(DeletePermissionMemberRequestBody.builder() - .type("user") - .perm_type("container") - .build()) \ - .build() + # 构造请求对象 + request: DeletePermissionMemberRequest = DeletePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .type("doc") \ + .member_type("openid") \ + .request_body(DeletePermissionMemberRequestBody.builder() + .type("user") + .perm_type("container") + .build()) \ + .build() - # 发起请求 - response: DeletePermissionMemberResponse = client.drive.v1.permission_member.delete(request) + # 发起请求 + response: DeletePermissionMemberResponse = client.drive.v1.permission_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePermissionMemberRequest = DeletePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .type("doc") \ - .member_type("openid") \ - .request_body(DeletePermissionMemberRequestBody.builder() - .type("user") - .perm_type("container") - .build()) \ - .build() + # 构造请求对象 + request: DeletePermissionMemberRequest = DeletePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .type("doc") \ + .member_type("openid") \ + .request_body(DeletePermissionMemberRequestBody.builder() + .type("user") + .perm_type("container") + .build()) \ + .build() - # 发起请求 - response: DeletePermissionMemberResponse = await client.drive.v1.permission_member.adelete(request) + # 发起请求 + response: DeletePermissionMemberResponse = await client.drive.v1.permission_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_permission_public_password_sample.py b/samples/api/drive/v1/delete_permission_public_password_sample.py index c21863960..b4430d27c 100644 --- a/samples/api/drive/v1/delete_permission_public_password_sample.py +++ b/samples/api/drive/v1/delete_permission_public_password_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePermissionPublicPasswordRequest = DeletePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: DeletePermissionPublicPasswordRequest = DeletePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: DeletePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.delete(request) + # 发起请求 + response: DeletePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePermissionPublicPasswordRequest = DeletePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: DeletePermissionPublicPasswordRequest = DeletePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: DeletePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.adelete(request) + # 发起请求 + response: DeletePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/delete_subscribe_file_sample.py b/samples/api/drive/v1/delete_subscribe_file_sample.py index 9731279d4..4c6e1cd76 100644 --- a/samples/api/drive/v1/delete_subscribe_file_sample.py +++ b/samples/api/drive/v1/delete_subscribe_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSubscribeFileRequest = DeleteSubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("doc") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: DeleteSubscribeFileRequest = DeleteSubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("doc") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: DeleteSubscribeFileResponse = client.drive.v1.file.delete_subscribe(request) + # 发起请求 + response: DeleteSubscribeFileResponse = client.drive.v1.file.delete_subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.delete_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.delete_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSubscribeFileRequest = DeleteSubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("doc") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: DeleteSubscribeFileRequest = DeleteSubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("doc") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: DeleteSubscribeFileResponse = await client.drive.v1.file.adelete_subscribe(request) + # 发起请求 + response: DeleteSubscribeFileResponse = await client.drive.v1.file.adelete_subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.adelete_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.adelete_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/download_export_task_sample.py b/samples/api/drive/v1/download_export_task_sample.py index 9629c6006..57e79bd3e 100644 --- a/samples/api/drive/v1/download_export_task_sample.py +++ b/samples/api/drive/v1/download_export_task_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadExportTaskRequest = DownloadExportTaskRequest.builder() \ - .file_token("boxcnNAlfwHxxxxxxxxxxSaLSec") \ - .build() + # 构造请求对象 + request: DownloadExportTaskRequest = DownloadExportTaskRequest.builder() \ + .file_token("boxcnNAlfwHxxxxxxxxxxSaLSec") \ + .build() - # 发起请求 - response: DownloadExportTaskResponse = client.drive.v1.export_task.download(request) + # 发起请求 + response: DownloadExportTaskResponse = client.drive.v1.export_task.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadExportTaskRequest = DownloadExportTaskRequest.builder() \ - .file_token("boxcnNAlfwHxxxxxxxxxxSaLSec") \ - .build() + # 构造请求对象 + request: DownloadExportTaskRequest = DownloadExportTaskRequest.builder() \ + .file_token("boxcnNAlfwHxxxxxxxxxxSaLSec") \ + .build() - # 发起请求 - response: DownloadExportTaskResponse = await client.drive.v1.export_task.adownload(request) + # 发起请求 + response: DownloadExportTaskResponse = await client.drive.v1.export_task.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/download_file_sample.py b/samples/api/drive/v1/download_file_sample.py index 9466b1db2..72acbe179 100644 --- a/samples/api/drive/v1/download_file_sample.py +++ b/samples/api/drive/v1/download_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("boxcnabCdefg12345") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("boxcnabCdefg12345") \ + .build() - # 发起请求 - response: DownloadFileResponse = client.drive.v1.file.download(request) + # 发起请求 + response: DownloadFileResponse = client.drive.v1.file.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("boxcnabCdefg12345") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("boxcnabCdefg12345") \ + .build() - # 发起请求 - response: DownloadFileResponse = await client.drive.v1.file.adownload(request) + # 发起请求 + response: DownloadFileResponse = await client.drive.v1.file.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/download_media_sample.py b/samples/api/drive/v1/download_media_sample.py index 8687e30a5..64b85a02d 100644 --- a/samples/api/drive/v1/download_media_sample.py +++ b/samples/api/drive/v1/download_media_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadMediaRequest = DownloadMediaRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .extra( - "[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ - .build() + # 构造请求对象 + request: DownloadMediaRequest = DownloadMediaRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .extra("[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ + .build() - # 发起请求 - response: DownloadMediaResponse = client.drive.v1.media.download(request) + # 发起请求 + response: DownloadMediaResponse = client.drive.v1.media.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadMediaRequest = DownloadMediaRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .extra( - "[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ - .build() + # 构造请求对象 + request: DownloadMediaRequest = DownloadMediaRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .extra("[请参考-上传点类型及对应Extra说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)") \ + .build() - # 发起请求 - response: DownloadMediaResponse = await client.drive.v1.media.adownload(request) + # 发起请求 + response: DownloadMediaResponse = await client.drive.v1.media.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_export_task_sample.py b/samples/api/drive/v1/get_export_task_sample.py index b6cd00ee3..8e73e6d8a 100644 --- a/samples/api/drive/v1/get_export_task_sample.py +++ b/samples/api/drive/v1/get_export_task_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExportTaskRequest = GetExportTaskRequest.builder() \ - .ticket("6933093124755423251") \ - .token("doccnZVxxxxxxxxxxxxGiyBgYqe") \ - .build() + # 构造请求对象 + request: GetExportTaskRequest = GetExportTaskRequest.builder() \ + .ticket("6933093124755423251") \ + .token("doccnZVxxxxxxxxxxxxGiyBgYqe") \ + .build() - # 发起请求 - response: GetExportTaskResponse = client.drive.v1.export_task.get(request) + # 发起请求 + response: GetExportTaskResponse = client.drive.v1.export_task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExportTaskRequest = GetExportTaskRequest.builder() \ - .ticket("6933093124755423251") \ - .token("doccnZVxxxxxxxxxxxxGiyBgYqe") \ - .build() + # 构造请求对象 + request: GetExportTaskRequest = GetExportTaskRequest.builder() \ + .ticket("6933093124755423251") \ + .token("doccnZVxxxxxxxxxxxxGiyBgYqe") \ + .build() - # 发起请求 - response: GetExportTaskResponse = await client.drive.v1.export_task.aget(request) + # 发起请求 + response: GetExportTaskResponse = await client.drive.v1.export_task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.export_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.export_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_file_comment_sample.py b/samples/api/drive/v1/get_file_comment_sample.py index 4168c697e..cb05dff42 100644 --- a/samples/api/drive/v1/get_file_comment_sample.py +++ b/samples/api/drive/v1/get_file_comment_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileCommentRequest = GetFileCommentRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetFileCommentRequest = GetFileCommentRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetFileCommentResponse = client.drive.v1.file_comment.get(request) + # 发起请求 + response: GetFileCommentResponse = client.drive.v1.file_comment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileCommentRequest = GetFileCommentRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetFileCommentRequest = GetFileCommentRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetFileCommentResponse = await client.drive.v1.file_comment.aget(request) + # 发起请求 + response: GetFileCommentResponse = await client.drive.v1.file_comment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_file_statistics_sample.py b/samples/api/drive/v1/get_file_statistics_sample.py index 799a4a38f..1b805e9d8 100644 --- a/samples/api/drive/v1/get_file_statistics_sample.py +++ b/samples/api/drive/v1/get_file_statistics_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileStatisticsRequest = GetFileStatisticsRequest.builder() \ - .file_token("doccnfYZzTlvXqZIGTdAHKabcef") \ - .file_type("doc") \ - .build() + # 构造请求对象 + request: GetFileStatisticsRequest = GetFileStatisticsRequest.builder() \ + .file_token("doccnfYZzTlvXqZIGTdAHKabcef") \ + .file_type("doc") \ + .build() - # 发起请求 - response: GetFileStatisticsResponse = client.drive.v1.file_statistics.get(request) + # 发起请求 + response: GetFileStatisticsResponse = client.drive.v1.file_statistics.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_statistics.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_statistics.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileStatisticsRequest = GetFileStatisticsRequest.builder() \ - .file_token("doccnfYZzTlvXqZIGTdAHKabcef") \ - .file_type("doc") \ - .build() + # 构造请求对象 + request: GetFileStatisticsRequest = GetFileStatisticsRequest.builder() \ + .file_token("doccnfYZzTlvXqZIGTdAHKabcef") \ + .file_type("doc") \ + .build() - # 发起请求 - response: GetFileStatisticsResponse = await client.drive.v1.file_statistics.aget(request) + # 发起请求 + response: GetFileStatisticsResponse = await client.drive.v1.file_statistics.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_statistics.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_statistics.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_file_subscription_sample.py b/samples/api/drive/v1/get_file_subscription_sample.py index ee24acb5a..13e730d50 100644 --- a/samples/api/drive/v1/get_file_subscription_sample.py +++ b/samples/api/drive/v1/get_file_subscription_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileSubscriptionRequest = GetFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .subscription_id("1234567890987654321") \ - .request_body(GetFileSubscriptionRequestBody.builder() - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: GetFileSubscriptionRequest = GetFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .subscription_id("1234567890987654321") \ + .request_body(GetFileSubscriptionRequestBody.builder() + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: GetFileSubscriptionResponse = client.drive.v1.file_subscription.get(request) + # 发起请求 + response: GetFileSubscriptionResponse = client.drive.v1.file_subscription.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileSubscriptionRequest = GetFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .subscription_id("1234567890987654321") \ - .request_body(GetFileSubscriptionRequestBody.builder() - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: GetFileSubscriptionRequest = GetFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .subscription_id("1234567890987654321") \ + .request_body(GetFileSubscriptionRequestBody.builder() + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: GetFileSubscriptionResponse = await client.drive.v1.file_subscription.aget(request) + # 发起请求 + response: GetFileSubscriptionResponse = await client.drive.v1.file_subscription.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_file_version_sample.py b/samples/api/drive/v1/get_file_version_sample.py index cde7e3ac9..68bd53593 100644 --- a/samples/api/drive/v1/get_file_version_sample.py +++ b/samples/api/drive/v1/get_file_version_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileVersionRequest = GetFileVersionRequest.builder() \ - .file_token("shtbcqqoXZJaKYrfN5IHQg4sVFZ") \ - .version_id("file_version") \ - .obj_type("doc/sheet/bitable/docx") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetFileVersionRequest = GetFileVersionRequest.builder() \ + .file_token("shtbcqqoXZJaKYrfN5IHQg4sVFZ") \ + .version_id("file_version") \ + .obj_type("doc/sheet/bitable/docx") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetFileVersionResponse = client.drive.v1.file_version.get(request) + # 发起请求 + response: GetFileVersionResponse = client.drive.v1.file_version.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileVersionRequest = GetFileVersionRequest.builder() \ - .file_token("shtbcqqoXZJaKYrfN5IHQg4sVFZ") \ - .version_id("file_version") \ - .obj_type("doc/sheet/bitable/docx") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetFileVersionRequest = GetFileVersionRequest.builder() \ + .file_token("shtbcqqoXZJaKYrfN5IHQg4sVFZ") \ + .version_id("file_version") \ + .obj_type("doc/sheet/bitable/docx") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetFileVersionResponse = await client.drive.v1.file_version.aget(request) + # 发起请求 + response: GetFileVersionResponse = await client.drive.v1.file_version.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_import_task_sample.py b/samples/api/drive/v1/get_import_task_sample.py index 6a8f0521c..7efaeaa6b 100644 --- a/samples/api/drive/v1/get_import_task_sample.py +++ b/samples/api/drive/v1/get_import_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetImportTaskRequest = GetImportTaskRequest.builder() \ - .ticket("6990281865xxxxxxxx7843") \ - .build() + # 构造请求对象 + request: GetImportTaskRequest = GetImportTaskRequest.builder() \ + .ticket("6990281865xxxxxxxx7843") \ + .build() - # 发起请求 - response: GetImportTaskResponse = client.drive.v1.import_task.get(request) + # 发起请求 + response: GetImportTaskResponse = client.drive.v1.import_task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.import_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.import_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetImportTaskRequest = GetImportTaskRequest.builder() \ - .ticket("6990281865xxxxxxxx7843") \ - .build() + # 构造请求对象 + request: GetImportTaskRequest = GetImportTaskRequest.builder() \ + .ticket("6990281865xxxxxxxx7843") \ + .build() - # 发起请求 - response: GetImportTaskResponse = await client.drive.v1.import_task.aget(request) + # 发起请求 + response: GetImportTaskResponse = await client.drive.v1.import_task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.import_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.import_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_permission_public_sample.py b/samples/api/drive/v1/get_permission_public_sample.py index af94c588a..abe9e1a66 100644 --- a/samples/api/drive/v1/get_permission_public_sample.py +++ b/samples/api/drive/v1/get_permission_public_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: GetPermissionPublicResponse = client.drive.v1.permission_public.get(request) + # 发起请求 + response: GetPermissionPublicResponse = client.drive.v1.permission_public.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: GetPermissionPublicResponse = await client.drive.v1.permission_public.aget(request) + # 发起请求 + response: GetPermissionPublicResponse = await client.drive.v1.permission_public.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/get_subscribe_file_sample.py b/samples/api/drive/v1/get_subscribe_file_sample.py index 85ff7802e..b93cb0a8b 100644 --- a/samples/api/drive/v1/get_subscribe_file_sample.py +++ b/samples/api/drive/v1/get_subscribe_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubscribeFileRequest = GetSubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("新版文档") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: GetSubscribeFileRequest = GetSubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("新版文档") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: GetSubscribeFileResponse = client.drive.v1.file.get_subscribe(request) + # 发起请求 + response: GetSubscribeFileResponse = client.drive.v1.file.get_subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.get_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.get_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSubscribeFileRequest = GetSubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("新版文档") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: GetSubscribeFileRequest = GetSubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("新版文档") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: GetSubscribeFileResponse = await client.drive.v1.file.aget_subscribe(request) + # 发起请求 + response: GetSubscribeFileResponse = await client.drive.v1.file.aget_subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.aget_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.aget_subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_file_comment_reply_sample.py b/samples/api/drive/v1/list_file_comment_reply_sample.py index 196fa9eb5..eacf32738 100644 --- a/samples/api/drive/v1/list_file_comment_reply_sample.py +++ b/samples/api/drive/v1/list_file_comment_reply_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileCommentReplyRequest = ListFileCommentReplyRequest.builder() \ - .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ - .comment_id("1654857036541812356") \ - .page_size(10) \ - .page_token("1654857036541812356") \ - .file_type("docx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileCommentReplyRequest = ListFileCommentReplyRequest.builder() \ + .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ + .comment_id("1654857036541812356") \ + .page_size(10) \ + .page_token("1654857036541812356") \ + .file_type("docx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileCommentReplyResponse = client.drive.v1.file_comment_reply.list(request) + # 发起请求 + response: ListFileCommentReplyResponse = client.drive.v1.file_comment_reply.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileCommentReplyRequest = ListFileCommentReplyRequest.builder() \ - .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ - .comment_id("1654857036541812356") \ - .page_size(10) \ - .page_token("1654857036541812356") \ - .file_type("docx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileCommentReplyRequest = ListFileCommentReplyRequest.builder() \ + .file_token("doxbcdl03Vsxhm7Qmnj110abcef") \ + .comment_id("1654857036541812356") \ + .page_size(10) \ + .page_token("1654857036541812356") \ + .file_type("docx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileCommentReplyResponse = await client.drive.v1.file_comment_reply.alist(request) + # 发起请求 + response: ListFileCommentReplyResponse = await client.drive.v1.file_comment_reply.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_file_comment_sample.py b/samples/api/drive/v1/list_file_comment_sample.py index 484c89ed5..0c4d30f6f 100644 --- a/samples/api/drive/v1/list_file_comment_sample.py +++ b/samples/api/drive/v1/list_file_comment_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileCommentRequest = ListFileCommentRequest.builder() \ - .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ - .file_type("doc") \ - .is_whole(False) \ - .is_solved(False) \ - .page_token("7153511712153412356") \ - .page_size(10) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileCommentRequest = ListFileCommentRequest.builder() \ + .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ + .file_type("doc") \ + .is_whole(False) \ + .is_solved(False) \ + .page_token("7153511712153412356") \ + .page_size(10) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileCommentResponse = client.drive.v1.file_comment.list(request) + # 发起请求 + response: ListFileCommentResponse = client.drive.v1.file_comment.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileCommentRequest = ListFileCommentRequest.builder() \ - .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ - .file_type("doc") \ - .is_whole(False) \ - .is_solved(False) \ - .page_token("7153511712153412356") \ - .page_size(10) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileCommentRequest = ListFileCommentRequest.builder() \ + .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ + .file_type("doc") \ + .is_whole(False) \ + .is_solved(False) \ + .page_token("7153511712153412356") \ + .page_size(10) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileCommentResponse = await client.drive.v1.file_comment.alist(request) + # 发起请求 + response: ListFileCommentResponse = await client.drive.v1.file_comment.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_file_sample.py b/samples/api/drive/v1/list_file_sample.py index 197922ec5..9793b8547 100644 --- a/samples/api/drive/v1/list_file_sample.py +++ b/samples/api/drive/v1/list_file_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileRequest = ListFileRequest.builder() \ - .page_size(10) \ - .page_token("MTY1NTA3MTA1OXw3MTA4NDc2MDc1NzkyOTI0Nabcef") \ - .folder_token("fldbcO1UuPz8VwnpPx5a9abcef") \ - .order_by("EditedTime") \ - .direction("DESC") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileRequest = ListFileRequest.builder() \ + .page_size(10) \ + .page_token("MTY1NTA3MTA1OXw3MTA4NDc2MDc1NzkyOTI0Nabcef") \ + .folder_token("fldbcO1UuPz8VwnpPx5a9abcef") \ + .order_by("EditedTime") \ + .direction("DESC") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileResponse = client.drive.v1.file.list(request) + # 发起请求 + response: ListFileResponse = client.drive.v1.file.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileRequest = ListFileRequest.builder() \ - .page_size(10) \ - .page_token("MTY1NTA3MTA1OXw3MTA4NDc2MDc1NzkyOTI0Nabcef") \ - .folder_token("fldbcO1UuPz8VwnpPx5a9abcef") \ - .order_by("EditedTime") \ - .direction("DESC") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListFileRequest = ListFileRequest.builder() \ + .page_size(10) \ + .page_token("MTY1NTA3MTA1OXw3MTA4NDc2MDc1NzkyOTI0Nabcef") \ + .folder_token("fldbcO1UuPz8VwnpPx5a9abcef") \ + .order_by("EditedTime") \ + .direction("DESC") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListFileResponse = await client.drive.v1.file.alist(request) + # 发起请求 + response: ListFileResponse = await client.drive.v1.file.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_file_version_sample.py b/samples/api/drive/v1/list_file_version_sample.py index 7ba4a7135..a4503ef3d 100644 --- a/samples/api/drive/v1/list_file_version_sample.py +++ b/samples/api/drive/v1/list_file_version_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileVersionRequest = ListFileVersionRequest.builder() \ - .file_token("shtbcpM2mm3znrLfWnf4browTYp23") \ - .page_size(10) \ - .page_token("1665739388") \ - .obj_type("doc/docx/sheet/bitable") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListFileVersionRequest = ListFileVersionRequest.builder() \ + .file_token("shtbcpM2mm3znrLfWnf4browTYp23") \ + .page_size(10) \ + .page_token("1665739388") \ + .obj_type("doc/docx/sheet/bitable") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListFileVersionResponse = client.drive.v1.file_version.list(request) + # 发起请求 + response: ListFileVersionResponse = client.drive.v1.file_version.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileVersionRequest = ListFileVersionRequest.builder() \ - .file_token("shtbcpM2mm3znrLfWnf4browTYp23") \ - .page_size(10) \ - .page_token("1665739388") \ - .obj_type("doc/docx/sheet/bitable") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListFileVersionRequest = ListFileVersionRequest.builder() \ + .file_token("shtbcpM2mm3znrLfWnf4browTYp23") \ + .page_size(10) \ + .page_token("1665739388") \ + .obj_type("doc/docx/sheet/bitable") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListFileVersionResponse = await client.drive.v1.file_version.alist(request) + # 发起请求 + response: ListFileVersionResponse = await client.drive.v1.file_version.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_version.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_version.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_file_view_record_sample.py b/samples/api/drive/v1/list_file_view_record_sample.py index 2ab1d16c0..21e092fc8 100644 --- a/samples/api/drive/v1/list_file_view_record_sample.py +++ b/samples/api/drive/v1/list_file_view_record_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileViewRecordRequest = ListFileViewRecordRequest.builder() \ - .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ - .page_size(10) \ - .page_token("1674037112--7189934631754563585") \ - .file_type("docx") \ - .viewer_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListFileViewRecordRequest = ListFileViewRecordRequest.builder() \ + .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ + .page_size(10) \ + .page_token("1674037112--7189934631754563585") \ + .file_type("docx") \ + .viewer_id_type("open_id") \ + .build() - # 发起请求 - response: ListFileViewRecordResponse = client.drive.v1.file_view_record.list(request) + # 发起请求 + response: ListFileViewRecordResponse = client.drive.v1.file_view_record.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_view_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_view_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFileViewRecordRequest = ListFileViewRecordRequest.builder() \ - .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ - .page_size(10) \ - .page_token("1674037112--7189934631754563585") \ - .file_type("docx") \ - .viewer_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListFileViewRecordRequest = ListFileViewRecordRequest.builder() \ + .file_token("XIHSdYSI7oMEU1xrsnxc8fabcef") \ + .page_size(10) \ + .page_token("1674037112--7189934631754563585") \ + .file_type("docx") \ + .viewer_id_type("open_id") \ + .build() - # 发起请求 - response: ListFileViewRecordResponse = await client.drive.v1.file_view_record.alist(request) + # 发起请求 + response: ListFileViewRecordResponse = await client.drive.v1.file_view_record.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_view_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_view_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/list_permission_member_sample.py b/samples/api/drive/v1/list_permission_member_sample.py index c05736a32..09876f20c 100644 --- a/samples/api/drive/v1/list_permission_member_sample.py +++ b/samples/api/drive/v1/list_permission_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPermissionMemberRequest = ListPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .fields("*") \ - .perm_type("container") \ - .build() + # 构造请求对象 + request: ListPermissionMemberRequest = ListPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .fields("*") \ + .perm_type("container") \ + .build() - # 发起请求 - response: ListPermissionMemberResponse = client.drive.v1.permission_member.list(request) + # 发起请求 + response: ListPermissionMemberResponse = client.drive.v1.permission_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPermissionMemberRequest = ListPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .fields("*") \ - .perm_type("container") \ - .build() + # 构造请求对象 + request: ListPermissionMemberRequest = ListPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .fields("*") \ + .perm_type("container") \ + .build() - # 发起请求 - response: ListPermissionMemberResponse = await client.drive.v1.permission_member.alist(request) + # 发起请求 + response: ListPermissionMemberResponse = await client.drive.v1.permission_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/move_file_sample.py b/samples/api/drive/v1/move_file_sample.py index 6008caf55..48bcb09ae 100644 --- a/samples/api/drive/v1/move_file_sample.py +++ b/samples/api/drive/v1/move_file_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveFileRequest = MoveFileRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .request_body(MoveFileRequestBody.builder() - .type("file") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .build()) \ - .build() + # 构造请求对象 + request: MoveFileRequest = MoveFileRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .request_body(MoveFileRequestBody.builder() + .type("file") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .build()) \ + .build() - # 发起请求 - response: MoveFileResponse = client.drive.v1.file.move(request) + # 发起请求 + response: MoveFileResponse = client.drive.v1.file.move(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.move failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.move failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveFileRequest = MoveFileRequest.builder() \ - .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ - .request_body(MoveFileRequestBody.builder() - .type("file") - .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") - .build()) \ - .build() + # 构造请求对象 + request: MoveFileRequest = MoveFileRequest.builder() \ + .file_token("boxcnrHpsg1QDqXAAAyachabcef") \ + .request_body(MoveFileRequestBody.builder() + .type("file") + .folder_token("fldbcO1UuPz8VwnpPx5a92abcef") + .build()) \ + .build() - # 发起请求 - response: MoveFileResponse = await client.drive.v1.file.amove(request) + # 发起请求 + response: MoveFileResponse = await client.drive.v1.file.amove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.amove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.amove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/patch_file_comment_sample.py b/samples/api/drive/v1/patch_file_comment_sample.py index bd71b0d9f..26be7d813 100644 --- a/samples/api/drive/v1/patch_file_comment_sample.py +++ b/samples/api/drive/v1/patch_file_comment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFileCommentRequest = PatchFileCommentRequest.builder() \ - .file_token("doccnGp4UK1UskrOEJwBXd3****") \ - .comment_id("6916106822734578184") \ - .file_type("doc") \ - .request_body(PatchFileCommentRequestBody.builder() - .is_solved(True) - .build()) \ - .build() + # 构造请求对象 + request: PatchFileCommentRequest = PatchFileCommentRequest.builder() \ + .file_token("doccnGp4UK1UskrOEJwBXd3****") \ + .comment_id("6916106822734578184") \ + .file_type("doc") \ + .request_body(PatchFileCommentRequestBody.builder() + .is_solved(True) + .build()) \ + .build() - # 发起请求 - response: PatchFileCommentResponse = client.drive.v1.file_comment.patch(request) + # 发起请求 + response: PatchFileCommentResponse = client.drive.v1.file_comment.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFileCommentRequest = PatchFileCommentRequest.builder() \ - .file_token("doccnGp4UK1UskrOEJwBXd3****") \ - .comment_id("6916106822734578184") \ - .file_type("doc") \ - .request_body(PatchFileCommentRequestBody.builder() - .is_solved(True) - .build()) \ - .build() + # 构造请求对象 + request: PatchFileCommentRequest = PatchFileCommentRequest.builder() \ + .file_token("doccnGp4UK1UskrOEJwBXd3****") \ + .comment_id("6916106822734578184") \ + .file_type("doc") \ + .request_body(PatchFileCommentRequestBody.builder() + .is_solved(True) + .build()) \ + .build() - # 发起请求 - response: PatchFileCommentResponse = await client.drive.v1.file_comment.apatch(request) + # 发起请求 + response: PatchFileCommentResponse = await client.drive.v1.file_comment.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/patch_file_subscription_sample.py b/samples/api/drive/v1/patch_file_subscription_sample.py index 4d4b24923..01dafb459 100644 --- a/samples/api/drive/v1/patch_file_subscription_sample.py +++ b/samples/api/drive/v1/patch_file_subscription_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFileSubscriptionRequest = PatchFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .subscription_id("1234567890987654321") \ - .request_body(PatchFileSubscriptionRequestBody.builder() - .is_subscribe(True) - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: PatchFileSubscriptionRequest = PatchFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .subscription_id("1234567890987654321") \ + .request_body(PatchFileSubscriptionRequestBody.builder() + .is_subscribe(True) + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: PatchFileSubscriptionResponse = client.drive.v1.file_subscription.patch(request) + # 发起请求 + response: PatchFileSubscriptionResponse = client.drive.v1.file_subscription.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFileSubscriptionRequest = PatchFileSubscriptionRequest.builder() \ - .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ - .subscription_id("1234567890987654321") \ - .request_body(PatchFileSubscriptionRequestBody.builder() - .is_subscribe(True) - .file_type("doc") - .build()) \ - .build() + # 构造请求对象 + request: PatchFileSubscriptionRequest = PatchFileSubscriptionRequest.builder() \ + .file_token("doxcnxxxxxxxxxxxxxxxxxxxxxx") \ + .subscription_id("1234567890987654321") \ + .request_body(PatchFileSubscriptionRequestBody.builder() + .is_subscribe(True) + .file_type("doc") + .build()) \ + .build() - # 发起请求 - response: PatchFileSubscriptionResponse = await client.drive.v1.file_subscription.apatch(request) + # 发起请求 + response: PatchFileSubscriptionResponse = await client.drive.v1.file_subscription.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_subscription.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_subscription.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/patch_permission_public_sample.py b/samples/api/drive/v1/patch_permission_public_sample.py index 876171e9a..108eab56c 100644 --- a/samples/api/drive/v1/patch_permission_public_sample.py +++ b/samples/api/drive/v1/patch_permission_public_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .request_body(PermissionPublicRequest.builder() - .external_access(True) - .security_entity("anyone_can_view") - .comment_entity("anyone_can_view") - .share_entity("anyone") - .link_share_entity("tenant_readable") - .invite_external(True) - .build()) \ - .build() + # 构造请求对象 + request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .request_body(PermissionPublicRequest.builder() + .external_access(True) + .security_entity("anyone_can_view") + .comment_entity("anyone_can_view") + .share_entity("anyone") + .link_share_entity("tenant_readable") + .invite_external(True) + .build()) \ + .build() - # 发起请求 - response: PatchPermissionPublicResponse = client.drive.v1.permission_public.patch(request) + # 发起请求 + response: PatchPermissionPublicResponse = client.drive.v1.permission_public.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .request_body(PermissionPublicRequest.builder() - .external_access(True) - .security_entity("anyone_can_view") - .comment_entity("anyone_can_view") - .share_entity("anyone") - .link_share_entity("tenant_readable") - .invite_external(True) - .build()) \ - .build() + # 构造请求对象 + request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .request_body(PermissionPublicRequest.builder() + .external_access(True) + .security_entity("anyone_can_view") + .comment_entity("anyone_can_view") + .share_entity("anyone") + .link_share_entity("tenant_readable") + .invite_external(True) + .build()) \ + .build() - # 发起请求 - response: PatchPermissionPublicResponse = await client.drive.v1.permission_public.apatch(request) + # 发起请求 + response: PatchPermissionPublicResponse = await client.drive.v1.permission_public.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/subscribe_file_sample.py b/samples/api/drive/v1/subscribe_file_sample.py index c0f577ff7..659197741 100644 --- a/samples/api/drive/v1/subscribe_file_sample.py +++ b/samples/api/drive/v1/subscribe_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeFileRequest = SubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("doc") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: SubscribeFileRequest = SubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("doc") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: SubscribeFileResponse = client.drive.v1.file.subscribe(request) + # 发起请求 + response: SubscribeFileResponse = client.drive.v1.file.subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeFileRequest = SubscribeFileRequest.builder() \ - .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ - .file_type("doc") \ - .event_type("file.created_in_folder_v1") \ - .build() + # 构造请求对象 + request: SubscribeFileRequest = SubscribeFileRequest.builder() \ + .file_token("doccnxxxxxxxxxxxxxxxxxxxxxx") \ + .file_type("doc") \ + .event_type("file.created_in_folder_v1") \ + .build() - # 发起请求 - response: SubscribeFileResponse = await client.drive.v1.file.asubscribe(request) + # 发起请求 + response: SubscribeFileResponse = await client.drive.v1.file.asubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/task_check_file_sample.py b/samples/api/drive/v1/task_check_file_sample.py index c06579948..e510b1b5f 100644 --- a/samples/api/drive/v1/task_check_file_sample.py +++ b/samples/api/drive/v1/task_check_file_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TaskCheckFileRequest = TaskCheckFileRequest.builder() \ - .task_id("12345") \ - .build() + # 构造请求对象 + request: TaskCheckFileRequest = TaskCheckFileRequest.builder() \ + .task_id("12345") \ + .build() - # 发起请求 - response: TaskCheckFileResponse = client.drive.v1.file.task_check(request) + # 发起请求 + response: TaskCheckFileResponse = client.drive.v1.file.task_check(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.task_check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.task_check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TaskCheckFileRequest = TaskCheckFileRequest.builder() \ - .task_id("12345") \ - .build() + # 构造请求对象 + request: TaskCheckFileRequest = TaskCheckFileRequest.builder() \ + .task_id("12345") \ + .build() - # 发起请求 - response: TaskCheckFileResponse = await client.drive.v1.file.atask_check(request) + # 发起请求 + response: TaskCheckFileResponse = await client.drive.v1.file.atask_check(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.atask_check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.atask_check failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/transfer_owner_permission_member_sample.py b/samples/api/drive/v1/transfer_owner_permission_member_sample.py index 946f72f8b..d9ba8366d 100644 --- a/samples/api/drive/v1/transfer_owner_permission_member_sample.py +++ b/samples/api/drive/v1/transfer_owner_permission_member_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferOwnerPermissionMemberRequest = TransferOwnerPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(True) \ - .remove_old_owner(False) \ - .stay_put(False) \ - .old_owner_perm("full_access") \ - .request_body(Owner.builder() - .member_type("openid") - .member_id("string") - .build()) \ - .build() + # 构造请求对象 + request: TransferOwnerPermissionMemberRequest = TransferOwnerPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(True) \ + .remove_old_owner(False) \ + .stay_put(False) \ + .old_owner_perm("full_access") \ + .request_body(Owner.builder() + .member_type("openid") + .member_id("string") + .build()) \ + .build() - # 发起请求 - response: TransferOwnerPermissionMemberResponse = client.drive.v1.permission_member.transfer_owner(request) + # 发起请求 + response: TransferOwnerPermissionMemberResponse = client.drive.v1.permission_member.transfer_owner(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.transfer_owner failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.transfer_owner failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferOwnerPermissionMemberRequest = TransferOwnerPermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .need_notification(True) \ - .remove_old_owner(False) \ - .stay_put(False) \ - .old_owner_perm("full_access") \ - .request_body(Owner.builder() - .member_type("openid") - .member_id("string") - .build()) \ - .build() + # 构造请求对象 + request: TransferOwnerPermissionMemberRequest = TransferOwnerPermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .need_notification(True) \ + .remove_old_owner(False) \ + .stay_put(False) \ + .old_owner_perm("full_access") \ + .request_body(Owner.builder() + .member_type("openid") + .member_id("string") + .build()) \ + .build() - # 发起请求 - response: TransferOwnerPermissionMemberResponse = await client.drive.v1.permission_member.atransfer_owner(request) + # 发起请求 + response: TransferOwnerPermissionMemberResponse = await client.drive.v1.permission_member.atransfer_owner(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.atransfer_owner failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.atransfer_owner failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/update_file_comment_reply_sample.py b/samples/api/drive/v1/update_file_comment_reply_sample.py index 88dace5a6..99ee59d78 100644 --- a/samples/api/drive/v1/update_file_comment_reply_sample.py +++ b/samples/api/drive/v1/update_file_comment_reply_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateFileCommentReplyRequest = UpdateFileCommentReplyRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .reply_id("6916106822734594568") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .request_body(UpdateFileCommentReplyRequestBody.builder() - .content(ReplyContent.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateFileCommentReplyRequest = UpdateFileCommentReplyRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .reply_id("6916106822734594568") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .request_body(UpdateFileCommentReplyRequestBody.builder() + .content(ReplyContent.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateFileCommentReplyResponse = client.drive.v1.file_comment_reply.update(request) + # 发起请求 + response: UpdateFileCommentReplyResponse = client.drive.v1.file_comment_reply.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateFileCommentReplyRequest = UpdateFileCommentReplyRequest.builder() \ - .file_token("doccnHh7U87HOFpii5u5G*****") \ - .comment_id("6916106822734578184") \ - .reply_id("6916106822734594568") \ - .file_type("doc") \ - .user_id_type("user_id") \ - .request_body(UpdateFileCommentReplyRequestBody.builder() - .content(ReplyContent.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateFileCommentReplyRequest = UpdateFileCommentReplyRequest.builder() \ + .file_token("doccnHh7U87HOFpii5u5G*****") \ + .comment_id("6916106822734578184") \ + .reply_id("6916106822734594568") \ + .file_type("doc") \ + .user_id_type("user_id") \ + .request_body(UpdateFileCommentReplyRequestBody.builder() + .content(ReplyContent.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateFileCommentReplyResponse = await client.drive.v1.file_comment_reply.aupdate(request) + # 发起请求 + response: UpdateFileCommentReplyResponse = await client.drive.v1.file_comment_reply.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file_comment_reply.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file_comment_reply.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/update_permission_member_sample.py b/samples/api/drive/v1/update_permission_member_sample.py index 85084ba97..28c3f4c4c 100644 --- a/samples/api/drive/v1/update_permission_member_sample.py +++ b/samples/api/drive/v1/update_permission_member_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePermissionMemberRequest = UpdatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .need_notification(False) \ - .type("doc") \ - .request_body(BaseMember.builder() - .member_type("openid") - .perm("view") - .perm_type("container") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: UpdatePermissionMemberRequest = UpdatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .need_notification(False) \ + .type("doc") \ + .request_body(BaseMember.builder() + .member_type("openid") + .perm("view") + .perm_type("container") + .type("user") + .build()) \ + .build() - # 发起请求 - response: UpdatePermissionMemberResponse = client.drive.v1.permission_member.update(request) + # 发起请求 + response: UpdatePermissionMemberResponse = client.drive.v1.permission_member.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePermissionMemberRequest = UpdatePermissionMemberRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ - .need_notification(False) \ - .type("doc") \ - .request_body(BaseMember.builder() - .member_type("openid") - .perm("view") - .perm_type("container") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: UpdatePermissionMemberRequest = UpdatePermissionMemberRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .member_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .need_notification(False) \ + .type("doc") \ + .request_body(BaseMember.builder() + .member_type("openid") + .perm("view") + .perm_type("container") + .type("user") + .build()) \ + .build() - # 发起请求 - response: UpdatePermissionMemberResponse = await client.drive.v1.permission_member.aupdate(request) + # 发起请求 + response: UpdatePermissionMemberResponse = await client.drive.v1.permission_member.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_member.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_member.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/update_permission_public_password_sample.py b/samples/api/drive/v1/update_permission_public_password_sample.py index acc74f4f6..bc733f813 100644 --- a/samples/api/drive/v1/update_permission_public_password_sample.py +++ b/samples/api/drive/v1/update_permission_public_password_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePermissionPublicPasswordRequest = UpdatePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: UpdatePermissionPublicPasswordRequest = UpdatePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: UpdatePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.update(request) + # 发起请求 + response: UpdatePermissionPublicPasswordResponse = client.drive.v1.permission_public_password.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePermissionPublicPasswordRequest = UpdatePermissionPublicPasswordRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: UpdatePermissionPublicPasswordRequest = UpdatePermissionPublicPasswordRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: UpdatePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.aupdate(request) + # 发起请求 + response: UpdatePermissionPublicPasswordResponse = await client.drive.v1.permission_public_password.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.permission_public_password.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.permission_public_password.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_all_file_sample.py b/samples/api/drive/v1/upload_all_file_sample.py index 70fca0121..cca9e42d5 100644 --- a/samples/api/drive/v1/upload_all_file_sample.py +++ b/samples/api/drive/v1/upload_all_file_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAllFileRequest = UploadAllFileRequest.builder() \ - .request_body(UploadAllFileRequestBody.builder() - .file_name("demo.pdf") - .parent_type("explorer") - .parent_node("fldbcO1UuPz8VwnpPx5a92abcef") - .size(1024) - .checksum("123423882374238912356") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAllFileRequest = UploadAllFileRequest.builder() \ + .request_body(UploadAllFileRequestBody.builder() + .file_name("demo.pdf") + .parent_type("explorer") + .parent_node("fldbcO1UuPz8VwnpPx5a92abcef") + .size(1024) + .checksum("123423882374238912356") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAllFileResponse = client.drive.v1.file.upload_all(request) + # 发起请求 + response: UploadAllFileResponse = client.drive.v1.file.upload_all(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.upload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.upload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAllFileRequest = UploadAllFileRequest.builder() \ - .request_body(UploadAllFileRequestBody.builder() - .file_name("demo.pdf") - .parent_type("explorer") - .parent_node("fldbcO1UuPz8VwnpPx5a92abcef") - .size(1024) - .checksum("123423882374238912356") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAllFileRequest = UploadAllFileRequest.builder() \ + .request_body(UploadAllFileRequestBody.builder() + .file_name("demo.pdf") + .parent_type("explorer") + .parent_node("fldbcO1UuPz8VwnpPx5a92abcef") + .size(1024) + .checksum("123423882374238912356") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAllFileResponse = await client.drive.v1.file.aupload_all(request) + # 发起请求 + response: UploadAllFileResponse = await client.drive.v1.file.aupload_all(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.aupload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.aupload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_all_media_sample.py b/samples/api/drive/v1/upload_all_media_sample.py index 73c7b8b0d..a1da74724 100644 --- a/samples/api/drive/v1/upload_all_media_sample.py +++ b/samples/api/drive/v1/upload_all_media_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAllMediaRequest = UploadAllMediaRequest.builder() \ - .request_body(UploadAllMediaRequestBody.builder() - .file_name("demo.jpeg") - .parent_type("doc_image") - .parent_node("doccnFivLCfJfblZjGZtxgabcef") - .size(1024) - .checksum("12345678") - .extra("") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAllMediaRequest = UploadAllMediaRequest.builder() \ + .request_body(UploadAllMediaRequestBody.builder() + .file_name("demo.jpeg") + .parent_type("doc_image") + .parent_node("doccnFivLCfJfblZjGZtxgabcef") + .size(1024) + .checksum("12345678") + .extra("") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAllMediaResponse = client.drive.v1.media.upload_all(request) + # 发起请求 + response: UploadAllMediaResponse = client.drive.v1.media.upload_all(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.upload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.upload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAllMediaRequest = UploadAllMediaRequest.builder() \ - .request_body(UploadAllMediaRequestBody.builder() - .file_name("demo.jpeg") - .parent_type("doc_image") - .parent_node("doccnFivLCfJfblZjGZtxgabcef") - .size(1024) - .checksum("12345678") - .extra("") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAllMediaRequest = UploadAllMediaRequest.builder() \ + .request_body(UploadAllMediaRequestBody.builder() + .file_name("demo.jpeg") + .parent_type("doc_image") + .parent_node("doccnFivLCfJfblZjGZtxgabcef") + .size(1024) + .checksum("12345678") + .extra("") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAllMediaResponse = await client.drive.v1.media.aupload_all(request) + # 发起请求 + response: UploadAllMediaResponse = await client.drive.v1.media.aupload_all(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.aupload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.aupload_all failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_finish_file_sample.py b/samples/api/drive/v1/upload_finish_file_sample.py index f9585b75c..a444f9a5d 100644 --- a/samples/api/drive/v1/upload_finish_file_sample.py +++ b/samples/api/drive/v1/upload_finish_file_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadFinishFileRequest = UploadFinishFileRequest.builder() \ - .request_body(UploadFinishFileRequestBody.builder() - .upload_id("7111211691345512356") - .block_num(1) - .build()) \ - .build() + # 构造请求对象 + request: UploadFinishFileRequest = UploadFinishFileRequest.builder() \ + .request_body(UploadFinishFileRequestBody.builder() + .upload_id("7111211691345512356") + .block_num(1) + .build()) \ + .build() - # 发起请求 - response: UploadFinishFileResponse = client.drive.v1.file.upload_finish(request) + # 发起请求 + response: UploadFinishFileResponse = client.drive.v1.file.upload_finish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.upload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.upload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadFinishFileRequest = UploadFinishFileRequest.builder() \ - .request_body(UploadFinishFileRequestBody.builder() - .upload_id("7111211691345512356") - .block_num(1) - .build()) \ - .build() + # 构造请求对象 + request: UploadFinishFileRequest = UploadFinishFileRequest.builder() \ + .request_body(UploadFinishFileRequestBody.builder() + .upload_id("7111211691345512356") + .block_num(1) + .build()) \ + .build() - # 发起请求 - response: UploadFinishFileResponse = await client.drive.v1.file.aupload_finish(request) + # 发起请求 + response: UploadFinishFileResponse = await client.drive.v1.file.aupload_finish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.aupload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.aupload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_finish_media_sample.py b/samples/api/drive/v1/upload_finish_media_sample.py index d7e3e584c..4a73ab171 100644 --- a/samples/api/drive/v1/upload_finish_media_sample.py +++ b/samples/api/drive/v1/upload_finish_media_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadFinishMediaRequest = UploadFinishMediaRequest.builder() \ - .request_body(UploadFinishMediaRequestBody.builder() - .upload_id("7111211691345512356") - .block_num(1) - .build()) \ - .build() + # 构造请求对象 + request: UploadFinishMediaRequest = UploadFinishMediaRequest.builder() \ + .request_body(UploadFinishMediaRequestBody.builder() + .upload_id("7111211691345512356") + .block_num(1) + .build()) \ + .build() - # 发起请求 - response: UploadFinishMediaResponse = client.drive.v1.media.upload_finish(request) + # 发起请求 + response: UploadFinishMediaResponse = client.drive.v1.media.upload_finish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.upload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.upload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadFinishMediaRequest = UploadFinishMediaRequest.builder() \ - .request_body(UploadFinishMediaRequestBody.builder() - .upload_id("7111211691345512356") - .block_num(1) - .build()) \ - .build() + # 构造请求对象 + request: UploadFinishMediaRequest = UploadFinishMediaRequest.builder() \ + .request_body(UploadFinishMediaRequestBody.builder() + .upload_id("7111211691345512356") + .block_num(1) + .build()) \ + .build() - # 发起请求 - response: UploadFinishMediaResponse = await client.drive.v1.media.aupload_finish(request) + # 发起请求 + response: UploadFinishMediaResponse = await client.drive.v1.media.aupload_finish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.aupload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.aupload_finish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_part_file_sample.py b/samples/api/drive/v1/upload_part_file_sample.py index d37bbc5bb..280e7c678 100644 --- a/samples/api/drive/v1/upload_part_file_sample.py +++ b/samples/api/drive/v1/upload_part_file_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPartFileRequest = UploadPartFileRequest.builder() \ - .request_body(UploadPartFileRequestBody.builder() - .upload_id("7111211691345512356") - .seq(0) - .size(4194304) - .checksum("12342388237783212356") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPartFileRequest = UploadPartFileRequest.builder() \ + .request_body(UploadPartFileRequestBody.builder() + .upload_id("7111211691345512356") + .seq(0) + .size(4194304) + .checksum("12342388237783212356") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadPartFileResponse = client.drive.v1.file.upload_part(request) + # 发起请求 + response: UploadPartFileResponse = client.drive.v1.file.upload_part(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.upload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.upload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPartFileRequest = UploadPartFileRequest.builder() \ - .request_body(UploadPartFileRequestBody.builder() - .upload_id("7111211691345512356") - .seq(0) - .size(4194304) - .checksum("12342388237783212356") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPartFileRequest = UploadPartFileRequest.builder() \ + .request_body(UploadPartFileRequestBody.builder() + .upload_id("7111211691345512356") + .seq(0) + .size(4194304) + .checksum("12342388237783212356") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadPartFileResponse = await client.drive.v1.file.aupload_part(request) + # 发起请求 + response: UploadPartFileResponse = await client.drive.v1.file.aupload_part(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.aupload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.aupload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_part_media_sample.py b/samples/api/drive/v1/upload_part_media_sample.py index cfa1c8db5..10db7b993 100644 --- a/samples/api/drive/v1/upload_part_media_sample.py +++ b/samples/api/drive/v1/upload_part_media_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPartMediaRequest = UploadPartMediaRequest.builder() \ - .request_body(UploadPartMediaRequestBody.builder() - .upload_id("7111211691345512356") - .seq(0) - .size(4194304) - .checksum("12345678") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPartMediaRequest = UploadPartMediaRequest.builder() \ + .request_body(UploadPartMediaRequestBody.builder() + .upload_id("7111211691345512356") + .seq(0) + .size(4194304) + .checksum("12345678") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadPartMediaResponse = client.drive.v1.media.upload_part(request) + # 发起请求 + response: UploadPartMediaResponse = client.drive.v1.media.upload_part(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.upload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.upload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadPartMediaRequest = UploadPartMediaRequest.builder() \ - .request_body(UploadPartMediaRequestBody.builder() - .upload_id("7111211691345512356") - .seq(0) - .size(4194304) - .checksum("12345678") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadPartMediaRequest = UploadPartMediaRequest.builder() \ + .request_body(UploadPartMediaRequestBody.builder() + .upload_id("7111211691345512356") + .seq(0) + .size(4194304) + .checksum("12345678") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadPartMediaResponse = await client.drive.v1.media.aupload_part(request) + # 发起请求 + response: UploadPartMediaResponse = await client.drive.v1.media.aupload_part(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.aupload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.aupload_part failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_prepare_file_sample.py b/samples/api/drive/v1/upload_prepare_file_sample.py index e08645c19..7fb3ee223 100644 --- a/samples/api/drive/v1/upload_prepare_file_sample.py +++ b/samples/api/drive/v1/upload_prepare_file_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadPrepareFileRequest = UploadPrepareFileRequest.builder() \ - .request_body(FileUploadInfo.builder() - .file_name("str") - .parent_type("explorer") - .parent_node("str") - .size(int) - .build()) \ - .build() + # 构造请求对象 + request: UploadPrepareFileRequest = UploadPrepareFileRequest.builder() \ + .request_body(FileUploadInfo.builder() + .file_name("str") + .parent_type("explorer") + .parent_node("str") + .size(int) + .build()) \ + .build() - # 发起请求 - response: UploadPrepareFileResponse = client.drive.v1.file.upload_prepare(request) + # 发起请求 + response: UploadPrepareFileResponse = client.drive.v1.file.upload_prepare(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.upload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.upload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadPrepareFileRequest = UploadPrepareFileRequest.builder() \ - .request_body(FileUploadInfo.builder() - .file_name("str") - .parent_type("explorer") - .parent_node("str") - .size(int) - .build()) \ - .build() + # 构造请求对象 + request: UploadPrepareFileRequest = UploadPrepareFileRequest.builder() \ + .request_body(FileUploadInfo.builder() + .file_name("str") + .parent_type("explorer") + .parent_node("str") + .size(int) + .build()) \ + .build() - # 发起请求 - response: UploadPrepareFileResponse = await client.drive.v1.file.aupload_prepare(request) + # 发起请求 + response: UploadPrepareFileResponse = await client.drive.v1.file.aupload_prepare(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.file.aupload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.file.aupload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v1/upload_prepare_media_sample.py b/samples/api/drive/v1/upload_prepare_media_sample.py index 4deb3c9b5..39d0ad092 100644 --- a/samples/api/drive/v1/upload_prepare_media_sample.py +++ b/samples/api/drive/v1/upload_prepare_media_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadPrepareMediaRequest = UploadPrepareMediaRequest.builder() \ - .request_body(MediaUploadInfo.builder() - .file_name("demo.jpeg") - .parent_type("ccm_import_open") - .size(1024) - .parent_node("2olt0Ts4Mds7j7iqzdwrqEUnO7q") - .extra("") - .build()) \ - .build() + # 构造请求对象 + request: UploadPrepareMediaRequest = UploadPrepareMediaRequest.builder() \ + .request_body(MediaUploadInfo.builder() + .file_name("demo.jpeg") + .parent_type("ccm_import_open") + .size(1024) + .parent_node("2olt0Ts4Mds7j7iqzdwrqEUnO7q") + .extra("") + .build()) \ + .build() - # 发起请求 - response: UploadPrepareMediaResponse = client.drive.v1.media.upload_prepare(request) + # 发起请求 + response: UploadPrepareMediaResponse = client.drive.v1.media.upload_prepare(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.upload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.upload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UploadPrepareMediaRequest = UploadPrepareMediaRequest.builder() \ - .request_body(MediaUploadInfo.builder() - .file_name("demo.jpeg") - .parent_type("ccm_import_open") - .size(1024) - .parent_node("2olt0Ts4Mds7j7iqzdwrqEUnO7q") - .extra("") - .build()) \ - .build() + # 构造请求对象 + request: UploadPrepareMediaRequest = UploadPrepareMediaRequest.builder() \ + .request_body(MediaUploadInfo.builder() + .file_name("demo.jpeg") + .parent_type("ccm_import_open") + .size(1024) + .parent_node("2olt0Ts4Mds7j7iqzdwrqEUnO7q") + .extra("") + .build()) \ + .build() - # 发起请求 - response: UploadPrepareMediaResponse = await client.drive.v1.media.aupload_prepare(request) + # 发起请求 + response: UploadPrepareMediaResponse = await client.drive.v1.media.aupload_prepare(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v1.media.aupload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v1.media.aupload_prepare failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v2/get_permission_public_sample.py b/samples/api/drive/v2/get_permission_public_sample.py index 4068d6996..bfea18217 100644 --- a/samples/api/drive/v2/get_permission_public_sample.py +++ b/samples/api/drive/v2/get_permission_public_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: GetPermissionPublicResponse = client.drive.v2.permission_public.get(request) + # 发起请求 + response: GetPermissionPublicResponse = client.drive.v2.permission_public.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v2.permission_public.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v2.permission_public.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .build() + # 构造请求对象 + request: GetPermissionPublicRequest = GetPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .build() - # 发起请求 - response: GetPermissionPublicResponse = await client.drive.v2.permission_public.aget(request) + # 发起请求 + response: GetPermissionPublicResponse = await client.drive.v2.permission_public.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v2.permission_public.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v2.permission_public.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/drive/v2/patch_permission_public_sample.py b/samples/api/drive/v2/patch_permission_public_sample.py index 3d3ee081c..6ae6bbc20 100644 --- a/samples/api/drive/v2/patch_permission_public_sample.py +++ b/samples/api/drive/v2/patch_permission_public_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .request_body(PermissionPublic.builder() - .external_access_entity("open") - .security_entity("anyone_can_view") - .comment_entity("anyone_can_view") - .share_entity("anyone") - .manage_collaborator_entity("collaborator_can_view") - .link_share_entity("tenant_readable") - .copy_entity("anyone_can_view") - .build()) \ - .build() + # 构造请求对象 + request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .request_body(PermissionPublic.builder() + .external_access_entity("open") + .security_entity("anyone_can_view") + .comment_entity("anyone_can_view") + .share_entity("anyone") + .manage_collaborator_entity("collaborator_can_view") + .link_share_entity("tenant_readable") + .copy_entity("anyone_can_view") + .build()) \ + .build() - # 发起请求 - response: PatchPermissionPublicResponse = client.drive.v2.permission_public.patch(request) + # 发起请求 + response: PatchPermissionPublicResponse = client.drive.v2.permission_public.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v2.permission_public.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v2.permission_public.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ - .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ - .type("doc") \ - .request_body(PermissionPublic.builder() - .external_access_entity("open") - .security_entity("anyone_can_view") - .comment_entity("anyone_can_view") - .share_entity("anyone") - .manage_collaborator_entity("collaborator_can_view") - .link_share_entity("tenant_readable") - .copy_entity("anyone_can_view") - .build()) \ - .build() + # 构造请求对象 + request: PatchPermissionPublicRequest = PatchPermissionPublicRequest.builder() \ + .token("doccnBKgoMyY5OMbUG6FioTXuBe") \ + .type("doc") \ + .request_body(PermissionPublic.builder() + .external_access_entity("open") + .security_entity("anyone_can_view") + .comment_entity("anyone_can_view") + .share_entity("anyone") + .manage_collaborator_entity("collaborator_can_view") + .link_share_entity("tenant_readable") + .copy_entity("anyone_can_view") + .build()) \ + .build() - # 发起请求 - response: PatchPermissionPublicResponse = await client.drive.v2.permission_public.apatch(request) + # 发起请求 + response: PatchPermissionPublicResponse = await client.drive.v2.permission_public.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.drive.v2.permission_public.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.drive.v2.permission_public.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/ehr/v1/get_attachment_sample.py b/samples/api/ehr/v1/get_attachment_sample.py index 5073fbd1b..780a71886 100644 --- a/samples/api/ehr/v1/get_attachment_sample.py +++ b/samples/api/ehr/v1/get_attachment_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .token("09bf7b924f9a4a69875788891b5970d8") \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .token("09bf7b924f9a4a69875788891b5970d8") \ + .build() - # 发起请求 - response: GetAttachmentResponse = client.ehr.v1.attachment.get(request) + # 发起请求 + response: GetAttachmentResponse = client.ehr.v1.attachment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.ehr.v1.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.ehr.v1.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .token("09bf7b924f9a4a69875788891b5970d8") \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .token("09bf7b924f9a4a69875788891b5970d8") \ + .build() - # 发起请求 - response: GetAttachmentResponse = await client.ehr.v1.attachment.aget(request) + # 发起请求 + response: GetAttachmentResponse = await client.ehr.v1.attachment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.ehr.v1.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.ehr.v1.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/ehr/v1/list_employee_sample.py b/samples/api/ehr/v1/list_employee_sample.py index 5e8428735..47d73888b 100644 --- a/samples/api/ehr/v1/list_employee_sample.py +++ b/samples/api/ehr/v1/list_employee_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeRequest = ListEmployeeRequest.builder() \ - .view("basic") \ - .status([]) \ - .type([]) \ - .start_time("1608690517811") \ - .end_time("1608690517811") \ - .user_id_type("user_id") \ - .user_ids([]) \ - .page_token("10") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListEmployeeRequest = ListEmployeeRequest.builder() \ + .view("basic") \ + .status([]) \ + .type([]) \ + .start_time("1608690517811") \ + .end_time("1608690517811") \ + .user_id_type("user_id") \ + .user_ids([]) \ + .page_token("10") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListEmployeeResponse = client.ehr.v1.employee.list(request) + # 发起请求 + response: ListEmployeeResponse = client.ehr.v1.employee.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.ehr.v1.employee.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.ehr.v1.employee.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEmployeeRequest = ListEmployeeRequest.builder() \ - .view("basic") \ - .status([]) \ - .type([]) \ - .start_time("1608690517811") \ - .end_time("1608690517811") \ - .user_id_type("user_id") \ - .user_ids([]) \ - .page_token("10") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListEmployeeRequest = ListEmployeeRequest.builder() \ + .view("basic") \ + .status([]) \ + .type([]) \ + .start_time("1608690517811") \ + .end_time("1608690517811") \ + .user_id_type("user_id") \ + .user_ids([]) \ + .page_token("10") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListEmployeeResponse = await client.ehr.v1.employee.alist(request) + # 发起请求 + response: ListEmployeeResponse = await client.ehr.v1.employee.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.ehr.v1.employee.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.ehr.v1.employee.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/event/v1/list_outbound_ip_sample.py b/samples/api/event/v1/list_outbound_ip_sample.py index 6ab179464..90698130a 100644 --- a/samples/api/event/v1/list_outbound_ip_sample.py +++ b/samples/api/event/v1/list_outbound_ip_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOutboundIpRequest = ListOutboundIpRequest.builder() \ - .page_size(10) \ - .page_token("xxx") \ - .build() + # 构造请求对象 + request: ListOutboundIpRequest = ListOutboundIpRequest.builder() \ + .page_size(10) \ + .page_token("xxx") \ + .build() - # 发起请求 - response: ListOutboundIpResponse = client.event.v1.outbound_ip.list(request) + # 发起请求 + response: ListOutboundIpResponse = client.event.v1.outbound_ip.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.event.v1.outbound_ip.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.event.v1.outbound_ip.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOutboundIpRequest = ListOutboundIpRequest.builder() \ - .page_size(10) \ - .page_token("xxx") \ - .build() + # 构造请求对象 + request: ListOutboundIpRequest = ListOutboundIpRequest.builder() \ + .page_size(10) \ + .page_token("xxx") \ + .build() - # 发起请求 - response: ListOutboundIpResponse = await client.event.v1.outbound_ip.alist(request) + # 发起请求 + response: ListOutboundIpResponse = await client.event.v1.outbound_ip.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.event.v1.outbound_ip.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.event.v1.outbound_ip.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/gray_test_open_sg/v1/create_moto_sample.py b/samples/api/gray_test_open_sg/v1/create_moto_sample.py index 536e7b8c8..55c482ca9 100644 --- a/samples/api/gray_test_open_sg/v1/create_moto_sample.py +++ b/samples/api/gray_test_open_sg/v1/create_moto_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMotoRequest = CreateMotoRequest.builder() \ - .department_id_type("str") \ - .user_id_type("str") \ - .request_body(Level.builder() - .level("str") - .body("str") - .type("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateMotoRequest = CreateMotoRequest.builder() \ + .department_id_type("str") \ + .user_id_type("str") \ + .request_body(Level.builder() + .level("str") + .body("str") + .type("str") + .build()) \ + .build() - # 发起请求 - response: CreateMotoResponse = client.gray_test_open_sg.v1.moto.create(request) + # 发起请求 + response: CreateMotoResponse = client.gray_test_open_sg.v1.moto.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMotoRequest = CreateMotoRequest.builder() \ - .department_id_type("str") \ - .user_id_type("str") \ - .request_body(Level.builder() - .level("str") - .body("str") - .type("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateMotoRequest = CreateMotoRequest.builder() \ + .department_id_type("str") \ + .user_id_type("str") \ + .request_body(Level.builder() + .level("str") + .body("str") + .type("str") + .build()) \ + .build() - # 发起请求 - response: CreateMotoResponse = await client.gray_test_open_sg.v1.moto.acreate(request) + # 发起请求 + response: CreateMotoResponse = await client.gray_test_open_sg.v1.moto.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/gray_test_open_sg/v1/get_moto_sample.py b/samples/api/gray_test_open_sg/v1/get_moto_sample.py index f84f92b8b..64e802287 100644 --- a/samples/api/gray_test_open_sg/v1/get_moto_sample.py +++ b/samples/api/gray_test_open_sg/v1/get_moto_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMotoRequest = GetMotoRequest.builder() \ - .moto_id("1234") \ - .body_level("1234") \ - .build() + # 构造请求对象 + request: GetMotoRequest = GetMotoRequest.builder() \ + .moto_id("1234") \ + .body_level("1234") \ + .build() - # 发起请求 - response: GetMotoResponse = client.gray_test_open_sg.v1.moto.get(request) + # 发起请求 + response: GetMotoResponse = client.gray_test_open_sg.v1.moto.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMotoRequest = GetMotoRequest.builder() \ - .moto_id("1234") \ - .body_level("1234") \ - .build() + # 构造请求对象 + request: GetMotoRequest = GetMotoRequest.builder() \ + .moto_id("1234") \ + .body_level("1234") \ + .build() - # 发起请求 - response: GetMotoResponse = await client.gray_test_open_sg.v1.moto.aget(request) + # 发起请求 + response: GetMotoResponse = await client.gray_test_open_sg.v1.moto.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/gray_test_open_sg/v1/list_moto_sample.py b/samples/api/gray_test_open_sg/v1/list_moto_sample.py index e6a17c983..8d1c91f97 100644 --- a/samples/api/gray_test_open_sg/v1/list_moto_sample.py +++ b/samples/api/gray_test_open_sg/v1/list_moto_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMotoRequest = ListMotoRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .level(int) \ - .build() + # 构造请求对象 + request: ListMotoRequest = ListMotoRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .level(int) \ + .build() - # 发起请求 - response: ListMotoResponse = client.gray_test_open_sg.v1.moto.list(request) + # 发起请求 + response: ListMotoResponse = client.gray_test_open_sg.v1.moto.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMotoRequest = ListMotoRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .level(int) \ - .build() + # 构造请求对象 + request: ListMotoRequest = ListMotoRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .level(int) \ + .build() - # 发起请求 - response: ListMotoResponse = await client.gray_test_open_sg.v1.moto.alist(request) + # 发起请求 + response: ListMotoResponse = await client.gray_test_open_sg.v1.moto.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.gray_test_open_sg.v1.moto.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.gray_test_open_sg.v1.moto.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/agent_email_agent_sample.py b/samples/api/helpdesk/v1/agent_email_agent_sample.py index 5a1313897..1c384353f 100644 --- a/samples/api/helpdesk/v1/agent_email_agent_sample.py +++ b/samples/api/helpdesk/v1/agent_email_agent_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AgentEmailAgentRequest = AgentEmailAgentRequest.builder() \ - .build() + # 构造请求对象 + request: AgentEmailAgentRequest = AgentEmailAgentRequest.builder() \ + .build() - # 发起请求 - response: AgentEmailAgentResponse = client.helpdesk.v1.agent.agent_email(request) + # 发起请求 + response: AgentEmailAgentResponse = client.helpdesk.v1.agent.agent_email(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent.agent_email failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent.agent_email failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AgentEmailAgentRequest = AgentEmailAgentRequest.builder() \ - .build() + # 构造请求对象 + request: AgentEmailAgentRequest = AgentEmailAgentRequest.builder() \ + .build() - # 发起请求 - response: AgentEmailAgentResponse = await client.helpdesk.v1.agent.aagent_email(request) + # 发起请求 + response: AgentEmailAgentResponse = await client.helpdesk.v1.agent.aagent_email(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent.aagent_email failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent.aagent_email failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/answer_user_query_ticket_sample.py b/samples/api/helpdesk/v1/answer_user_query_ticket_sample.py index 546e7ee1c..a09c79ae4 100644 --- a/samples/api/helpdesk/v1/answer_user_query_ticket_sample.py +++ b/samples/api/helpdesk/v1/answer_user_query_ticket_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AnswerUserQueryTicketRequest = AnswerUserQueryTicketRequest.builder() \ - .ticket_id("6945345902185807891") \ - .request_body(AnswerUserQueryTicketRequestBody.builder() - .event_id("abcd") - .faqs([]) - .build()) \ - .build() + # 构造请求对象 + request: AnswerUserQueryTicketRequest = AnswerUserQueryTicketRequest.builder() \ + .ticket_id("6945345902185807891") \ + .request_body(AnswerUserQueryTicketRequestBody.builder() + .event_id("abcd") + .faqs([]) + .build()) \ + .build() - # 发起请求 - response: AnswerUserQueryTicketResponse = client.helpdesk.v1.ticket.answer_user_query(request) + # 发起请求 + response: AnswerUserQueryTicketResponse = client.helpdesk.v1.ticket.answer_user_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.answer_user_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.answer_user_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AnswerUserQueryTicketRequest = AnswerUserQueryTicketRequest.builder() \ - .ticket_id("6945345902185807891") \ - .request_body(AnswerUserQueryTicketRequestBody.builder() - .event_id("abcd") - .faqs([]) - .build()) \ - .build() + # 构造请求对象 + request: AnswerUserQueryTicketRequest = AnswerUserQueryTicketRequest.builder() \ + .ticket_id("6945345902185807891") \ + .request_body(AnswerUserQueryTicketRequestBody.builder() + .event_id("abcd") + .faqs([]) + .build()) \ + .build() - # 发起请求 - response: AnswerUserQueryTicketResponse = await client.helpdesk.v1.ticket.aanswer_user_query(request) + # 发起请求 + response: AnswerUserQueryTicketResponse = await client.helpdesk.v1.ticket.aanswer_user_query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.aanswer_user_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.aanswer_user_query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/cancel_approve_notification_sample.py b/samples/api/helpdesk/v1/cancel_approve_notification_sample.py index caed37c2c..44741ca02 100644 --- a/samples/api/helpdesk/v1/cancel_approve_notification_sample.py +++ b/samples/api/helpdesk/v1/cancel_approve_notification_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelApproveNotificationRequest = CancelApproveNotificationRequest.builder() \ - .notification_id("6981801914270744596") \ - .build() + # 构造请求对象 + request: CancelApproveNotificationRequest = CancelApproveNotificationRequest.builder() \ + .notification_id("6981801914270744596") \ + .build() - # 发起请求 - response: CancelApproveNotificationResponse = client.helpdesk.v1.notification.cancel_approve(request) + # 发起请求 + response: CancelApproveNotificationResponse = client.helpdesk.v1.notification.cancel_approve(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.cancel_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.cancel_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelApproveNotificationRequest = CancelApproveNotificationRequest.builder() \ - .notification_id("6981801914270744596") \ - .build() + # 构造请求对象 + request: CancelApproveNotificationRequest = CancelApproveNotificationRequest.builder() \ + .notification_id("6981801914270744596") \ + .build() - # 发起请求 - response: CancelApproveNotificationResponse = await client.helpdesk.v1.notification.acancel_approve(request) + # 发起请求 + response: CancelApproveNotificationResponse = await client.helpdesk.v1.notification.acancel_approve(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.acancel_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.acancel_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/cancel_send_notification_sample.py b/samples/api/helpdesk/v1/cancel_send_notification_sample.py index a0168bc9b..51b93fa6f 100644 --- a/samples/api/helpdesk/v1/cancel_send_notification_sample.py +++ b/samples/api/helpdesk/v1/cancel_send_notification_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelSendNotificationRequest = CancelSendNotificationRequest.builder() \ - .notification_id("6981801914270744596") \ - .request_body(CancelSendNotificationRequestBody.builder() - .is_recall(True) - .build()) \ - .build() + # 构造请求对象 + request: CancelSendNotificationRequest = CancelSendNotificationRequest.builder() \ + .notification_id("6981801914270744596") \ + .request_body(CancelSendNotificationRequestBody.builder() + .is_recall(True) + .build()) \ + .build() - # 发起请求 - response: CancelSendNotificationResponse = client.helpdesk.v1.notification.cancel_send(request) + # 发起请求 + response: CancelSendNotificationResponse = client.helpdesk.v1.notification.cancel_send(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.cancel_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.cancel_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelSendNotificationRequest = CancelSendNotificationRequest.builder() \ - .notification_id("6981801914270744596") \ - .request_body(CancelSendNotificationRequestBody.builder() - .is_recall(True) - .build()) \ - .build() + # 构造请求对象 + request: CancelSendNotificationRequest = CancelSendNotificationRequest.builder() \ + .notification_id("6981801914270744596") \ + .request_body(CancelSendNotificationRequestBody.builder() + .is_recall(True) + .build()) \ + .build() - # 发起请求 - response: CancelSendNotificationResponse = await client.helpdesk.v1.notification.acancel_send(request) + # 发起请求 + response: CancelSendNotificationResponse = await client.helpdesk.v1.notification.acancel_send(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.acancel_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.acancel_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_agent_schedule_sample.py b/samples/api/helpdesk/v1/create_agent_schedule_sample.py index e5ab3b596..ace0de31b 100644 --- a/samples/api/helpdesk/v1/create_agent_schedule_sample.py +++ b/samples/api/helpdesk/v1/create_agent_schedule_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAgentScheduleRequest = CreateAgentScheduleRequest.builder() \ - .request_body(CreateAgentScheduleRequestBody.builder() - .agent_schedules([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAgentScheduleRequest = CreateAgentScheduleRequest.builder() \ + .request_body(CreateAgentScheduleRequestBody.builder() + .agent_schedules([]) + .build()) \ + .build() - # 发起请求 - response: CreateAgentScheduleResponse = client.helpdesk.v1.agent_schedule.create(request) + # 发起请求 + response: CreateAgentScheduleResponse = client.helpdesk.v1.agent_schedule.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedule.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedule.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAgentScheduleRequest = CreateAgentScheduleRequest.builder() \ - .request_body(CreateAgentScheduleRequestBody.builder() - .agent_schedules([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAgentScheduleRequest = CreateAgentScheduleRequest.builder() \ + .request_body(CreateAgentScheduleRequestBody.builder() + .agent_schedules([]) + .build()) \ + .build() - # 发起请求 - response: CreateAgentScheduleResponse = await client.helpdesk.v1.agent_schedule.acreate(request) + # 发起请求 + response: CreateAgentScheduleResponse = await client.helpdesk.v1.agent_schedule.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedule.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedule.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_agent_skill_sample.py b/samples/api/helpdesk/v1/create_agent_skill_sample.py index 579459318..1f976827c 100644 --- a/samples/api/helpdesk/v1/create_agent_skill_sample.py +++ b/samples/api/helpdesk/v1/create_agent_skill_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAgentSkillRequest = CreateAgentSkillRequest.builder() \ - .request_body(CreateAgentSkillRequestBody.builder() - .name("test-skill") - .rules([]) - .agent_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAgentSkillRequest = CreateAgentSkillRequest.builder() \ + .request_body(CreateAgentSkillRequestBody.builder() + .name("test-skill") + .rules([]) + .agent_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateAgentSkillResponse = client.helpdesk.v1.agent_skill.create(request) + # 发起请求 + response: CreateAgentSkillResponse = client.helpdesk.v1.agent_skill.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAgentSkillRequest = CreateAgentSkillRequest.builder() \ - .request_body(CreateAgentSkillRequestBody.builder() - .name("test-skill") - .rules([]) - .agent_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAgentSkillRequest = CreateAgentSkillRequest.builder() \ + .request_body(CreateAgentSkillRequestBody.builder() + .name("test-skill") + .rules([]) + .agent_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateAgentSkillResponse = await client.helpdesk.v1.agent_skill.acreate(request) + # 发起请求 + response: CreateAgentSkillResponse = await client.helpdesk.v1.agent_skill.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_bot_message_sample.py b/samples/api/helpdesk/v1/create_bot_message_sample.py index 3c114b64c..31ef0edaa 100644 --- a/samples/api/helpdesk/v1/create_bot_message_sample.py +++ b/samples/api/helpdesk/v1/create_bot_message_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBotMessageRequest = CreateBotMessageRequest.builder() \ - .user_id_type("user_id") \ - .request_body(BotMessage.builder() - .msg_type("post") - .content("") - .receiver_id("ou_7346484524") - .receive_type("chat") - .build()) \ - .build() + # 构造请求对象 + request: CreateBotMessageRequest = CreateBotMessageRequest.builder() \ + .user_id_type("user_id") \ + .request_body(BotMessage.builder() + .msg_type("post") + .content("") + .receiver_id("ou_7346484524") + .receive_type("chat") + .build()) \ + .build() - # 发起请求 - response: CreateBotMessageResponse = client.helpdesk.v1.bot_message.create(request) + # 发起请求 + response: CreateBotMessageResponse = client.helpdesk.v1.bot_message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.bot_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.bot_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBotMessageRequest = CreateBotMessageRequest.builder() \ - .user_id_type("user_id") \ - .request_body(BotMessage.builder() - .msg_type("post") - .content("") - .receiver_id("ou_7346484524") - .receive_type("chat") - .build()) \ - .build() + # 构造请求对象 + request: CreateBotMessageRequest = CreateBotMessageRequest.builder() \ + .user_id_type("user_id") \ + .request_body(BotMessage.builder() + .msg_type("post") + .content("") + .receiver_id("ou_7346484524") + .receive_type("chat") + .build()) \ + .build() - # 发起请求 - response: CreateBotMessageResponse = await client.helpdesk.v1.bot_message.acreate(request) + # 发起请求 + response: CreateBotMessageResponse = await client.helpdesk.v1.bot_message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.bot_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.bot_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_category_sample.py b/samples/api/helpdesk/v1/create_category_sample.py index 810c1b72e..bacabafdb 100644 --- a/samples/api/helpdesk/v1/create_category_sample.py +++ b/samples/api/helpdesk/v1/create_category_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCategoryRequest = CreateCategoryRequest.builder() \ - .request_body(Category.builder() - .name("str") - .parent_id("str") - .language("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateCategoryRequest = CreateCategoryRequest.builder() \ + .request_body(Category.builder() + .name("str") + .parent_id("str") + .language("str") + .build()) \ + .build() - # 发起请求 - response: CreateCategoryResponse = client.helpdesk.v1.category.create(request) + # 发起请求 + response: CreateCategoryResponse = client.helpdesk.v1.category.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCategoryRequest = CreateCategoryRequest.builder() \ - .request_body(Category.builder() - .name("str") - .parent_id("str") - .language("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateCategoryRequest = CreateCategoryRequest.builder() \ + .request_body(Category.builder() + .name("str") + .parent_id("str") + .language("str") + .build()) \ + .build() - # 发起请求 - response: CreateCategoryResponse = await client.helpdesk.v1.category.acreate(request) + # 发起请求 + response: CreateCategoryResponse = await client.helpdesk.v1.category.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_faq_sample.py b/samples/api/helpdesk/v1/create_faq_sample.py index aa35dc092..d189461a1 100644 --- a/samples/api/helpdesk/v1/create_faq_sample.py +++ b/samples/api/helpdesk/v1/create_faq_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFaqRequest = CreateFaqRequest.builder() \ - .request_body(CreateFaqRequestBody.builder() - .faq(FaqCreateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateFaqRequest = CreateFaqRequest.builder() \ + .request_body(CreateFaqRequestBody.builder() + .faq(FaqCreateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateFaqResponse = client.helpdesk.v1.faq.create(request) + # 发起请求 + response: CreateFaqResponse = client.helpdesk.v1.faq.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateFaqRequest = CreateFaqRequest.builder() \ - .request_body(CreateFaqRequestBody.builder() - .faq(FaqCreateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateFaqRequest = CreateFaqRequest.builder() \ + .request_body(CreateFaqRequestBody.builder() + .faq(FaqCreateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateFaqResponse = await client.helpdesk.v1.faq.acreate(request) + # 发起请求 + response: CreateFaqResponse = await client.helpdesk.v1.faq.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_notification_sample.py b/samples/api/helpdesk/v1/create_notification_sample.py index 609509ea7..63a2c8b4d 100644 --- a/samples/api/helpdesk/v1/create_notification_sample.py +++ b/samples/api/helpdesk/v1/create_notification_sample.py @@ -5,102 +5,102 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNotificationRequest = CreateNotificationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Notification.builder() - .id("6981801914270744596") - .job_name("测试推送任务") - .status(0) - .create_user(NotificationUser.builder().build()) - .created_at("1626332244719") - .update_user(NotificationUser.builder().build()) - .updated_at("1626332244719") - .target_user_count(1) - .sent_user_count(1) - .read_user_count(1) - .send_at("1626332244719") - .push_content("") - .push_type(0) - .push_scope_type(0) - .new_staff_scope_type(0) - .new_staff_scope_department_list([]) - .user_list([]) - .department_list([]) - .chat_list([]) - .ext("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateNotificationRequest = CreateNotificationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Notification.builder() + .id("6981801914270744596") + .job_name("测试推送任务") + .status(0) + .create_user(NotificationUser.builder().build()) + .created_at("1626332244719") + .update_user(NotificationUser.builder().build()) + .updated_at("1626332244719") + .target_user_count(1) + .sent_user_count(1) + .read_user_count(1) + .send_at("1626332244719") + .push_content("") + .push_type(0) + .push_scope_type(0) + .new_staff_scope_type(0) + .new_staff_scope_department_list([]) + .user_list([]) + .department_list([]) + .chat_list([]) + .ext("{}") + .build()) \ + .build() - # 发起请求 - response: CreateNotificationResponse = client.helpdesk.v1.notification.create(request) + # 发起请求 + response: CreateNotificationResponse = client.helpdesk.v1.notification.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNotificationRequest = CreateNotificationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Notification.builder() - .id("6981801914270744596") - .job_name("测试推送任务") - .status(0) - .create_user(NotificationUser.builder().build()) - .created_at("1626332244719") - .update_user(NotificationUser.builder().build()) - .updated_at("1626332244719") - .target_user_count(1) - .sent_user_count(1) - .read_user_count(1) - .send_at("1626332244719") - .push_content("") - .push_type(0) - .push_scope_type(0) - .new_staff_scope_type(0) - .new_staff_scope_department_list([]) - .user_list([]) - .department_list([]) - .chat_list([]) - .ext("{}") - .build()) \ - .build() + # 构造请求对象 + request: CreateNotificationRequest = CreateNotificationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Notification.builder() + .id("6981801914270744596") + .job_name("测试推送任务") + .status(0) + .create_user(NotificationUser.builder().build()) + .created_at("1626332244719") + .update_user(NotificationUser.builder().build()) + .updated_at("1626332244719") + .target_user_count(1) + .sent_user_count(1) + .read_user_count(1) + .send_at("1626332244719") + .push_content("") + .push_type(0) + .push_scope_type(0) + .new_staff_scope_type(0) + .new_staff_scope_department_list([]) + .user_list([]) + .department_list([]) + .chat_list([]) + .ext("{}") + .build()) \ + .build() - # 发起请求 - response: CreateNotificationResponse = await client.helpdesk.v1.notification.acreate(request) + # 发起请求 + response: CreateNotificationResponse = await client.helpdesk.v1.notification.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_ticket_customized_field_sample.py b/samples/api/helpdesk/v1/create_ticket_customized_field_sample.py index 38c0b804c..be38fe343 100644 --- a/samples/api/helpdesk/v1/create_ticket_customized_field_sample.py +++ b/samples/api/helpdesk/v1/create_ticket_customized_field_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTicketCustomizedFieldRequest = CreateTicketCustomizedFieldRequest.builder() \ - .request_body(TicketCustomizedField.builder() - .helpdesk_id("str") - .key_name("str") - .display_name("str") - .position("str") - .field_type("str") - .description("str") - .visible(bool) - .editable(bool) - .required(bool) - .dropdown_allow_multiple(bool) - .build()) \ - .build() + # 构造请求对象 + request: CreateTicketCustomizedFieldRequest = CreateTicketCustomizedFieldRequest.builder() \ + .request_body(TicketCustomizedField.builder() + .helpdesk_id("str") + .key_name("str") + .display_name("str") + .position("str") + .field_type("str") + .description("str") + .visible(bool) + .editable(bool) + .required(bool) + .dropdown_allow_multiple(bool) + .build()) \ + .build() - # 发起请求 - response: CreateTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.create(request) + # 发起请求 + response: CreateTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTicketCustomizedFieldRequest = CreateTicketCustomizedFieldRequest.builder() \ - .request_body(TicketCustomizedField.builder() - .helpdesk_id("str") - .key_name("str") - .display_name("str") - .position("str") - .field_type("str") - .description("str") - .visible(bool) - .editable(bool) - .required(bool) - .dropdown_allow_multiple(bool) - .build()) \ - .build() + # 构造请求对象 + request: CreateTicketCustomizedFieldRequest = CreateTicketCustomizedFieldRequest.builder() \ + .request_body(TicketCustomizedField.builder() + .helpdesk_id("str") + .key_name("str") + .display_name("str") + .position("str") + .field_type("str") + .description("str") + .visible(bool) + .editable(bool) + .required(bool) + .dropdown_allow_multiple(bool) + .build()) \ + .build() - # 发起请求 - response: CreateTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.acreate(request) + # 发起请求 + response: CreateTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/create_ticket_message_sample.py b/samples/api/helpdesk/v1/create_ticket_message_sample.py index 352f9665a..85e7b9939 100644 --- a/samples/api/helpdesk/v1/create_ticket_message_sample.py +++ b/samples/api/helpdesk/v1/create_ticket_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTicketMessageRequest = CreateTicketMessageRequest.builder() \ - .ticket_id("6948728206392295444") \ - .request_body(CreateTicketMessageRequestBody.builder() - .msg_type("post") - .content("") - .build()) \ - .build() + # 构造请求对象 + request: CreateTicketMessageRequest = CreateTicketMessageRequest.builder() \ + .ticket_id("6948728206392295444") \ + .request_body(CreateTicketMessageRequestBody.builder() + .msg_type("post") + .content("") + .build()) \ + .build() - # 发起请求 - response: CreateTicketMessageResponse = client.helpdesk.v1.ticket_message.create(request) + # 发起请求 + response: CreateTicketMessageResponse = client.helpdesk.v1.ticket_message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTicketMessageRequest = CreateTicketMessageRequest.builder() \ - .ticket_id("6948728206392295444") \ - .request_body(CreateTicketMessageRequestBody.builder() - .msg_type("post") - .content("") - .build()) \ - .build() + # 构造请求对象 + request: CreateTicketMessageRequest = CreateTicketMessageRequest.builder() \ + .ticket_id("6948728206392295444") \ + .request_body(CreateTicketMessageRequestBody.builder() + .msg_type("post") + .content("") + .build()) \ + .build() - # 发起请求 - response: CreateTicketMessageResponse = await client.helpdesk.v1.ticket_message.acreate(request) + # 发起请求 + response: CreateTicketMessageResponse = await client.helpdesk.v1.ticket_message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/customized_fields_ticket_sample.py b/samples/api/helpdesk/v1/customized_fields_ticket_sample.py index 8ebafde57..6a1e8d059 100644 --- a/samples/api/helpdesk/v1/customized_fields_ticket_sample.py +++ b/samples/api/helpdesk/v1/customized_fields_ticket_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CustomizedFieldsTicketRequest = CustomizedFieldsTicketRequest.builder() \ - .visible_only(True) \ - .build() + # 构造请求对象 + request: CustomizedFieldsTicketRequest = CustomizedFieldsTicketRequest.builder() \ + .visible_only(True) \ + .build() - # 发起请求 - response: CustomizedFieldsTicketResponse = client.helpdesk.v1.ticket.customized_fields(request) + # 发起请求 + response: CustomizedFieldsTicketResponse = client.helpdesk.v1.ticket.customized_fields(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.customized_fields failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.customized_fields failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CustomizedFieldsTicketRequest = CustomizedFieldsTicketRequest.builder() \ - .visible_only(True) \ - .build() + # 构造请求对象 + request: CustomizedFieldsTicketRequest = CustomizedFieldsTicketRequest.builder() \ + .visible_only(True) \ + .build() - # 发起请求 - response: CustomizedFieldsTicketResponse = await client.helpdesk.v1.ticket.acustomized_fields(request) + # 发起请求 + response: CustomizedFieldsTicketResponse = await client.helpdesk.v1.ticket.acustomized_fields(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.acustomized_fields failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.acustomized_fields failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/delete_agent_schedules_sample.py b/samples/api/helpdesk/v1/delete_agent_schedules_sample.py index 0b7160366..9a2e6537e 100644 --- a/samples/api/helpdesk/v1/delete_agent_schedules_sample.py +++ b/samples/api/helpdesk/v1/delete_agent_schedules_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAgentSchedulesRequest = DeleteAgentSchedulesRequest.builder() \ - .agent_id("12345") \ - .build() + # 构造请求对象 + request: DeleteAgentSchedulesRequest = DeleteAgentSchedulesRequest.builder() \ + .agent_id("12345") \ + .build() - # 发起请求 - response: DeleteAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.delete(request) + # 发起请求 + response: DeleteAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAgentSchedulesRequest = DeleteAgentSchedulesRequest.builder() \ - .agent_id("12345") \ - .build() + # 构造请求对象 + request: DeleteAgentSchedulesRequest = DeleteAgentSchedulesRequest.builder() \ + .agent_id("12345") \ + .build() - # 发起请求 - response: DeleteAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.adelete(request) + # 发起请求 + response: DeleteAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/delete_agent_skill_sample.py b/samples/api/helpdesk/v1/delete_agent_skill_sample.py index 40196df0c..8234f7106 100644 --- a/samples/api/helpdesk/v1/delete_agent_skill_sample.py +++ b/samples/api/helpdesk/v1/delete_agent_skill_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAgentSkillRequest = DeleteAgentSkillRequest.builder() \ - .agent_skill_id("test-skill-id") \ - .build() + # 构造请求对象 + request: DeleteAgentSkillRequest = DeleteAgentSkillRequest.builder() \ + .agent_skill_id("test-skill-id") \ + .build() - # 发起请求 - response: DeleteAgentSkillResponse = client.helpdesk.v1.agent_skill.delete(request) + # 发起请求 + response: DeleteAgentSkillResponse = client.helpdesk.v1.agent_skill.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAgentSkillRequest = DeleteAgentSkillRequest.builder() \ - .agent_skill_id("test-skill-id") \ - .build() + # 构造请求对象 + request: DeleteAgentSkillRequest = DeleteAgentSkillRequest.builder() \ + .agent_skill_id("test-skill-id") \ + .build() - # 发起请求 - response: DeleteAgentSkillResponse = await client.helpdesk.v1.agent_skill.adelete(request) + # 发起请求 + response: DeleteAgentSkillResponse = await client.helpdesk.v1.agent_skill.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/delete_category_sample.py b/samples/api/helpdesk/v1/delete_category_sample.py index 54753f782..9c2ec512d 100644 --- a/samples/api/helpdesk/v1/delete_category_sample.py +++ b/samples/api/helpdesk/v1/delete_category_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCategoryRequest = DeleteCategoryRequest.builder() \ - .id("6948728206392295444") \ - .build() + # 构造请求对象 + request: DeleteCategoryRequest = DeleteCategoryRequest.builder() \ + .id("6948728206392295444") \ + .build() - # 发起请求 - response: DeleteCategoryResponse = client.helpdesk.v1.category.delete(request) + # 发起请求 + response: DeleteCategoryResponse = client.helpdesk.v1.category.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCategoryRequest = DeleteCategoryRequest.builder() \ - .id("6948728206392295444") \ - .build() + # 构造请求对象 + request: DeleteCategoryRequest = DeleteCategoryRequest.builder() \ + .id("6948728206392295444") \ + .build() - # 发起请求 - response: DeleteCategoryResponse = await client.helpdesk.v1.category.adelete(request) + # 发起请求 + response: DeleteCategoryResponse = await client.helpdesk.v1.category.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/delete_faq_sample.py b/samples/api/helpdesk/v1/delete_faq_sample.py index 4b466e766..d64596795 100644 --- a/samples/api/helpdesk/v1/delete_faq_sample.py +++ b/samples/api/helpdesk/v1/delete_faq_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFaqRequest = DeleteFaqRequest.builder() \ - .id("12345") \ - .build() + # 构造请求对象 + request: DeleteFaqRequest = DeleteFaqRequest.builder() \ + .id("12345") \ + .build() - # 发起请求 - response: DeleteFaqResponse = client.helpdesk.v1.faq.delete(request) + # 发起请求 + response: DeleteFaqResponse = client.helpdesk.v1.faq.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteFaqRequest = DeleteFaqRequest.builder() \ - .id("12345") \ - .build() + # 构造请求对象 + request: DeleteFaqRequest = DeleteFaqRequest.builder() \ + .id("12345") \ + .build() - # 发起请求 - response: DeleteFaqResponse = await client.helpdesk.v1.faq.adelete(request) + # 发起请求 + response: DeleteFaqResponse = await client.helpdesk.v1.faq.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/delete_ticket_customized_field_sample.py b/samples/api/helpdesk/v1/delete_ticket_customized_field_sample.py index d21cba0a8..a72eedcaa 100644 --- a/samples/api/helpdesk/v1/delete_ticket_customized_field_sample.py +++ b/samples/api/helpdesk/v1/delete_ticket_customized_field_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTicketCustomizedFieldRequest = DeleteTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .build() + # 构造请求对象 + request: DeleteTicketCustomizedFieldRequest = DeleteTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .build() - # 发起请求 - response: DeleteTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.delete(request) + # 发起请求 + response: DeleteTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTicketCustomizedFieldRequest = DeleteTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .build() + # 构造请求对象 + request: DeleteTicketCustomizedFieldRequest = DeleteTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .build() - # 发起请求 - response: DeleteTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.adelete(request) + # 发起请求 + response: DeleteTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/execute_send_notification_sample.py b/samples/api/helpdesk/v1/execute_send_notification_sample.py index d3a28a38e..4eb597160 100644 --- a/samples/api/helpdesk/v1/execute_send_notification_sample.py +++ b/samples/api/helpdesk/v1/execute_send_notification_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ExecuteSendNotificationRequest = ExecuteSendNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .request_body(ExecuteSendNotificationRequestBody.builder() - .send_at("1624326025000") - .build()) \ - .build() + # 构造请求对象 + request: ExecuteSendNotificationRequest = ExecuteSendNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .request_body(ExecuteSendNotificationRequestBody.builder() + .send_at("1624326025000") + .build()) \ + .build() - # 发起请求 - response: ExecuteSendNotificationResponse = client.helpdesk.v1.notification.execute_send(request) + # 发起请求 + response: ExecuteSendNotificationResponse = client.helpdesk.v1.notification.execute_send(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.execute_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.execute_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ExecuteSendNotificationRequest = ExecuteSendNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .request_body(ExecuteSendNotificationRequestBody.builder() - .send_at("1624326025000") - .build()) \ - .build() + # 构造请求对象 + request: ExecuteSendNotificationRequest = ExecuteSendNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .request_body(ExecuteSendNotificationRequestBody.builder() + .send_at("1624326025000") + .build()) \ + .build() - # 发起请求 - response: ExecuteSendNotificationResponse = await client.helpdesk.v1.notification.aexecute_send(request) + # 发起请求 + response: ExecuteSendNotificationResponse = await client.helpdesk.v1.notification.aexecute_send(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.aexecute_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.aexecute_send failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/faq_image_faq_sample.py b/samples/api/helpdesk/v1/faq_image_faq_sample.py index d4aa79d97..f8f6644f9 100644 --- a/samples/api/helpdesk/v1/faq_image_faq_sample.py +++ b/samples/api/helpdesk/v1/faq_image_faq_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FaqImageFaqRequest = FaqImageFaqRequest.builder() \ - .id("12345") \ - .image_key("img_b07ffac0-19c1-48a3-afca-599f8ea825fj") \ - .build() + # 构造请求对象 + request: FaqImageFaqRequest = FaqImageFaqRequest.builder() \ + .id("12345") \ + .image_key("img_b07ffac0-19c1-48a3-afca-599f8ea825fj") \ + .build() - # 发起请求 - response: FaqImageFaqResponse = client.helpdesk.v1.faq.faq_image(request) + # 发起请求 + response: FaqImageFaqResponse = client.helpdesk.v1.faq.faq_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.faq_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.faq_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FaqImageFaqRequest = FaqImageFaqRequest.builder() \ - .id("12345") \ - .image_key("img_b07ffac0-19c1-48a3-afca-599f8ea825fj") \ - .build() + # 构造请求对象 + request: FaqImageFaqRequest = FaqImageFaqRequest.builder() \ + .id("12345") \ + .image_key("img_b07ffac0-19c1-48a3-afca-599f8ea825fj") \ + .build() - # 发起请求 - response: FaqImageFaqResponse = await client.helpdesk.v1.faq.afaq_image(request) + # 发起请求 + response: FaqImageFaqResponse = await client.helpdesk.v1.faq.afaq_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.afaq_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.afaq_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_agent_schedules_sample.py b/samples/api/helpdesk/v1/get_agent_schedules_sample.py index b4b0766eb..e9ed5fd83 100644 --- a/samples/api/helpdesk/v1/get_agent_schedules_sample.py +++ b/samples/api/helpdesk/v1/get_agent_schedules_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgentSchedulesRequest = GetAgentSchedulesRequest.builder() \ - .agent_id(" 客服 id") \ - .build() + # 构造请求对象 + request: GetAgentSchedulesRequest = GetAgentSchedulesRequest.builder() \ + .agent_id(" 客服 id") \ + .build() - # 发起请求 - response: GetAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.get(request) + # 发起请求 + response: GetAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgentSchedulesRequest = GetAgentSchedulesRequest.builder() \ - .agent_id(" 客服 id") \ - .build() + # 构造请求对象 + request: GetAgentSchedulesRequest = GetAgentSchedulesRequest.builder() \ + .agent_id(" 客服 id") \ + .build() - # 发起请求 - response: GetAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.aget(request) + # 发起请求 + response: GetAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_agent_skill_sample.py b/samples/api/helpdesk/v1/get_agent_skill_sample.py index 1c37948f3..ad2017051 100644 --- a/samples/api/helpdesk/v1/get_agent_skill_sample.py +++ b/samples/api/helpdesk/v1/get_agent_skill_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgentSkillRequest = GetAgentSkillRequest.builder() \ - .agent_skill_id("6941215891786825756") \ - .build() + # 构造请求对象 + request: GetAgentSkillRequest = GetAgentSkillRequest.builder() \ + .agent_skill_id("6941215891786825756") \ + .build() - # 发起请求 - response: GetAgentSkillResponse = client.helpdesk.v1.agent_skill.get(request) + # 发起请求 + response: GetAgentSkillResponse = client.helpdesk.v1.agent_skill.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgentSkillRequest = GetAgentSkillRequest.builder() \ - .agent_skill_id("6941215891786825756") \ - .build() + # 构造请求对象 + request: GetAgentSkillRequest = GetAgentSkillRequest.builder() \ + .agent_skill_id("6941215891786825756") \ + .build() - # 发起请求 - response: GetAgentSkillResponse = await client.helpdesk.v1.agent_skill.aget(request) + # 发起请求 + response: GetAgentSkillResponse = await client.helpdesk.v1.agent_skill.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_category_sample.py b/samples/api/helpdesk/v1/get_category_sample.py index 9ad0fe3b6..b7e38a259 100644 --- a/samples/api/helpdesk/v1/get_category_sample.py +++ b/samples/api/helpdesk/v1/get_category_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCategoryRequest = GetCategoryRequest.builder() \ - .id("6948728206392295444") \ - .build() + # 构造请求对象 + request: GetCategoryRequest = GetCategoryRequest.builder() \ + .id("6948728206392295444") \ + .build() - # 发起请求 - response: GetCategoryResponse = client.helpdesk.v1.category.get(request) + # 发起请求 + response: GetCategoryResponse = client.helpdesk.v1.category.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCategoryRequest = GetCategoryRequest.builder() \ - .id("6948728206392295444") \ - .build() + # 构造请求对象 + request: GetCategoryRequest = GetCategoryRequest.builder() \ + .id("6948728206392295444") \ + .build() - # 发起请求 - response: GetCategoryResponse = await client.helpdesk.v1.category.aget(request) + # 发起请求 + response: GetCategoryResponse = await client.helpdesk.v1.category.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_faq_sample.py b/samples/api/helpdesk/v1/get_faq_sample.py index 03ec4b53e..07ed32818 100644 --- a/samples/api/helpdesk/v1/get_faq_sample.py +++ b/samples/api/helpdesk/v1/get_faq_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFaqRequest = GetFaqRequest.builder() \ - .id("6856395634652479491") \ - .build() + # 构造请求对象 + request: GetFaqRequest = GetFaqRequest.builder() \ + .id("6856395634652479491") \ + .build() - # 发起请求 - response: GetFaqResponse = client.helpdesk.v1.faq.get(request) + # 发起请求 + response: GetFaqResponse = client.helpdesk.v1.faq.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFaqRequest = GetFaqRequest.builder() \ - .id("6856395634652479491") \ - .build() + # 构造请求对象 + request: GetFaqRequest = GetFaqRequest.builder() \ + .id("6856395634652479491") \ + .build() - # 发起请求 - response: GetFaqResponse = await client.helpdesk.v1.faq.aget(request) + # 发起请求 + response: GetFaqResponse = await client.helpdesk.v1.faq.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_notification_sample.py b/samples/api/helpdesk/v1/get_notification_sample.py index e73e77d62..129efbf9c 100644 --- a/samples/api/helpdesk/v1/get_notification_sample.py +++ b/samples/api/helpdesk/v1/get_notification_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNotificationRequest = GetNotificationRequest.builder() \ - .notification_id("1624326025000") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetNotificationRequest = GetNotificationRequest.builder() \ + .notification_id("1624326025000") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetNotificationResponse = client.helpdesk.v1.notification.get(request) + # 发起请求 + response: GetNotificationResponse = client.helpdesk.v1.notification.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNotificationRequest = GetNotificationRequest.builder() \ - .notification_id("1624326025000") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetNotificationRequest = GetNotificationRequest.builder() \ + .notification_id("1624326025000") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetNotificationResponse = await client.helpdesk.v1.notification.aget(request) + # 发起请求 + response: GetNotificationResponse = await client.helpdesk.v1.notification.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_ticket_customized_field_sample.py b/samples/api/helpdesk/v1/get_ticket_customized_field_sample.py index 4bea8749b..579b4e741 100644 --- a/samples/api/helpdesk/v1/get_ticket_customized_field_sample.py +++ b/samples/api/helpdesk/v1/get_ticket_customized_field_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTicketCustomizedFieldRequest = GetTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .build() + # 构造请求对象 + request: GetTicketCustomizedFieldRequest = GetTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .build() - # 发起请求 - response: GetTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.get(request) + # 发起请求 + response: GetTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTicketCustomizedFieldRequest = GetTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .build() + # 构造请求对象 + request: GetTicketCustomizedFieldRequest = GetTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .build() - # 发起请求 - response: GetTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.aget(request) + # 发起请求 + response: GetTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/get_ticket_sample.py b/samples/api/helpdesk/v1/get_ticket_sample.py index ee2a701b2..3e79e39f7 100644 --- a/samples/api/helpdesk/v1/get_ticket_sample.py +++ b/samples/api/helpdesk/v1/get_ticket_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTicketRequest = GetTicketRequest.builder() \ - .ticket_id("123456") \ - .build() + # 构造请求对象 + request: GetTicketRequest = GetTicketRequest.builder() \ + .ticket_id("123456") \ + .build() - # 发起请求 - response: GetTicketResponse = client.helpdesk.v1.ticket.get(request) + # 发起请求 + response: GetTicketResponse = client.helpdesk.v1.ticket.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTicketRequest = GetTicketRequest.builder() \ - .ticket_id("123456") \ - .build() + # 构造请求对象 + request: GetTicketRequest = GetTicketRequest.builder() \ + .ticket_id("123456") \ + .build() - # 发起请求 - response: GetTicketResponse = await client.helpdesk.v1.ticket.aget(request) + # 发起请求 + response: GetTicketResponse = await client.helpdesk.v1.ticket.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_agent_schedule_sample.py b/samples/api/helpdesk/v1/list_agent_schedule_sample.py index 9984aa28a..74c66af2b 100644 --- a/samples/api/helpdesk/v1/list_agent_schedule_sample.py +++ b/samples/api/helpdesk/v1/list_agent_schedule_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentScheduleRequest = ListAgentScheduleRequest.builder() \ - .status([]) \ - .build() + # 构造请求对象 + request: ListAgentScheduleRequest = ListAgentScheduleRequest.builder() \ + .status([]) \ + .build() - # 发起请求 - response: ListAgentScheduleResponse = client.helpdesk.v1.agent_schedule.list(request) + # 发起请求 + response: ListAgentScheduleResponse = client.helpdesk.v1.agent_schedule.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentScheduleRequest = ListAgentScheduleRequest.builder() \ - .status([]) \ - .build() + # 构造请求对象 + request: ListAgentScheduleRequest = ListAgentScheduleRequest.builder() \ + .status([]) \ + .build() - # 发起请求 - response: ListAgentScheduleResponse = await client.helpdesk.v1.agent_schedule.alist(request) + # 发起请求 + response: ListAgentScheduleResponse = await client.helpdesk.v1.agent_schedule.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_agent_skill_rule_sample.py b/samples/api/helpdesk/v1/list_agent_skill_rule_sample.py index 6a1126590..853e24ee0 100644 --- a/samples/api/helpdesk/v1/list_agent_skill_rule_sample.py +++ b/samples/api/helpdesk/v1/list_agent_skill_rule_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentSkillRuleRequest = ListAgentSkillRuleRequest.builder() \ - .build() + # 构造请求对象 + request: ListAgentSkillRuleRequest = ListAgentSkillRuleRequest.builder() \ + .build() - # 发起请求 - response: ListAgentSkillRuleResponse = client.helpdesk.v1.agent_skill_rule.list(request) + # 发起请求 + response: ListAgentSkillRuleResponse = client.helpdesk.v1.agent_skill_rule.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentSkillRuleRequest = ListAgentSkillRuleRequest.builder() \ - .build() + # 构造请求对象 + request: ListAgentSkillRuleRequest = ListAgentSkillRuleRequest.builder() \ + .build() - # 发起请求 - response: ListAgentSkillRuleResponse = await client.helpdesk.v1.agent_skill_rule.alist(request) + # 发起请求 + response: ListAgentSkillRuleResponse = await client.helpdesk.v1.agent_skill_rule.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_agent_skill_sample.py b/samples/api/helpdesk/v1/list_agent_skill_sample.py index 9d54f0875..a559a93c7 100644 --- a/samples/api/helpdesk/v1/list_agent_skill_sample.py +++ b/samples/api/helpdesk/v1/list_agent_skill_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentSkillRequest = ListAgentSkillRequest.builder() \ - .build() + # 构造请求对象 + request: ListAgentSkillRequest = ListAgentSkillRequest.builder() \ + .build() - # 发起请求 - response: ListAgentSkillResponse = client.helpdesk.v1.agent_skill.list(request) + # 发起请求 + response: ListAgentSkillResponse = client.helpdesk.v1.agent_skill.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAgentSkillRequest = ListAgentSkillRequest.builder() \ - .build() + # 构造请求对象 + request: ListAgentSkillRequest = ListAgentSkillRequest.builder() \ + .build() - # 发起请求 - response: ListAgentSkillResponse = await client.helpdesk.v1.agent_skill.alist(request) + # 发起请求 + response: ListAgentSkillResponse = await client.helpdesk.v1.agent_skill.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_category_sample.py b/samples/api/helpdesk/v1/list_category_sample.py index 771a10073..021114c7d 100644 --- a/samples/api/helpdesk/v1/list_category_sample.py +++ b/samples/api/helpdesk/v1/list_category_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCategoryRequest = ListCategoryRequest.builder() \ - .lang("zh_cn") \ - .order_by(1) \ - .asc(True) \ - .build() + # 构造请求对象 + request: ListCategoryRequest = ListCategoryRequest.builder() \ + .lang("zh_cn") \ + .order_by(1) \ + .asc(True) \ + .build() - # 发起请求 - response: ListCategoryResponse = client.helpdesk.v1.category.list(request) + # 发起请求 + response: ListCategoryResponse = client.helpdesk.v1.category.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCategoryRequest = ListCategoryRequest.builder() \ - .lang("zh_cn") \ - .order_by(1) \ - .asc(True) \ - .build() + # 构造请求对象 + request: ListCategoryRequest = ListCategoryRequest.builder() \ + .lang("zh_cn") \ + .order_by(1) \ + .asc(True) \ + .build() - # 发起请求 - response: ListCategoryResponse = await client.helpdesk.v1.category.alist(request) + # 发起请求 + response: ListCategoryResponse = await client.helpdesk.v1.category.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_faq_sample.py b/samples/api/helpdesk/v1/list_faq_sample.py index 1f5e5f554..ab3a5dc1a 100644 --- a/samples/api/helpdesk/v1/list_faq_sample.py +++ b/samples/api/helpdesk/v1/list_faq_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFaqRequest = ListFaqRequest.builder() \ - .category_id("6856395522433908739") \ - .status("1") \ - .search("点餐") \ - .page_token("6856395634652479491") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListFaqRequest = ListFaqRequest.builder() \ + .category_id("6856395522433908739") \ + .status("1") \ + .search("点餐") \ + .page_token("6856395634652479491") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListFaqResponse = client.helpdesk.v1.faq.list(request) + # 发起请求 + response: ListFaqResponse = client.helpdesk.v1.faq.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListFaqRequest = ListFaqRequest.builder() \ - .category_id("6856395522433908739") \ - .status("1") \ - .search("点餐") \ - .page_token("6856395634652479491") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListFaqRequest = ListFaqRequest.builder() \ + .category_id("6856395522433908739") \ + .status("1") \ + .search("点餐") \ + .page_token("6856395634652479491") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListFaqResponse = await client.helpdesk.v1.faq.alist(request) + # 发起请求 + response: ListFaqResponse = await client.helpdesk.v1.faq.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_ticket_customized_field_sample.py b/samples/api/helpdesk/v1/list_ticket_customized_field_sample.py index cbefcfd68..d5210d5b6 100644 --- a/samples/api/helpdesk/v1/list_ticket_customized_field_sample.py +++ b/samples/api/helpdesk/v1/list_ticket_customized_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketCustomizedFieldRequest = ListTicketCustomizedFieldRequest.builder() \ - .page_token("6948728206392295444") \ - .page_size(20) \ - .request_body(ListTicketCustomizedFieldRequestBody.builder() - .visible(True) - .build()) \ - .build() + # 构造请求对象 + request: ListTicketCustomizedFieldRequest = ListTicketCustomizedFieldRequest.builder() \ + .page_token("6948728206392295444") \ + .page_size(20) \ + .request_body(ListTicketCustomizedFieldRequestBody.builder() + .visible(True) + .build()) \ + .build() - # 发起请求 - response: ListTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.list(request) + # 发起请求 + response: ListTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketCustomizedFieldRequest = ListTicketCustomizedFieldRequest.builder() \ - .page_token("6948728206392295444") \ - .page_size(20) \ - .request_body(ListTicketCustomizedFieldRequestBody.builder() - .visible(True) - .build()) \ - .build() + # 构造请求对象 + request: ListTicketCustomizedFieldRequest = ListTicketCustomizedFieldRequest.builder() \ + .page_token("6948728206392295444") \ + .page_size(20) \ + .request_body(ListTicketCustomizedFieldRequestBody.builder() + .visible(True) + .build()) \ + .build() - # 发起请求 - response: ListTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.alist(request) + # 发起请求 + response: ListTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_ticket_message_sample.py b/samples/api/helpdesk/v1/list_ticket_message_sample.py index 72cbc7f60..09203cea8 100644 --- a/samples/api/helpdesk/v1/list_ticket_message_sample.py +++ b/samples/api/helpdesk/v1/list_ticket_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketMessageRequest = ListTicketMessageRequest.builder() \ - .ticket_id("6948728206392295444") \ - .time_start(1617960686) \ - .time_end(1617960687) \ - .page(1) \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListTicketMessageRequest = ListTicketMessageRequest.builder() \ + .ticket_id("6948728206392295444") \ + .time_start(1617960686) \ + .time_end(1617960687) \ + .page(1) \ + .page_size(10) \ + .build() - # 发起请求 - response: ListTicketMessageResponse = client.helpdesk.v1.ticket_message.list(request) + # 发起请求 + response: ListTicketMessageResponse = client.helpdesk.v1.ticket_message.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketMessageRequest = ListTicketMessageRequest.builder() \ - .ticket_id("6948728206392295444") \ - .time_start(1617960686) \ - .time_end(1617960687) \ - .page(1) \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListTicketMessageRequest = ListTicketMessageRequest.builder() \ + .ticket_id("6948728206392295444") \ + .time_start(1617960686) \ + .time_end(1617960687) \ + .page(1) \ + .page_size(10) \ + .build() - # 发起请求 - response: ListTicketMessageResponse = await client.helpdesk.v1.ticket_message.alist(request) + # 发起请求 + response: ListTicketMessageResponse = await client.helpdesk.v1.ticket_message.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/list_ticket_sample.py b/samples/api/helpdesk/v1/list_ticket_sample.py index d9fdf9a3b..7cc7160ff 100644 --- a/samples/api/helpdesk/v1/list_ticket_sample.py +++ b/samples/api/helpdesk/v1/list_ticket_sample.py @@ -5,90 +5,90 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketRequest = ListTicketRequest.builder() \ - .ticket_id("123456") \ - .agent_id("ou_b5de90429xxx") \ - .closed_by_id("ou_b5de90429xxx") \ - .type(1) \ - .channel(0) \ - .solved(1) \ - .score(1) \ - .status_list([]) \ - .guest_name("abc") \ - .guest_id("ou_b5de90429xxx") \ - .tags([]) \ - .page(1) \ - .page_size(20) \ - .create_time_start(0) \ - .create_time_end(0) \ - .update_time_start(0) \ - .update_time_end(0) \ - .build() + # 构造请求对象 + request: ListTicketRequest = ListTicketRequest.builder() \ + .ticket_id("123456") \ + .agent_id("ou_b5de90429xxx") \ + .closed_by_id("ou_b5de90429xxx") \ + .type(1) \ + .channel(0) \ + .solved(1) \ + .score(1) \ + .status_list([]) \ + .guest_name("abc") \ + .guest_id("ou_b5de90429xxx") \ + .tags([]) \ + .page(1) \ + .page_size(20) \ + .create_time_start(0) \ + .create_time_end(0) \ + .update_time_start(0) \ + .update_time_end(0) \ + .build() - # 发起请求 - response: ListTicketResponse = client.helpdesk.v1.ticket.list(request) + # 发起请求 + response: ListTicketResponse = client.helpdesk.v1.ticket.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTicketRequest = ListTicketRequest.builder() \ - .ticket_id("123456") \ - .agent_id("ou_b5de90429xxx") \ - .closed_by_id("ou_b5de90429xxx") \ - .type(1) \ - .channel(0) \ - .solved(1) \ - .score(1) \ - .status_list([]) \ - .guest_name("abc") \ - .guest_id("ou_b5de90429xxx") \ - .tags([]) \ - .page(1) \ - .page_size(20) \ - .create_time_start(0) \ - .create_time_end(0) \ - .update_time_start(0) \ - .update_time_end(0) \ - .build() + # 构造请求对象 + request: ListTicketRequest = ListTicketRequest.builder() \ + .ticket_id("123456") \ + .agent_id("ou_b5de90429xxx") \ + .closed_by_id("ou_b5de90429xxx") \ + .type(1) \ + .channel(0) \ + .solved(1) \ + .score(1) \ + .status_list([]) \ + .guest_name("abc") \ + .guest_id("ou_b5de90429xxx") \ + .tags([]) \ + .page(1) \ + .page_size(20) \ + .create_time_start(0) \ + .create_time_end(0) \ + .update_time_start(0) \ + .update_time_end(0) \ + .build() - # 发起请求 - response: ListTicketResponse = await client.helpdesk.v1.ticket.alist(request) + # 发起请求 + response: ListTicketResponse = await client.helpdesk.v1.ticket.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_agent_sample.py b/samples/api/helpdesk/v1/patch_agent_sample.py index a11cfb390..7310aae28 100644 --- a/samples/api/helpdesk/v1/patch_agent_sample.py +++ b/samples/api/helpdesk/v1/patch_agent_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentRequest = PatchAgentRequest.builder() \ - .agent_id("ou_14777d82ffef0f707de5a8c7ff2c5ebe") \ - .request_body(PatchAgentRequestBody.builder() - .status(int) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentRequest = PatchAgentRequest.builder() \ + .agent_id("ou_14777d82ffef0f707de5a8c7ff2c5ebe") \ + .request_body(PatchAgentRequestBody.builder() + .status(int) + .build()) \ + .build() - # 发起请求 - response: PatchAgentResponse = client.helpdesk.v1.agent.patch(request) + # 发起请求 + response: PatchAgentResponse = client.helpdesk.v1.agent.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentRequest = PatchAgentRequest.builder() \ - .agent_id("ou_14777d82ffef0f707de5a8c7ff2c5ebe") \ - .request_body(PatchAgentRequestBody.builder() - .status(int) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentRequest = PatchAgentRequest.builder() \ + .agent_id("ou_14777d82ffef0f707de5a8c7ff2c5ebe") \ + .request_body(PatchAgentRequestBody.builder() + .status(int) + .build()) \ + .build() - # 发起请求 - response: PatchAgentResponse = await client.helpdesk.v1.agent.apatch(request) + # 发起请求 + response: PatchAgentResponse = await client.helpdesk.v1.agent.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_agent_schedules_sample.py b/samples/api/helpdesk/v1/patch_agent_schedules_sample.py index 30a4d345d..8ff1195e6 100644 --- a/samples/api/helpdesk/v1/patch_agent_schedules_sample.py +++ b/samples/api/helpdesk/v1/patch_agent_schedules_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentSchedulesRequest = PatchAgentSchedulesRequest.builder() \ - .agent_id("123456") \ - .request_body(PatchAgentSchedulesRequestBody.builder() - .agent_schedule(AgentScheduleUpdateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentSchedulesRequest = PatchAgentSchedulesRequest.builder() \ + .agent_id("123456") \ + .request_body(PatchAgentSchedulesRequestBody.builder() + .agent_schedule(AgentScheduleUpdateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.patch(request) + # 发起请求 + response: PatchAgentSchedulesResponse = client.helpdesk.v1.agent_schedules.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentSchedulesRequest = PatchAgentSchedulesRequest.builder() \ - .agent_id("123456") \ - .request_body(PatchAgentSchedulesRequestBody.builder() - .agent_schedule(AgentScheduleUpdateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentSchedulesRequest = PatchAgentSchedulesRequest.builder() \ + .agent_id("123456") \ + .request_body(PatchAgentSchedulesRequestBody.builder() + .agent_schedule(AgentScheduleUpdateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.apatch(request) + # 发起请求 + response: PatchAgentSchedulesResponse = await client.helpdesk.v1.agent_schedules.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_schedules.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_schedules.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_agent_skill_sample.py b/samples/api/helpdesk/v1/patch_agent_skill_sample.py index fb24f5bfa..4ee5625b9 100644 --- a/samples/api/helpdesk/v1/patch_agent_skill_sample.py +++ b/samples/api/helpdesk/v1/patch_agent_skill_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentSkillRequest = PatchAgentSkillRequest.builder() \ - .agent_skill_id("test-skill-id") \ - .request_body(PatchAgentSkillRequestBody.builder() - .agent_skill(AgentSkill.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentSkillRequest = PatchAgentSkillRequest.builder() \ + .agent_skill_id("test-skill-id") \ + .request_body(PatchAgentSkillRequestBody.builder() + .agent_skill(AgentSkill.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAgentSkillResponse = client.helpdesk.v1.agent_skill.patch(request) + # 发起请求 + response: PatchAgentSkillResponse = client.helpdesk.v1.agent_skill.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchAgentSkillRequest = PatchAgentSkillRequest.builder() \ - .agent_skill_id("test-skill-id") \ - .request_body(PatchAgentSkillRequestBody.builder() - .agent_skill(AgentSkill.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchAgentSkillRequest = PatchAgentSkillRequest.builder() \ + .agent_skill_id("test-skill-id") \ + .request_body(PatchAgentSkillRequestBody.builder() + .agent_skill(AgentSkill.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchAgentSkillResponse = await client.helpdesk.v1.agent_skill.apatch(request) + # 发起请求 + response: PatchAgentSkillResponse = await client.helpdesk.v1.agent_skill.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.agent_skill.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.agent_skill.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_category_sample.py b/samples/api/helpdesk/v1/patch_category_sample.py index 2e22a51b0..1a9c82e64 100644 --- a/samples/api/helpdesk/v1/patch_category_sample.py +++ b/samples/api/helpdesk/v1/patch_category_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCategoryRequest = PatchCategoryRequest.builder() \ - .id("6948728206392295444") \ - .request_body(Category.builder() - .name("str") - .parent_id("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchCategoryRequest = PatchCategoryRequest.builder() \ + .id("6948728206392295444") \ + .request_body(Category.builder() + .name("str") + .parent_id("str") + .build()) \ + .build() - # 发起请求 - response: PatchCategoryResponse = client.helpdesk.v1.category.patch(request) + # 发起请求 + response: PatchCategoryResponse = client.helpdesk.v1.category.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCategoryRequest = PatchCategoryRequest.builder() \ - .id("6948728206392295444") \ - .request_body(Category.builder() - .name("str") - .parent_id("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchCategoryRequest = PatchCategoryRequest.builder() \ + .id("6948728206392295444") \ + .request_body(Category.builder() + .name("str") + .parent_id("str") + .build()) \ + .build() - # 发起请求 - response: PatchCategoryResponse = await client.helpdesk.v1.category.apatch(request) + # 发起请求 + response: PatchCategoryResponse = await client.helpdesk.v1.category.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.category.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.category.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_faq_sample.py b/samples/api/helpdesk/v1/patch_faq_sample.py index 7bbdbdffa..709a258f1 100644 --- a/samples/api/helpdesk/v1/patch_faq_sample.py +++ b/samples/api/helpdesk/v1/patch_faq_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFaqRequest = PatchFaqRequest.builder() \ - .id("6856395634652479491") \ - .request_body(PatchFaqRequestBody.builder() - .faq(FaqUpdateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchFaqRequest = PatchFaqRequest.builder() \ + .id("6856395634652479491") \ + .request_body(PatchFaqRequestBody.builder() + .faq(FaqUpdateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchFaqResponse = client.helpdesk.v1.faq.patch(request) + # 发起请求 + response: PatchFaqResponse = client.helpdesk.v1.faq.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFaqRequest = PatchFaqRequest.builder() \ - .id("6856395634652479491") \ - .request_body(PatchFaqRequestBody.builder() - .faq(FaqUpdateInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchFaqRequest = PatchFaqRequest.builder() \ + .id("6856395634652479491") \ + .request_body(PatchFaqRequestBody.builder() + .faq(FaqUpdateInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchFaqResponse = await client.helpdesk.v1.faq.apatch(request) + # 发起请求 + response: PatchFaqResponse = await client.helpdesk.v1.faq.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_notification_sample.py b/samples/api/helpdesk/v1/patch_notification_sample.py index 26c909923..2fae4c91d 100644 --- a/samples/api/helpdesk/v1/patch_notification_sample.py +++ b/samples/api/helpdesk/v1/patch_notification_sample.py @@ -5,104 +5,104 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNotificationRequest = PatchNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .user_id_type("user_id") \ - .request_body(Notification.builder() - .id("6981801914270744596") - .job_name("测试推送任务") - .status(0) - .create_user(NotificationUser.builder().build()) - .created_at("1626332244719") - .update_user(NotificationUser.builder().build()) - .updated_at("1626332244719") - .target_user_count(1) - .sent_user_count(1) - .read_user_count(1) - .send_at("1626332244719") - .push_content("") - .push_type(0) - .push_scope_type(0) - .new_staff_scope_type(0) - .new_staff_scope_department_list([]) - .user_list([]) - .department_list([]) - .chat_list([]) - .ext("{}") - .build()) \ - .build() + # 构造请求对象 + request: PatchNotificationRequest = PatchNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .user_id_type("user_id") \ + .request_body(Notification.builder() + .id("6981801914270744596") + .job_name("测试推送任务") + .status(0) + .create_user(NotificationUser.builder().build()) + .created_at("1626332244719") + .update_user(NotificationUser.builder().build()) + .updated_at("1626332244719") + .target_user_count(1) + .sent_user_count(1) + .read_user_count(1) + .send_at("1626332244719") + .push_content("") + .push_type(0) + .push_scope_type(0) + .new_staff_scope_type(0) + .new_staff_scope_department_list([]) + .user_list([]) + .department_list([]) + .chat_list([]) + .ext("{}") + .build()) \ + .build() - # 发起请求 - response: PatchNotificationResponse = client.helpdesk.v1.notification.patch(request) + # 发起请求 + response: PatchNotificationResponse = client.helpdesk.v1.notification.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNotificationRequest = PatchNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .user_id_type("user_id") \ - .request_body(Notification.builder() - .id("6981801914270744596") - .job_name("测试推送任务") - .status(0) - .create_user(NotificationUser.builder().build()) - .created_at("1626332244719") - .update_user(NotificationUser.builder().build()) - .updated_at("1626332244719") - .target_user_count(1) - .sent_user_count(1) - .read_user_count(1) - .send_at("1626332244719") - .push_content("") - .push_type(0) - .push_scope_type(0) - .new_staff_scope_type(0) - .new_staff_scope_department_list([]) - .user_list([]) - .department_list([]) - .chat_list([]) - .ext("{}") - .build()) \ - .build() + # 构造请求对象 + request: PatchNotificationRequest = PatchNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .user_id_type("user_id") \ + .request_body(Notification.builder() + .id("6981801914270744596") + .job_name("测试推送任务") + .status(0) + .create_user(NotificationUser.builder().build()) + .created_at("1626332244719") + .update_user(NotificationUser.builder().build()) + .updated_at("1626332244719") + .target_user_count(1) + .sent_user_count(1) + .read_user_count(1) + .send_at("1626332244719") + .push_content("") + .push_type(0) + .push_scope_type(0) + .new_staff_scope_type(0) + .new_staff_scope_department_list([]) + .user_list([]) + .department_list([]) + .chat_list([]) + .ext("{}") + .build()) \ + .build() - # 发起请求 - response: PatchNotificationResponse = await client.helpdesk.v1.notification.apatch(request) + # 发起请求 + response: PatchNotificationResponse = await client.helpdesk.v1.notification.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/patch_ticket_customized_field_sample.py b/samples/api/helpdesk/v1/patch_ticket_customized_field_sample.py index dbe5790a7..3c0887708 100644 --- a/samples/api/helpdesk/v1/patch_ticket_customized_field_sample.py +++ b/samples/api/helpdesk/v1/patch_ticket_customized_field_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTicketCustomizedFieldRequest = PatchTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .request_body(TicketCustomizedField.builder() - .display_name("str") - .position("str") - .description("str") - .visible(bool) - .required(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchTicketCustomizedFieldRequest = PatchTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .request_body(TicketCustomizedField.builder() + .display_name("str") + .position("str") + .description("str") + .visible(bool) + .required(bool) + .build()) \ + .build() - # 发起请求 - response: PatchTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.patch(request) + # 发起请求 + response: PatchTicketCustomizedFieldResponse = client.helpdesk.v1.ticket_customized_field.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTicketCustomizedFieldRequest = PatchTicketCustomizedFieldRequest.builder() \ - .ticket_customized_field_id("6948728206392295444") \ - .request_body(TicketCustomizedField.builder() - .display_name("str") - .position("str") - .description("str") - .visible(bool) - .required(bool) - .build()) \ - .build() + # 构造请求对象 + request: PatchTicketCustomizedFieldRequest = PatchTicketCustomizedFieldRequest.builder() \ + .ticket_customized_field_id("6948728206392295444") \ + .request_body(TicketCustomizedField.builder() + .display_name("str") + .position("str") + .description("str") + .visible(bool) + .required(bool) + .build()) \ + .build() - # 发起请求 - response: PatchTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.apatch(request) + # 发起请求 + response: PatchTicketCustomizedFieldResponse = await client.helpdesk.v1.ticket_customized_field.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket_customized_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket_customized_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/preview_notification_sample.py b/samples/api/helpdesk/v1/preview_notification_sample.py index b97b10bbb..d1b658d2a 100644 --- a/samples/api/helpdesk/v1/preview_notification_sample.py +++ b/samples/api/helpdesk/v1/preview_notification_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewNotificationRequest = PreviewNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .build() + # 构造请求对象 + request: PreviewNotificationRequest = PreviewNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .build() - # 发起请求 - response: PreviewNotificationResponse = client.helpdesk.v1.notification.preview(request) + # 发起请求 + response: PreviewNotificationResponse = client.helpdesk.v1.notification.preview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewNotificationRequest = PreviewNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .build() + # 构造请求对象 + request: PreviewNotificationRequest = PreviewNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .build() - # 发起请求 - response: PreviewNotificationResponse = await client.helpdesk.v1.notification.apreview(request) + # 发起请求 + response: PreviewNotificationResponse = await client.helpdesk.v1.notification.apreview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/search_faq_sample.py b/samples/api/helpdesk/v1/search_faq_sample.py index a6a2fa250..083cd871e 100644 --- a/samples/api/helpdesk/v1/search_faq_sample.py +++ b/samples/api/helpdesk/v1/search_faq_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchFaqRequest = SearchFaqRequest.builder() \ - .query("wifi") \ - .base64("5bel5Y2V") \ - .page_token("6936004780707807251") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: SearchFaqRequest = SearchFaqRequest.builder() \ + .query("wifi") \ + .base64("5bel5Y2V") \ + .page_token("6936004780707807251") \ + .page_size(20) \ + .build() - # 发起请求 - response: SearchFaqResponse = client.helpdesk.v1.faq.search(request) + # 发起请求 + response: SearchFaqResponse = client.helpdesk.v1.faq.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchFaqRequest = SearchFaqRequest.builder() \ - .query("wifi") \ - .base64("5bel5Y2V") \ - .page_token("6936004780707807251") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: SearchFaqRequest = SearchFaqRequest.builder() \ + .query("wifi") \ + .base64("5bel5Y2V") \ + .page_token("6936004780707807251") \ + .page_size(20) \ + .build() - # 发起请求 - response: SearchFaqResponse = await client.helpdesk.v1.faq.asearch(request) + # 发起请求 + response: SearchFaqResponse = await client.helpdesk.v1.faq.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.faq.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.faq.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/start_service_ticket_sample.py b/samples/api/helpdesk/v1/start_service_ticket_sample.py index c9ac3a91b..75a9c42ed 100644 --- a/samples/api/helpdesk/v1/start_service_ticket_sample.py +++ b/samples/api/helpdesk/v1/start_service_ticket_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StartServiceTicketRequest = StartServiceTicketRequest.builder() \ - .request_body(StartServiceTicketRequestBody.builder() - .human_service(False) - .appointed_agents([]) - .open_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .customized_info("测试自定义字段信息") - .build()) \ - .build() + # 构造请求对象 + request: StartServiceTicketRequest = StartServiceTicketRequest.builder() \ + .request_body(StartServiceTicketRequestBody.builder() + .human_service(False) + .appointed_agents([]) + .open_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .customized_info("测试自定义字段信息") + .build()) \ + .build() - # 发起请求 - response: StartServiceTicketResponse = client.helpdesk.v1.ticket.start_service(request) + # 发起请求 + response: StartServiceTicketResponse = client.helpdesk.v1.ticket.start_service(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.start_service failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.start_service failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StartServiceTicketRequest = StartServiceTicketRequest.builder() \ - .request_body(StartServiceTicketRequestBody.builder() - .human_service(False) - .appointed_agents([]) - .open_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") - .customized_info("测试自定义字段信息") - .build()) \ - .build() + # 构造请求对象 + request: StartServiceTicketRequest = StartServiceTicketRequest.builder() \ + .request_body(StartServiceTicketRequestBody.builder() + .human_service(False) + .appointed_agents([]) + .open_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") + .customized_info("测试自定义字段信息") + .build()) \ + .build() - # 发起请求 - response: StartServiceTicketResponse = await client.helpdesk.v1.ticket.astart_service(request) + # 发起请求 + response: StartServiceTicketResponse = await client.helpdesk.v1.ticket.astart_service(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.astart_service failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.astart_service failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/submit_approve_notification_sample.py b/samples/api/helpdesk/v1/submit_approve_notification_sample.py index 4fa5b9a5f..198595c53 100644 --- a/samples/api/helpdesk/v1/submit_approve_notification_sample.py +++ b/samples/api/helpdesk/v1/submit_approve_notification_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitApproveNotificationRequest = SubmitApproveNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .request_body(SubmitApproveNotificationRequestBody.builder() - .reason("测试发送消息") - .build()) \ - .build() + # 构造请求对象 + request: SubmitApproveNotificationRequest = SubmitApproveNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .request_body(SubmitApproveNotificationRequestBody.builder() + .reason("测试发送消息") + .build()) \ + .build() - # 发起请求 - response: SubmitApproveNotificationResponse = client.helpdesk.v1.notification.submit_approve(request) + # 发起请求 + response: SubmitApproveNotificationResponse = client.helpdesk.v1.notification.submit_approve(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.submit_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.submit_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubmitApproveNotificationRequest = SubmitApproveNotificationRequest.builder() \ - .notification_id("6985032626234982420") \ - .request_body(SubmitApproveNotificationRequestBody.builder() - .reason("测试发送消息") - .build()) \ - .build() + # 构造请求对象 + request: SubmitApproveNotificationRequest = SubmitApproveNotificationRequest.builder() \ + .notification_id("6985032626234982420") \ + .request_body(SubmitApproveNotificationRequestBody.builder() + .reason("测试发送消息") + .build()) \ + .build() - # 发起请求 - response: SubmitApproveNotificationResponse = await client.helpdesk.v1.notification.asubmit_approve(request) + # 发起请求 + response: SubmitApproveNotificationResponse = await client.helpdesk.v1.notification.asubmit_approve(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.notification.asubmit_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.notification.asubmit_approve failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/subscribe_event_sample.py b/samples/api/helpdesk/v1/subscribe_event_sample.py index be0286090..3c42d00b9 100644 --- a/samples/api/helpdesk/v1/subscribe_event_sample.py +++ b/samples/api/helpdesk/v1/subscribe_event_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeEventRequest = SubscribeEventRequest.builder() \ - .request_body(SubscribeEventRequestBody.builder() - .events([]) - .build()) \ - .build() + # 构造请求对象 + request: SubscribeEventRequest = SubscribeEventRequest.builder() \ + .request_body(SubscribeEventRequestBody.builder() + .events([]) + .build()) \ + .build() - # 发起请求 - response: SubscribeEventResponse = client.helpdesk.v1.event.subscribe(request) + # 发起请求 + response: SubscribeEventResponse = client.helpdesk.v1.event.subscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.event.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.event.subscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SubscribeEventRequest = SubscribeEventRequest.builder() \ - .request_body(SubscribeEventRequestBody.builder() - .events([]) - .build()) \ - .build() + # 构造请求对象 + request: SubscribeEventRequest = SubscribeEventRequest.builder() \ + .request_body(SubscribeEventRequestBody.builder() + .events([]) + .build()) \ + .build() - # 发起请求 - response: SubscribeEventResponse = await client.helpdesk.v1.event.asubscribe(request) + # 发起请求 + response: SubscribeEventResponse = await client.helpdesk.v1.event.asubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.event.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.event.asubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/ticket_image_ticket_sample.py b/samples/api/helpdesk/v1/ticket_image_ticket_sample.py index 01461bec6..287cf2c66 100644 --- a/samples/api/helpdesk/v1/ticket_image_ticket_sample.py +++ b/samples/api/helpdesk/v1/ticket_image_ticket_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TicketImageTicketRequest = TicketImageTicketRequest.builder() \ - .ticket_id("12345") \ - .msg_id("12345") \ - .index(0) \ - .build() + # 构造请求对象 + request: TicketImageTicketRequest = TicketImageTicketRequest.builder() \ + .ticket_id("12345") \ + .msg_id("12345") \ + .index(0) \ + .build() - # 发起请求 - response: TicketImageTicketResponse = client.helpdesk.v1.ticket.ticket_image(request) + # 发起请求 + response: TicketImageTicketResponse = client.helpdesk.v1.ticket.ticket_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.ticket_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.ticket_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TicketImageTicketRequest = TicketImageTicketRequest.builder() \ - .ticket_id("12345") \ - .msg_id("12345") \ - .index(0) \ - .build() + # 构造请求对象 + request: TicketImageTicketRequest = TicketImageTicketRequest.builder() \ + .ticket_id("12345") \ + .msg_id("12345") \ + .index(0) \ + .build() - # 发起请求 - response: TicketImageTicketResponse = await client.helpdesk.v1.ticket.aticket_image(request) + # 发起请求 + response: TicketImageTicketResponse = await client.helpdesk.v1.ticket.aticket_image(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.aticket_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.aticket_image failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/unsubscribe_event_sample.py b/samples/api/helpdesk/v1/unsubscribe_event_sample.py index 95002f8d1..fcff44f5b 100644 --- a/samples/api/helpdesk/v1/unsubscribe_event_sample.py +++ b/samples/api/helpdesk/v1/unsubscribe_event_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeEventRequest = UnsubscribeEventRequest.builder() \ - .request_body(UnsubscribeEventRequestBody.builder() - .events([]) - .build()) \ - .build() + # 构造请求对象 + request: UnsubscribeEventRequest = UnsubscribeEventRequest.builder() \ + .request_body(UnsubscribeEventRequestBody.builder() + .events([]) + .build()) \ + .build() - # 发起请求 - response: UnsubscribeEventResponse = client.helpdesk.v1.event.unsubscribe(request) + # 发起请求 + response: UnsubscribeEventResponse = client.helpdesk.v1.event.unsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.event.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.event.unsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnsubscribeEventRequest = UnsubscribeEventRequest.builder() \ - .request_body(UnsubscribeEventRequestBody.builder() - .events([]) - .build()) \ - .build() + # 构造请求对象 + request: UnsubscribeEventRequest = UnsubscribeEventRequest.builder() \ + .request_body(UnsubscribeEventRequestBody.builder() + .events([]) + .build()) \ + .build() - # 发起请求 - response: UnsubscribeEventResponse = await client.helpdesk.v1.event.aunsubscribe(request) + # 发起请求 + response: UnsubscribeEventResponse = await client.helpdesk.v1.event.aunsubscribe(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.event.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.event.aunsubscribe failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/helpdesk/v1/update_ticket_sample.py b/samples/api/helpdesk/v1/update_ticket_sample.py index 016dbb4b7..7e66de3ec 100644 --- a/samples/api/helpdesk/v1/update_ticket_sample.py +++ b/samples/api/helpdesk/v1/update_ticket_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTicketRequest = UpdateTicketRequest.builder() \ - .ticket_id("6945345902185807891") \ - .request_body(UpdateTicketRequestBody.builder() - .status(1) - .tag_names([]) - .comment("good") - .customized_fields([]) - .ticket_type(1) - .solved(1) - .channel(1) - .build()) \ - .build() + # 构造请求对象 + request: UpdateTicketRequest = UpdateTicketRequest.builder() \ + .ticket_id("6945345902185807891") \ + .request_body(UpdateTicketRequestBody.builder() + .status(1) + .tag_names([]) + .comment("good") + .customized_fields([]) + .ticket_type(1) + .solved(1) + .channel(1) + .build()) \ + .build() - # 发起请求 - response: UpdateTicketResponse = client.helpdesk.v1.ticket.update(request) + # 发起请求 + response: UpdateTicketResponse = client.helpdesk.v1.ticket.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTicketRequest = UpdateTicketRequest.builder() \ - .ticket_id("6945345902185807891") \ - .request_body(UpdateTicketRequestBody.builder() - .status(1) - .tag_names([]) - .comment("good") - .customized_fields([]) - .ticket_type(1) - .solved(1) - .channel(1) - .build()) \ - .build() + # 构造请求对象 + request: UpdateTicketRequest = UpdateTicketRequest.builder() \ + .ticket_id("6945345902185807891") \ + .request_body(UpdateTicketRequestBody.builder() + .status(1) + .tag_names([]) + .comment("good") + .customized_fields([]) + .ticket_type(1) + .solved(1) + .channel(1) + .build()) \ + .build() - # 发起请求 - response: UpdateTicketResponse = await client.helpdesk.v1.ticket.aupdate(request) + # 发起请求 + response: UpdateTicketResponse = await client.helpdesk.v1.ticket.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.helpdesk.v1.ticket.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.helpdesk.v1.ticket.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/add_to_folder_talent_sample.py b/samples/api/hire/v1/add_to_folder_talent_sample.py index e26d31b12..f0f0bba4d 100644 --- a/samples/api/hire/v1/add_to_folder_talent_sample.py +++ b/samples/api/hire/v1/add_to_folder_talent_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddToFolderTalentRequest = AddToFolderTalentRequest.builder() \ - .request_body(AddToFolderTalentRequestBody.builder() - .talent_id_list([]) - .folder_id("7039620186502138156") - .build()) \ - .build() + # 构造请求对象 + request: AddToFolderTalentRequest = AddToFolderTalentRequest.builder() \ + .request_body(AddToFolderTalentRequestBody.builder() + .talent_id_list([]) + .folder_id("7039620186502138156") + .build()) \ + .build() - # 发起请求 - response: AddToFolderTalentResponse = client.hire.v1.talent.add_to_folder(request) + # 发起请求 + response: AddToFolderTalentResponse = client.hire.v1.talent.add_to_folder(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.add_to_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.add_to_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddToFolderTalentRequest = AddToFolderTalentRequest.builder() \ - .request_body(AddToFolderTalentRequestBody.builder() - .talent_id_list([]) - .folder_id("7039620186502138156") - .build()) \ - .build() + # 构造请求对象 + request: AddToFolderTalentRequest = AddToFolderTalentRequest.builder() \ + .request_body(AddToFolderTalentRequestBody.builder() + .talent_id_list([]) + .folder_id("7039620186502138156") + .build()) \ + .build() - # 发起请求 - response: AddToFolderTalentResponse = await client.hire.v1.talent.aadd_to_folder(request) + # 发起请求 + response: AddToFolderTalentResponse = await client.hire.v1.talent.aadd_to_folder(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.aadd_to_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.aadd_to_folder failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_delete_eco_account_custom_field_sample.py b/samples/api/hire/v1/batch_delete_eco_account_custom_field_sample.py index 785e52a3c..1f65aea5d 100644 --- a/samples/api/hire/v1/batch_delete_eco_account_custom_field_sample.py +++ b/samples/api/hire/v1/batch_delete_eco_account_custom_field_sample.py @@ -5,65 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoAccountCustomFieldRequest = BatchDeleteEcoAccountCustomFieldRequest.builder() \ - .request_body(BatchDeleteEcoAccountCustomFieldRequestBody.builder() - .scope(1) - .custom_field_key_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoAccountCustomFieldRequest = BatchDeleteEcoAccountCustomFieldRequest.builder() \ + .request_body(BatchDeleteEcoAccountCustomFieldRequestBody.builder() + .scope(1) + .custom_field_key_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.batch_delete(request) + # 发起请求 + response: BatchDeleteEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoAccountCustomFieldRequest = BatchDeleteEcoAccountCustomFieldRequest.builder() \ - .request_body(BatchDeleteEcoAccountCustomFieldRequestBody.builder() - .scope(1) - .custom_field_key_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoAccountCustomFieldRequest = BatchDeleteEcoAccountCustomFieldRequest.builder() \ + .request_body(BatchDeleteEcoAccountCustomFieldRequestBody.builder() + .scope(1) + .custom_field_key_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.abatch_delete( - request) + # 发起请求 + response: BatchDeleteEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_delete_eco_background_check_custom_field_sample.py b/samples/api/hire/v1/batch_delete_eco_background_check_custom_field_sample.py index 69805ba7c..6e599dc03 100644 --- a/samples/api/hire/v1/batch_delete_eco_background_check_custom_field_sample.py +++ b/samples/api/hire/v1/batch_delete_eco_background_check_custom_field_sample.py @@ -5,64 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoBackgroundCheckCustomFieldRequest = BatchDeleteEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(BatchDeleteEcoBackgroundCheckCustomFieldRequestBody.builder() - .account_id("a001") - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoBackgroundCheckCustomFieldRequest = BatchDeleteEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(BatchDeleteEcoBackgroundCheckCustomFieldRequestBody.builder() + .account_id("a001") + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.batch_delete( - request) + # 发起请求 + response: BatchDeleteEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoBackgroundCheckCustomFieldRequest = BatchDeleteEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(BatchDeleteEcoBackgroundCheckCustomFieldRequestBody.builder() - .account_id("a001") - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoBackgroundCheckCustomFieldRequest = BatchDeleteEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(BatchDeleteEcoBackgroundCheckCustomFieldRequestBody.builder() + .account_id("a001") + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.abatch_delete( - request) + # 发起请求 + response: BatchDeleteEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_delete_eco_background_check_package_sample.py b/samples/api/hire/v1/batch_delete_eco_background_check_package_sample.py index 9e2def4c1..65beb8c52 100644 --- a/samples/api/hire/v1/batch_delete_eco_background_check_package_sample.py +++ b/samples/api/hire/v1/batch_delete_eco_background_check_package_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoBackgroundCheckPackageRequest = BatchDeleteEcoBackgroundCheckPackageRequest.builder() \ - .request_body(BatchDeleteEcoBackgroundCheckPackageRequestBody.builder() - .account_id("xd_bc_001") - .package_id_list([]) - .additional_item_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoBackgroundCheckPackageRequest = BatchDeleteEcoBackgroundCheckPackageRequest.builder() \ + .request_body(BatchDeleteEcoBackgroundCheckPackageRequestBody.builder() + .account_id("xd_bc_001") + .package_id_list([]) + .additional_item_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.batch_delete( - request) + # 发起请求 + response: BatchDeleteEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoBackgroundCheckPackageRequest = BatchDeleteEcoBackgroundCheckPackageRequest.builder() \ - .request_body(BatchDeleteEcoBackgroundCheckPackageRequestBody.builder() - .account_id("xd_bc_001") - .package_id_list([]) - .additional_item_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoBackgroundCheckPackageRequest = BatchDeleteEcoBackgroundCheckPackageRequest.builder() \ + .request_body(BatchDeleteEcoBackgroundCheckPackageRequestBody.builder() + .account_id("xd_bc_001") + .package_id_list([]) + .additional_item_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.abatch_delete( - request) + # 发起请求 + response: BatchDeleteEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_delete_eco_exam_paper_sample.py b/samples/api/hire/v1/batch_delete_eco_exam_paper_sample.py index 03935d3e1..01b7636cf 100644 --- a/samples/api/hire/v1/batch_delete_eco_exam_paper_sample.py +++ b/samples/api/hire/v1/batch_delete_eco_exam_paper_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoExamPaperRequest = BatchDeleteEcoExamPaperRequest.builder() \ - .request_body(BatchDeleteEcoExamPaperRequestBody.builder() - .account_id("7147998241542539527") - .paper_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoExamPaperRequest = BatchDeleteEcoExamPaperRequest.builder() \ + .request_body(BatchDeleteEcoExamPaperRequestBody.builder() + .account_id("7147998241542539527") + .paper_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoExamPaperResponse = client.hire.v1.eco_exam_paper.batch_delete(request) + # 发起请求 + response: BatchDeleteEcoExamPaperResponse = client.hire.v1.eco_exam_paper.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteEcoExamPaperRequest = BatchDeleteEcoExamPaperRequest.builder() \ - .request_body(BatchDeleteEcoExamPaperRequestBody.builder() - .account_id("7147998241542539527") - .paper_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteEcoExamPaperRequest = BatchDeleteEcoExamPaperRequest.builder() \ + .request_body(BatchDeleteEcoExamPaperRequestBody.builder() + .account_id("7147998241542539527") + .paper_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.abatch_delete(request) + # 发起请求 + response: BatchDeleteEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_get_id_talent_sample.py b/samples/api/hire/v1/batch_get_id_talent_sample.py index f139789d6..ea3cfa882 100644 --- a/samples/api/hire/v1/batch_get_id_talent_sample.py +++ b/samples/api/hire/v1/batch_get_id_talent_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetIdTalentRequest = BatchGetIdTalentRequest.builder() \ - .request_body(BatchGetIdTalentRequestBody.builder() - .mobile_code("86") - .mobile_number_list([]) - .email_list([]) - .identification_type(1) - .identification_number_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetIdTalentRequest = BatchGetIdTalentRequest.builder() \ + .request_body(BatchGetIdTalentRequestBody.builder() + .mobile_code("86") + .mobile_number_list([]) + .email_list([]) + .identification_type(1) + .identification_number_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetIdTalentResponse = client.hire.v1.talent.batch_get_id(request) + # 发起请求 + response: BatchGetIdTalentResponse = client.hire.v1.talent.batch_get_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.batch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.batch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetIdTalentRequest = BatchGetIdTalentRequest.builder() \ - .request_body(BatchGetIdTalentRequestBody.builder() - .mobile_code("86") - .mobile_number_list([]) - .email_list([]) - .identification_type(1) - .identification_number_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchGetIdTalentRequest = BatchGetIdTalentRequest.builder() \ + .request_body(BatchGetIdTalentRequestBody.builder() + .mobile_code("86") + .mobile_number_list([]) + .email_list([]) + .identification_type(1) + .identification_number_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchGetIdTalentResponse = await client.hire.v1.talent.abatch_get_id(request) + # 发起请求 + response: BatchGetIdTalentResponse = await client.hire.v1.talent.abatch_get_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.abatch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.abatch_get_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_update_eco_account_custom_field_sample.py b/samples/api/hire/v1/batch_update_eco_account_custom_field_sample.py index 477dc3567..37bcb1a4f 100644 --- a/samples/api/hire/v1/batch_update_eco_account_custom_field_sample.py +++ b/samples/api/hire/v1/batch_update_eco_account_custom_field_sample.py @@ -5,65 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoAccountCustomFieldRequest = BatchUpdateEcoAccountCustomFieldRequest.builder() \ - .request_body(EcoAccountCustomField.builder() - .scope(1) - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoAccountCustomFieldRequest = BatchUpdateEcoAccountCustomFieldRequest.builder() \ + .request_body(EcoAccountCustomField.builder() + .scope(1) + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.batch_update(request) + # 发起请求 + response: BatchUpdateEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoAccountCustomFieldRequest = BatchUpdateEcoAccountCustomFieldRequest.builder() \ - .request_body(EcoAccountCustomField.builder() - .scope(1) - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoAccountCustomFieldRequest = BatchUpdateEcoAccountCustomFieldRequest.builder() \ + .request_body(EcoAccountCustomField.builder() + .scope(1) + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.abatch_update( - request) + # 发起请求 + response: BatchUpdateEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_update_eco_background_check_custom_field_sample.py b/samples/api/hire/v1/batch_update_eco_background_check_custom_field_sample.py index db5427b30..18c680e7f 100644 --- a/samples/api/hire/v1/batch_update_eco_background_check_custom_field_sample.py +++ b/samples/api/hire/v1/batch_update_eco_background_check_custom_field_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoBackgroundCheckCustomFieldRequest = BatchUpdateEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(EcoBackgroundCheckCustomField.builder() - .account_id("6995842370159937061") - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoBackgroundCheckCustomFieldRequest = BatchUpdateEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(EcoBackgroundCheckCustomField.builder() + .account_id("6995842370159937061") + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.batch_update( - request) + # 发起请求 + response: BatchUpdateEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoBackgroundCheckCustomFieldRequest = BatchUpdateEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(EcoBackgroundCheckCustomField.builder() - .account_id("6995842370159937061") - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoBackgroundCheckCustomFieldRequest = BatchUpdateEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(EcoBackgroundCheckCustomField.builder() + .account_id("6995842370159937061") + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.abatch_update( - request) + # 发起请求 + response: BatchUpdateEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_update_eco_background_check_package_sample.py b/samples/api/hire/v1/batch_update_eco_background_check_package_sample.py index 8f9014c58..114e4d413 100644 --- a/samples/api/hire/v1/batch_update_eco_background_check_package_sample.py +++ b/samples/api/hire/v1/batch_update_eco_background_check_package_sample.py @@ -5,68 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoBackgroundCheckPackageRequest = BatchUpdateEcoBackgroundCheckPackageRequest.builder() \ - .request_body(EcoBackgroundCheckPackage.builder() - .account_id("ord_id") - .package_list([]) - .additional_item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoBackgroundCheckPackageRequest = BatchUpdateEcoBackgroundCheckPackageRequest.builder() \ + .request_body(EcoBackgroundCheckPackage.builder() + .account_id("ord_id") + .package_list([]) + .additional_item_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.batch_update( - request) + # 发起请求 + response: BatchUpdateEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoBackgroundCheckPackageRequest = BatchUpdateEcoBackgroundCheckPackageRequest.builder() \ - .request_body(EcoBackgroundCheckPackage.builder() - .account_id("ord_id") - .package_list([]) - .additional_item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoBackgroundCheckPackageRequest = BatchUpdateEcoBackgroundCheckPackageRequest.builder() \ + .request_body(EcoBackgroundCheckPackage.builder() + .account_id("ord_id") + .package_list([]) + .additional_item_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.abatch_update( - request) + # 发起请求 + response: BatchUpdateEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_update_eco_exam_paper_sample.py b/samples/api/hire/v1/batch_update_eco_exam_paper_sample.py index 00f0af87e..9be2c778c 100644 --- a/samples/api/hire/v1/batch_update_eco_exam_paper_sample.py +++ b/samples/api/hire/v1/batch_update_eco_exam_paper_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoExamPaperRequest = BatchUpdateEcoExamPaperRequest.builder() \ - .request_body(EcoExamPaper.builder() - .account_id("7147998241542539527") - .paper_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoExamPaperRequest = BatchUpdateEcoExamPaperRequest.builder() \ + .request_body(EcoExamPaper.builder() + .account_id("7147998241542539527") + .paper_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoExamPaperResponse = client.hire.v1.eco_exam_paper.batch_update(request) + # 发起请求 + response: BatchUpdateEcoExamPaperResponse = client.hire.v1.eco_exam_paper.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateEcoExamPaperRequest = BatchUpdateEcoExamPaperRequest.builder() \ - .request_body(EcoExamPaper.builder() - .account_id("7147998241542539527") - .paper_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateEcoExamPaperRequest = BatchUpdateEcoExamPaperRequest.builder() \ + .request_body(EcoExamPaper.builder() + .account_id("7147998241542539527") + .paper_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.abatch_update(request) + # 发起请求 + response: BatchUpdateEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/batch_update_job_manager_sample.py b/samples/api/hire/v1/batch_update_job_manager_sample.py index 8b7ac1cd5..ab3870d8c 100644 --- a/samples/api/hire/v1/batch_update_job_manager_sample.py +++ b/samples/api/hire/v1/batch_update_job_manager_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateJobManagerRequest = BatchUpdateJobManagerRequest.builder() \ - .job_id("7096318853365369132") \ - .user_id_type("open_id") \ - .request_body(BatchUpdateJobManagerRequestBody.builder() - .recruiter_id("ou_e6139117c300506837def50545420c6a") - .assistant_id_list([]) - .hiring_manager_id_list([]) - .update_option_list([]) - .creator_id("ou_efk39117c300506837def50545420c6a") - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateJobManagerRequest = BatchUpdateJobManagerRequest.builder() \ + .job_id("7096318853365369132") \ + .user_id_type("open_id") \ + .request_body(BatchUpdateJobManagerRequestBody.builder() + .recruiter_id("ou_e6139117c300506837def50545420c6a") + .assistant_id_list([]) + .hiring_manager_id_list([]) + .update_option_list([]) + .creator_id("ou_efk39117c300506837def50545420c6a") + .build()) \ + .build() - # 发起请求 - response: BatchUpdateJobManagerResponse = client.hire.v1.job_manager.batch_update(request) + # 发起请求 + response: BatchUpdateJobManagerResponse = client.hire.v1.job_manager.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_manager.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_manager.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateJobManagerRequest = BatchUpdateJobManagerRequest.builder() \ - .job_id("7096318853365369132") \ - .user_id_type("open_id") \ - .request_body(BatchUpdateJobManagerRequestBody.builder() - .recruiter_id("ou_e6139117c300506837def50545420c6a") - .assistant_id_list([]) - .hiring_manager_id_list([]) - .update_option_list([]) - .creator_id("ou_efk39117c300506837def50545420c6a") - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateJobManagerRequest = BatchUpdateJobManagerRequest.builder() \ + .job_id("7096318853365369132") \ + .user_id_type("open_id") \ + .request_body(BatchUpdateJobManagerRequestBody.builder() + .recruiter_id("ou_e6139117c300506837def50545420c6a") + .assistant_id_list([]) + .hiring_manager_id_list([]) + .update_option_list([]) + .creator_id("ou_efk39117c300506837def50545420c6a") + .build()) \ + .build() - # 发起请求 - response: BatchUpdateJobManagerResponse = await client.hire.v1.job_manager.abatch_update(request) + # 发起请求 + response: BatchUpdateJobManagerResponse = await client.hire.v1.job_manager.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_manager.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_manager.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/cancel_eco_background_check_sample.py b/samples/api/hire/v1/cancel_eco_background_check_sample.py index 8e84f8d34..c079ec241 100644 --- a/samples/api/hire/v1/cancel_eco_background_check_sample.py +++ b/samples/api/hire/v1/cancel_eco_background_check_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelEcoBackgroundCheckRequest = CancelEcoBackgroundCheckRequest.builder() \ - .request_body(CancelEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .build()) \ - .build() + # 构造请求对象 + request: CancelEcoBackgroundCheckRequest = CancelEcoBackgroundCheckRequest.builder() \ + .request_body(CancelEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .build()) \ + .build() - # 发起请求 - response: CancelEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.cancel(request) + # 发起请求 + response: CancelEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.cancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.cancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CancelEcoBackgroundCheckRequest = CancelEcoBackgroundCheckRequest.builder() \ - .request_body(CancelEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .build()) \ - .build() + # 构造请求对象 + request: CancelEcoBackgroundCheckRequest = CancelEcoBackgroundCheckRequest.builder() \ + .request_body(CancelEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .build()) \ + .build() - # 发起请求 - response: CancelEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.acancel(request) + # 发起请求 + response: CancelEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.acancel(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.acancel failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/close_job_sample.py b/samples/api/hire/v1/close_job_sample.py index 638930a1a..4ec1d2c09 100644 --- a/samples/api/hire/v1/close_job_sample.py +++ b/samples/api/hire/v1/close_job_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CloseJobRequest = CloseJobRequest.builder() \ - .job_id("6960663240925956555") \ - .build() + # 构造请求对象 + request: CloseJobRequest = CloseJobRequest.builder() \ + .job_id("6960663240925956555") \ + .build() - # 发起请求 - response: CloseJobResponse = client.hire.v1.job.close(request) + # 发起请求 + response: CloseJobResponse = client.hire.v1.job.close(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CloseJobRequest = CloseJobRequest.builder() \ - .job_id("6960663240925956555") \ - .build() + # 构造请求对象 + request: CloseJobRequest = CloseJobRequest.builder() \ + .job_id("6960663240925956555") \ + .build() - # 发起请求 - response: CloseJobResponse = await client.hire.v1.job.aclose(request) + # 发起请求 + response: CloseJobResponse = await client.hire.v1.job.aclose(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.aclose failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.aclose failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/combined_create_job_sample.py b/samples/api/hire/v1/combined_create_job_sample.py index a01eb41c4..a46039c9b 100644 --- a/samples/api/hire/v1/combined_create_job_sample.py +++ b/samples/api/hire/v1/combined_create_job_sample.py @@ -5,128 +5,128 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedCreateJobRequest = CombinedCreateJobRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(CombinedJob.builder() - .code("R18") - .experience(1) - .expiry_time(0) - .customized_data_list([]) - .min_level_id("6960663240925956547") - .min_salary(1000) - .title("后端研发") - .job_managers(JobManager.builder().build()) - .job_process_id("6960663240925956554") - .process_type(1) - .subject_id("6960663240925956555") - .job_function_id("6960663240925956555") - .department_id("6960663240925956549") - .head_count(100) - .is_never_expired(False) - .max_salary(2000) - .requirement("熟悉后端研发") - .description("后端研发岗位描述") - .highlight_list([]) - .job_type_id("6960663240925956551") - .max_level_id("6960663240925956548") - .recruitment_type_id("6960663240925956552") - .required_degree(20) - .job_category_id("6960663240925956550") - .address_id_list([]) - .job_attribute(1) - .expiry_timestamp("1622484739955") - .interview_registration_schema_id("6930815272790114324") - .onboard_registration_schema_id("6930815272790114325") - .target_major_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedCreateJobRequest = CombinedCreateJobRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(CombinedJob.builder() + .code("R18") + .experience(1) + .expiry_time(0) + .customized_data_list([]) + .min_level_id("6960663240925956547") + .min_salary(1000) + .title("后端研发") + .job_managers(JobManager.builder().build()) + .job_process_id("6960663240925956554") + .process_type(1) + .subject_id("6960663240925956555") + .job_function_id("6960663240925956555") + .department_id("6960663240925956549") + .head_count(100) + .is_never_expired(False) + .max_salary(2000) + .requirement("熟悉后端研发") + .description("后端研发岗位描述") + .highlight_list([]) + .job_type_id("6960663240925956551") + .max_level_id("6960663240925956548") + .recruitment_type_id("6960663240925956552") + .required_degree(20) + .job_category_id("6960663240925956550") + .address_id_list([]) + .job_attribute(1) + .expiry_timestamp("1622484739955") + .interview_registration_schema_id("6930815272790114324") + .onboard_registration_schema_id("6930815272790114325") + .target_major_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CombinedCreateJobResponse = client.hire.v1.job.combined_create(request) + # 发起请求 + response: CombinedCreateJobResponse = client.hire.v1.job.combined_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.combined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.combined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedCreateJobRequest = CombinedCreateJobRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(CombinedJob.builder() - .code("R18") - .experience(1) - .expiry_time(0) - .customized_data_list([]) - .min_level_id("6960663240925956547") - .min_salary(1000) - .title("后端研发") - .job_managers(JobManager.builder().build()) - .job_process_id("6960663240925956554") - .process_type(1) - .subject_id("6960663240925956555") - .job_function_id("6960663240925956555") - .department_id("6960663240925956549") - .head_count(100) - .is_never_expired(False) - .max_salary(2000) - .requirement("熟悉后端研发") - .description("后端研发岗位描述") - .highlight_list([]) - .job_type_id("6960663240925956551") - .max_level_id("6960663240925956548") - .recruitment_type_id("6960663240925956552") - .required_degree(20) - .job_category_id("6960663240925956550") - .address_id_list([]) - .job_attribute(1) - .expiry_timestamp("1622484739955") - .interview_registration_schema_id("6930815272790114324") - .onboard_registration_schema_id("6930815272790114325") - .target_major_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedCreateJobRequest = CombinedCreateJobRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(CombinedJob.builder() + .code("R18") + .experience(1) + .expiry_time(0) + .customized_data_list([]) + .min_level_id("6960663240925956547") + .min_salary(1000) + .title("后端研发") + .job_managers(JobManager.builder().build()) + .job_process_id("6960663240925956554") + .process_type(1) + .subject_id("6960663240925956555") + .job_function_id("6960663240925956555") + .department_id("6960663240925956549") + .head_count(100) + .is_never_expired(False) + .max_salary(2000) + .requirement("熟悉后端研发") + .description("后端研发岗位描述") + .highlight_list([]) + .job_type_id("6960663240925956551") + .max_level_id("6960663240925956548") + .recruitment_type_id("6960663240925956552") + .required_degree(20) + .job_category_id("6960663240925956550") + .address_id_list([]) + .job_attribute(1) + .expiry_timestamp("1622484739955") + .interview_registration_schema_id("6930815272790114324") + .onboard_registration_schema_id("6930815272790114325") + .target_major_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CombinedCreateJobResponse = await client.hire.v1.job.acombined_create(request) + # 发起请求 + response: CombinedCreateJobResponse = await client.hire.v1.job.acombined_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.acombined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.acombined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/combined_create_talent_sample.py b/samples/api/hire/v1/combined_create_talent_sample.py index ea043db62..9bcac09a4 100644 --- a/samples/api/hire/v1/combined_create_talent_sample.py +++ b/samples/api/hire/v1/combined_create_talent_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedCreateTalentRequest = CombinedCreateTalentRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CombinedCreateTalentRequestBody.builder() - .init_source_id("1") - .resume_source_id("1") - .folder_id_list([]) - .creator_id("ou-xxx") - .creator_account_type(1) - .resume_attachment_id("12345") - .basic_info(TalentCombinedBasicInfo.builder().build()) - .education_list([]) - .career_list([]) - .project_list([]) - .works_list([]) - .award_list([]) - .language_list([]) - .sns_list([]) - .preferred_city_code_list([]) - .self_evaluation(TalentSelfEvaluation.builder().build()) - .customized_data([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedCreateTalentRequest = CombinedCreateTalentRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CombinedCreateTalentRequestBody.builder() + .init_source_id("1") + .resume_source_id("1") + .folder_id_list([]) + .creator_id("ou-xxx") + .creator_account_type(1) + .resume_attachment_id("12345") + .basic_info(TalentCombinedBasicInfo.builder().build()) + .education_list([]) + .career_list([]) + .project_list([]) + .works_list([]) + .award_list([]) + .language_list([]) + .sns_list([]) + .preferred_city_code_list([]) + .self_evaluation(TalentSelfEvaluation.builder().build()) + .customized_data([]) + .build()) \ + .build() - # 发起请求 - response: CombinedCreateTalentResponse = client.hire.v1.talent.combined_create(request) + # 发起请求 + response: CombinedCreateTalentResponse = client.hire.v1.talent.combined_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.combined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.combined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedCreateTalentRequest = CombinedCreateTalentRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CombinedCreateTalentRequestBody.builder() - .init_source_id("1") - .resume_source_id("1") - .folder_id_list([]) - .creator_id("ou-xxx") - .creator_account_type(1) - .resume_attachment_id("12345") - .basic_info(TalentCombinedBasicInfo.builder().build()) - .education_list([]) - .career_list([]) - .project_list([]) - .works_list([]) - .award_list([]) - .language_list([]) - .sns_list([]) - .preferred_city_code_list([]) - .self_evaluation(TalentSelfEvaluation.builder().build()) - .customized_data([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedCreateTalentRequest = CombinedCreateTalentRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CombinedCreateTalentRequestBody.builder() + .init_source_id("1") + .resume_source_id("1") + .folder_id_list([]) + .creator_id("ou-xxx") + .creator_account_type(1) + .resume_attachment_id("12345") + .basic_info(TalentCombinedBasicInfo.builder().build()) + .education_list([]) + .career_list([]) + .project_list([]) + .works_list([]) + .award_list([]) + .language_list([]) + .sns_list([]) + .preferred_city_code_list([]) + .self_evaluation(TalentSelfEvaluation.builder().build()) + .customized_data([]) + .build()) \ + .build() - # 发起请求 - response: CombinedCreateTalentResponse = await client.hire.v1.talent.acombined_create(request) + # 发起请求 + response: CombinedCreateTalentResponse = await client.hire.v1.talent.acombined_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.acombined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.acombined_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/combined_update_job_sample.py b/samples/api/hire/v1/combined_update_job_sample.py index d2c24266c..2f12bf248 100644 --- a/samples/api/hire/v1/combined_update_job_sample.py +++ b/samples/api/hire/v1/combined_update_job_sample.py @@ -5,122 +5,122 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedUpdateJobRequest = CombinedUpdateJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(CombinedJob.builder() - .id("6960663240925956576") - .experience(1) - .expiry_time(0) - .customized_data_list([]) - .min_level_id("6960663240925956547") - .min_salary(1000) - .title("后端研发") - .job_managers(JobManager.builder().build()) - .job_process_id("6960663240925956554") - .subject_id("6960663240925956555") - .job_function_id("6960663240925956555") - .department_id("6960663240925956549") - .head_count(100) - .is_never_expired(False) - .max_salary(2000) - .requirement("熟悉后端研发") - .description("后端研发岗位描述") - .highlight_list([]) - .job_type_id("6960663240925956551") - .max_level_id("6960663240925956548") - .required_degree(20) - .job_category_id("6960663240925956550") - .address_id_list([]) - .job_attribute(1) - .expiry_timestamp("1622484739955") - .target_major_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedUpdateJobRequest = CombinedUpdateJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(CombinedJob.builder() + .id("6960663240925956576") + .experience(1) + .expiry_time(0) + .customized_data_list([]) + .min_level_id("6960663240925956547") + .min_salary(1000) + .title("后端研发") + .job_managers(JobManager.builder().build()) + .job_process_id("6960663240925956554") + .subject_id("6960663240925956555") + .job_function_id("6960663240925956555") + .department_id("6960663240925956549") + .head_count(100) + .is_never_expired(False) + .max_salary(2000) + .requirement("熟悉后端研发") + .description("后端研发岗位描述") + .highlight_list([]) + .job_type_id("6960663240925956551") + .max_level_id("6960663240925956548") + .required_degree(20) + .job_category_id("6960663240925956550") + .address_id_list([]) + .job_attribute(1) + .expiry_timestamp("1622484739955") + .target_major_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CombinedUpdateJobResponse = client.hire.v1.job.combined_update(request) + # 发起请求 + response: CombinedUpdateJobResponse = client.hire.v1.job.combined_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.combined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.combined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedUpdateJobRequest = CombinedUpdateJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(CombinedJob.builder() - .id("6960663240925956576") - .experience(1) - .expiry_time(0) - .customized_data_list([]) - .min_level_id("6960663240925956547") - .min_salary(1000) - .title("后端研发") - .job_managers(JobManager.builder().build()) - .job_process_id("6960663240925956554") - .subject_id("6960663240925956555") - .job_function_id("6960663240925956555") - .department_id("6960663240925956549") - .head_count(100) - .is_never_expired(False) - .max_salary(2000) - .requirement("熟悉后端研发") - .description("后端研发岗位描述") - .highlight_list([]) - .job_type_id("6960663240925956551") - .max_level_id("6960663240925956548") - .required_degree(20) - .job_category_id("6960663240925956550") - .address_id_list([]) - .job_attribute(1) - .expiry_timestamp("1622484739955") - .target_major_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedUpdateJobRequest = CombinedUpdateJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(CombinedJob.builder() + .id("6960663240925956576") + .experience(1) + .expiry_time(0) + .customized_data_list([]) + .min_level_id("6960663240925956547") + .min_salary(1000) + .title("后端研发") + .job_managers(JobManager.builder().build()) + .job_process_id("6960663240925956554") + .subject_id("6960663240925956555") + .job_function_id("6960663240925956555") + .department_id("6960663240925956549") + .head_count(100) + .is_never_expired(False) + .max_salary(2000) + .requirement("熟悉后端研发") + .description("后端研发岗位描述") + .highlight_list([]) + .job_type_id("6960663240925956551") + .max_level_id("6960663240925956548") + .required_degree(20) + .job_category_id("6960663240925956550") + .address_id_list([]) + .job_attribute(1) + .expiry_timestamp("1622484739955") + .target_major_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CombinedUpdateJobResponse = await client.hire.v1.job.acombined_update(request) + # 发起请求 + response: CombinedUpdateJobResponse = await client.hire.v1.job.acombined_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.acombined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.acombined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/combined_update_talent_sample.py b/samples/api/hire/v1/combined_update_talent_sample.py index 801d9c7fb..f831505d1 100644 --- a/samples/api/hire/v1/combined_update_talent_sample.py +++ b/samples/api/hire/v1/combined_update_talent_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedUpdateTalentRequest = CombinedUpdateTalentRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CombinedUpdateTalentRequestBody.builder() - .talent_id("1") - .init_source_id("1") - .folder_id_list([]) - .operator_id("ou_xxx") - .operator_account_type(1) - .resume_attachment_id("12345") - .basic_info(TalentCombinedBasicInfo.builder().build()) - .education_list([]) - .career_list([]) - .project_list([]) - .works_list([]) - .award_list([]) - .language_list([]) - .sns_list([]) - .preferred_city_code_list([]) - .self_evaluation(TalentSelfEvaluation.builder().build()) - .customized_data([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedUpdateTalentRequest = CombinedUpdateTalentRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CombinedUpdateTalentRequestBody.builder() + .talent_id("1") + .init_source_id("1") + .folder_id_list([]) + .operator_id("ou_xxx") + .operator_account_type(1) + .resume_attachment_id("12345") + .basic_info(TalentCombinedBasicInfo.builder().build()) + .education_list([]) + .career_list([]) + .project_list([]) + .works_list([]) + .award_list([]) + .language_list([]) + .sns_list([]) + .preferred_city_code_list([]) + .self_evaluation(TalentSelfEvaluation.builder().build()) + .customized_data([]) + .build()) \ + .build() - # 发起请求 - response: CombinedUpdateTalentResponse = client.hire.v1.talent.combined_update(request) + # 发起请求 + response: CombinedUpdateTalentResponse = client.hire.v1.talent.combined_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.combined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.combined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CombinedUpdateTalentRequest = CombinedUpdateTalentRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CombinedUpdateTalentRequestBody.builder() - .talent_id("1") - .init_source_id("1") - .folder_id_list([]) - .operator_id("ou_xxx") - .operator_account_type(1) - .resume_attachment_id("12345") - .basic_info(TalentCombinedBasicInfo.builder().build()) - .education_list([]) - .career_list([]) - .project_list([]) - .works_list([]) - .award_list([]) - .language_list([]) - .sns_list([]) - .preferred_city_code_list([]) - .self_evaluation(TalentSelfEvaluation.builder().build()) - .customized_data([]) - .build()) \ - .build() + # 构造请求对象 + request: CombinedUpdateTalentRequest = CombinedUpdateTalentRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CombinedUpdateTalentRequestBody.builder() + .talent_id("1") + .init_source_id("1") + .folder_id_list([]) + .operator_id("ou_xxx") + .operator_account_type(1) + .resume_attachment_id("12345") + .basic_info(TalentCombinedBasicInfo.builder().build()) + .education_list([]) + .career_list([]) + .project_list([]) + .works_list([]) + .award_list([]) + .language_list([]) + .sns_list([]) + .preferred_city_code_list([]) + .self_evaluation(TalentSelfEvaluation.builder().build()) + .customized_data([]) + .build()) \ + .build() - # 发起请求 - response: CombinedUpdateTalentResponse = await client.hire.v1.talent.acombined_update(request) + # 发起请求 + response: CombinedUpdateTalentResponse = await client.hire.v1.talent.acombined_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.acombined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.acombined_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/config_job_sample.py b/samples/api/hire/v1/config_job_sample.py index 1e3a7d133..dded7c7b9 100644 --- a/samples/api/hire/v1/config_job_sample.py +++ b/samples/api/hire/v1/config_job_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ConfigJobRequest = ConfigJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ConfigJobRequest = ConfigJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ConfigJobResponse = client.hire.v1.job.config(request) + # 发起请求 + response: ConfigJobResponse = client.hire.v1.job.config(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ConfigJobRequest = ConfigJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ConfigJobRequest = ConfigJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ConfigJobResponse = await client.hire.v1.job.aconfig(request) + # 发起请求 + response: ConfigJobResponse = await client.hire.v1.job.aconfig(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.aconfig failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.aconfig failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_application_sample.py b/samples/api/hire/v1/create_application_sample.py index c94784212..b7c37e404 100644 --- a/samples/api/hire/v1/create_application_sample.py +++ b/samples/api/hire/v1/create_application_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateApplicationRequest = CreateApplicationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateApplicationRequestBody.builder() - .talent_id("12312312312") - .job_id("12312312312") - .user_id("6930815272790114324") - .resume_source_id("7115289562569591070") - .application_preferred_city_code_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateApplicationRequest = CreateApplicationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateApplicationRequestBody.builder() + .talent_id("12312312312") + .job_id("12312312312") + .user_id("6930815272790114324") + .resume_source_id("7115289562569591070") + .application_preferred_city_code_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateApplicationResponse = client.hire.v1.application.create(request) + # 发起请求 + response: CreateApplicationResponse = client.hire.v1.application.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateApplicationRequest = CreateApplicationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateApplicationRequestBody.builder() - .talent_id("12312312312") - .job_id("12312312312") - .user_id("6930815272790114324") - .resume_source_id("7115289562569591070") - .application_preferred_city_code_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateApplicationRequest = CreateApplicationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateApplicationRequestBody.builder() + .talent_id("12312312312") + .job_id("12312312312") + .user_id("6930815272790114324") + .resume_source_id("7115289562569591070") + .application_preferred_city_code_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateApplicationResponse = await client.hire.v1.application.acreate(request) + # 发起请求 + response: CreateApplicationResponse = await client.hire.v1.application.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_attachment_sample.py b/samples/api/hire/v1/create_attachment_sample.py index 359bec00f..819a3b985 100644 --- a/samples/api/hire/v1/create_attachment_sample.py +++ b/samples/api/hire/v1/create_attachment_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateAttachmentRequest = CreateAttachmentRequest.builder() \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateAttachmentRequest = CreateAttachmentRequest.builder() \ + .build() - # 发起请求 - response: CreateAttachmentResponse = client.hire.v1.attachment.create(request) + # 发起请求 + response: CreateAttachmentResponse = client.hire.v1.attachment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateAttachmentRequest = CreateAttachmentRequest.builder() \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateAttachmentRequest = CreateAttachmentRequest.builder() \ + .build() - # 发起请求 - response: CreateAttachmentResponse = await client.hire.v1.attachment.acreate(request) + # 发起请求 + response: CreateAttachmentResponse = await client.hire.v1.attachment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_by_attachment_website_delivery_sample.py b/samples/api/hire/v1/create_by_attachment_website_delivery_sample.py index dc2e19929..107986814 100644 --- a/samples/api/hire/v1/create_by_attachment_website_delivery_sample.py +++ b/samples/api/hire/v1/create_by_attachment_website_delivery_sample.py @@ -5,81 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateByAttachmentWebsiteDeliveryRequest = CreateByAttachmentWebsiteDeliveryRequest.builder() \ - .website_id("7047318856652261676") \ - .request_body(WebsiteDeliveryAttachment.builder() - .job_post_id("6960663240925956636") - .user_id("6960663240925956634") - .resume_file_id("7095614894070434092") - .channel_id("6891560630172518670") - .application_preferred_city_code_list([]) - .mobile_country_code("CN_1") - .mobile("182900291190") - .email("foo@bytedance.com") - .identification(WebsiteDeliveryAttachmentIndentification.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateByAttachmentWebsiteDeliveryRequest = CreateByAttachmentWebsiteDeliveryRequest.builder() \ + .website_id("7047318856652261676") \ + .request_body(WebsiteDeliveryAttachment.builder() + .job_post_id("6960663240925956636") + .user_id("6960663240925956634") + .resume_file_id("7095614894070434092") + .channel_id("6891560630172518670") + .application_preferred_city_code_list([]) + .mobile_country_code("CN_1") + .mobile("182900291190") + .email("foo@bytedance.com") + .identification(WebsiteDeliveryAttachmentIndentification.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateByAttachmentWebsiteDeliveryResponse = client.hire.v1.website_delivery.create_by_attachment(request) + # 发起请求 + response: CreateByAttachmentWebsiteDeliveryResponse = client.hire.v1.website_delivery.create_by_attachment(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery.create_by_attachment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery.create_by_attachment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateByAttachmentWebsiteDeliveryRequest = CreateByAttachmentWebsiteDeliveryRequest.builder() \ - .website_id("7047318856652261676") \ - .request_body(WebsiteDeliveryAttachment.builder() - .job_post_id("6960663240925956636") - .user_id("6960663240925956634") - .resume_file_id("7095614894070434092") - .channel_id("6891560630172518670") - .application_preferred_city_code_list([]) - .mobile_country_code("CN_1") - .mobile("182900291190") - .email("foo@bytedance.com") - .identification(WebsiteDeliveryAttachmentIndentification.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateByAttachmentWebsiteDeliveryRequest = CreateByAttachmentWebsiteDeliveryRequest.builder() \ + .website_id("7047318856652261676") \ + .request_body(WebsiteDeliveryAttachment.builder() + .job_post_id("6960663240925956636") + .user_id("6960663240925956634") + .resume_file_id("7095614894070434092") + .channel_id("6891560630172518670") + .application_preferred_city_code_list([]) + .mobile_country_code("CN_1") + .mobile("182900291190") + .email("foo@bytedance.com") + .identification(WebsiteDeliveryAttachmentIndentification.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateByAttachmentWebsiteDeliveryResponse = await client.hire.v1.website_delivery.acreate_by_attachment( - request) + # 发起请求 + response: CreateByAttachmentWebsiteDeliveryResponse = await client.hire.v1.website_delivery.acreate_by_attachment(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery.acreate_by_attachment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery.acreate_by_attachment failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_by_resume_website_delivery_sample.py b/samples/api/hire/v1/create_by_resume_website_delivery_sample.py index 8537cd942..6777ceec1 100644 --- a/samples/api/hire/v1/create_by_resume_website_delivery_sample.py +++ b/samples/api/hire/v1/create_by_resume_website_delivery_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateByResumeWebsiteDeliveryRequest = CreateByResumeWebsiteDeliveryRequest.builder() \ - .website_id("1618209327096") \ - .user_id_type("open_id") \ - .request_body(WebsiteDelivery.builder() - .job_post_id("6960663240925956636") - .resume(WebsiteDeliveryResume.builder().build()) - .user_id("6960663240925956634") - .application_preferred_city_code_list([]) - .channel_id("6891560630172518670") - .build()) \ - .build() + # 构造请求对象 + request: CreateByResumeWebsiteDeliveryRequest = CreateByResumeWebsiteDeliveryRequest.builder() \ + .website_id("1618209327096") \ + .user_id_type("open_id") \ + .request_body(WebsiteDelivery.builder() + .job_post_id("6960663240925956636") + .resume(WebsiteDeliveryResume.builder().build()) + .user_id("6960663240925956634") + .application_preferred_city_code_list([]) + .channel_id("6891560630172518670") + .build()) \ + .build() - # 发起请求 - response: CreateByResumeWebsiteDeliveryResponse = client.hire.v1.website_delivery.create_by_resume(request) + # 发起请求 + response: CreateByResumeWebsiteDeliveryResponse = client.hire.v1.website_delivery.create_by_resume(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery.create_by_resume failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery.create_by_resume failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateByResumeWebsiteDeliveryRequest = CreateByResumeWebsiteDeliveryRequest.builder() \ - .website_id("1618209327096") \ - .user_id_type("open_id") \ - .request_body(WebsiteDelivery.builder() - .job_post_id("6960663240925956636") - .resume(WebsiteDeliveryResume.builder().build()) - .user_id("6960663240925956634") - .application_preferred_city_code_list([]) - .channel_id("6891560630172518670") - .build()) \ - .build() + # 构造请求对象 + request: CreateByResumeWebsiteDeliveryRequest = CreateByResumeWebsiteDeliveryRequest.builder() \ + .website_id("1618209327096") \ + .user_id_type("open_id") \ + .request_body(WebsiteDelivery.builder() + .job_post_id("6960663240925956636") + .resume(WebsiteDeliveryResume.builder().build()) + .user_id("6960663240925956634") + .application_preferred_city_code_list([]) + .channel_id("6891560630172518670") + .build()) \ + .build() - # 发起请求 - response: CreateByResumeWebsiteDeliveryResponse = await client.hire.v1.website_delivery.acreate_by_resume(request) + # 发起请求 + response: CreateByResumeWebsiteDeliveryResponse = await client.hire.v1.website_delivery.acreate_by_resume(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery.acreate_by_resume failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery.acreate_by_resume failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_eco_account_custom_field_sample.py b/samples/api/hire/v1/create_eco_account_custom_field_sample.py index 14068b12a..acc413558 100644 --- a/samples/api/hire/v1/create_eco_account_custom_field_sample.py +++ b/samples/api/hire/v1/create_eco_account_custom_field_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoAccountCustomFieldRequest = CreateEcoAccountCustomFieldRequest.builder() \ - .request_body(EcoAccountCustomField.builder() - .scope(1) - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoAccountCustomFieldRequest = CreateEcoAccountCustomFieldRequest.builder() \ + .request_body(EcoAccountCustomField.builder() + .scope(1) + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.create(request) + # 发起请求 + response: CreateEcoAccountCustomFieldResponse = client.hire.v1.eco_account_custom_field.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoAccountCustomFieldRequest = CreateEcoAccountCustomFieldRequest.builder() \ - .request_body(EcoAccountCustomField.builder() - .scope(1) - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoAccountCustomFieldRequest = CreateEcoAccountCustomFieldRequest.builder() \ + .request_body(EcoAccountCustomField.builder() + .scope(1) + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.acreate(request) + # 发起请求 + response: CreateEcoAccountCustomFieldResponse = await client.hire.v1.eco_account_custom_field.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_account_custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_account_custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_eco_background_check_custom_field_sample.py b/samples/api/hire/v1/create_eco_background_check_custom_field_sample.py index d1017db83..84ba8b90e 100644 --- a/samples/api/hire/v1/create_eco_background_check_custom_field_sample.py +++ b/samples/api/hire/v1/create_eco_background_check_custom_field_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoBackgroundCheckCustomFieldRequest = CreateEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(EcoBackgroundCheckCustomField.builder() - .account_id("6995842370159937061") - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoBackgroundCheckCustomFieldRequest = CreateEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(EcoBackgroundCheckCustomField.builder() + .account_id("6995842370159937061") + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.create( - request) + # 发起请求 + response: CreateEcoBackgroundCheckCustomFieldResponse = client.hire.v1.eco_background_check_custom_field.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoBackgroundCheckCustomFieldRequest = CreateEcoBackgroundCheckCustomFieldRequest.builder() \ - .request_body(EcoBackgroundCheckCustomField.builder() - .account_id("6995842370159937061") - .custom_field_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoBackgroundCheckCustomFieldRequest = CreateEcoBackgroundCheckCustomFieldRequest.builder() \ + .request_body(EcoBackgroundCheckCustomField.builder() + .account_id("6995842370159937061") + .custom_field_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.acreate( - request) + # 发起请求 + response: CreateEcoBackgroundCheckCustomFieldResponse = await client.hire.v1.eco_background_check_custom_field.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_eco_background_check_package_sample.py b/samples/api/hire/v1/create_eco_background_check_package_sample.py index 4e1f844e7..8c6292ac3 100644 --- a/samples/api/hire/v1/create_eco_background_check_package_sample.py +++ b/samples/api/hire/v1/create_eco_background_check_package_sample.py @@ -5,67 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoBackgroundCheckPackageRequest = CreateEcoBackgroundCheckPackageRequest.builder() \ - .request_body(EcoBackgroundCheckPackage.builder() - .account_id("ord_id") - .package_list([]) - .additional_item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoBackgroundCheckPackageRequest = CreateEcoBackgroundCheckPackageRequest.builder() \ + .request_body(EcoBackgroundCheckPackage.builder() + .account_id("ord_id") + .package_list([]) + .additional_item_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.create(request) + # 发起请求 + response: CreateEcoBackgroundCheckPackageResponse = client.hire.v1.eco_background_check_package.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoBackgroundCheckPackageRequest = CreateEcoBackgroundCheckPackageRequest.builder() \ - .request_body(EcoBackgroundCheckPackage.builder() - .account_id("ord_id") - .package_list([]) - .additional_item_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoBackgroundCheckPackageRequest = CreateEcoBackgroundCheckPackageRequest.builder() \ + .request_body(EcoBackgroundCheckPackage.builder() + .account_id("ord_id") + .package_list([]) + .additional_item_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.acreate( - request) + # 发起请求 + response: CreateEcoBackgroundCheckPackageResponse = await client.hire.v1.eco_background_check_package.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check_package.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check_package.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_eco_exam_paper_sample.py b/samples/api/hire/v1/create_eco_exam_paper_sample.py index 1d2497e38..a9d3b5a8d 100644 --- a/samples/api/hire/v1/create_eco_exam_paper_sample.py +++ b/samples/api/hire/v1/create_eco_exam_paper_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoExamPaperRequest = CreateEcoExamPaperRequest.builder() \ - .request_body(EcoExamPaper.builder() - .account_id("7147998241542539527") - .paper_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoExamPaperRequest = CreateEcoExamPaperRequest.builder() \ + .request_body(EcoExamPaper.builder() + .account_id("7147998241542539527") + .paper_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoExamPaperResponse = client.hire.v1.eco_exam_paper.create(request) + # 发起请求 + response: CreateEcoExamPaperResponse = client.hire.v1.eco_exam_paper.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEcoExamPaperRequest = CreateEcoExamPaperRequest.builder() \ - .request_body(EcoExamPaper.builder() - .account_id("7147998241542539527") - .paper_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEcoExamPaperRequest = CreateEcoExamPaperRequest.builder() \ + .request_body(EcoExamPaper.builder() + .account_id("7147998241542539527") + .paper_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.acreate(request) + # 发起请求 + response: CreateEcoExamPaperResponse = await client.hire.v1.eco_exam_paper.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam_paper.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam_paper.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_exam_sample.py b/samples/api/hire/v1/create_exam_sample.py index 0c1bd305b..1c8ce16b1 100644 --- a/samples/api/hire/v1/create_exam_sample.py +++ b/samples/api/hire/v1/create_exam_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExamRequest = CreateExamRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateExamRequestBody.builder() - .application_id("6891565253964859661") - .exam_resource_name("笔试试卷") - .score(100) - .uuid("6949805467799537964") - .operator_id("ou_f476cb099ac9227c9bae09ce46112579") - .build()) \ - .build() + # 构造请求对象 + request: CreateExamRequest = CreateExamRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateExamRequestBody.builder() + .application_id("6891565253964859661") + .exam_resource_name("笔试试卷") + .score(100) + .uuid("6949805467799537964") + .operator_id("ou_f476cb099ac9227c9bae09ce46112579") + .build()) \ + .build() - # 发起请求 - response: CreateExamResponse = client.hire.v1.exam.create(request) + # 发起请求 + response: CreateExamResponse = client.hire.v1.exam.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.exam.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.exam.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExamRequest = CreateExamRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateExamRequestBody.builder() - .application_id("6891565253964859661") - .exam_resource_name("笔试试卷") - .score(100) - .uuid("6949805467799537964") - .operator_id("ou_f476cb099ac9227c9bae09ce46112579") - .build()) \ - .build() + # 构造请求对象 + request: CreateExamRequest = CreateExamRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateExamRequestBody.builder() + .application_id("6891565253964859661") + .exam_resource_name("笔试试卷") + .score(100) + .uuid("6949805467799537964") + .operator_id("ou_f476cb099ac9227c9bae09ce46112579") + .build()) \ + .build() - # 发起请求 - response: CreateExamResponse = await client.hire.v1.exam.acreate(request) + # 发起请求 + response: CreateExamResponse = await client.hire.v1.exam.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.exam.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.exam.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_external_application_sample.py b/samples/api/hire/v1/create_external_application_sample.py index 2ae97a647..1f9f4854b 100644 --- a/samples/api/hire/v1/create_external_application_sample.py +++ b/samples/api/hire/v1/create_external_application_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalApplicationRequest = CreateExternalApplicationRequest.builder() \ - .request_body(ExternalApplication.builder() - .external_id("123") - .job_recruitment_type(1) - .job_title("高级Java") - .resume_source("lagou") - .stage("1") - .talent_id("6960663240925956459") - .termination_reason("不合适") - .delivery_type(1) - .modify_time(1618500278645) - .create_time(1618500278644) - .termination_type("health") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalApplicationRequest = CreateExternalApplicationRequest.builder() \ + .request_body(ExternalApplication.builder() + .external_id("123") + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .talent_id("6960663240925956459") + .termination_reason("不合适") + .delivery_type(1) + .modify_time(1618500278645) + .create_time(1618500278644) + .termination_type("health") + .build()) \ + .build() - # 发起请求 - response: CreateExternalApplicationResponse = client.hire.v1.external_application.create(request) + # 发起请求 + response: CreateExternalApplicationResponse = client.hire.v1.external_application.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalApplicationRequest = CreateExternalApplicationRequest.builder() \ - .request_body(ExternalApplication.builder() - .external_id("123") - .job_recruitment_type(1) - .job_title("高级Java") - .resume_source("lagou") - .stage("1") - .talent_id("6960663240925956459") - .termination_reason("不合适") - .delivery_type(1) - .modify_time(1618500278645) - .create_time(1618500278644) - .termination_type("health") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalApplicationRequest = CreateExternalApplicationRequest.builder() \ + .request_body(ExternalApplication.builder() + .external_id("123") + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .talent_id("6960663240925956459") + .termination_reason("不合适") + .delivery_type(1) + .modify_time(1618500278645) + .create_time(1618500278644) + .termination_type("health") + .build()) \ + .build() - # 发起请求 - response: CreateExternalApplicationResponse = await client.hire.v1.external_application.acreate(request) + # 发起请求 + response: CreateExternalApplicationResponse = await client.hire.v1.external_application.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_external_background_check_sample.py b/samples/api/hire/v1/create_external_background_check_sample.py index d0a68b258..30733a915 100644 --- a/samples/api/hire/v1/create_external_background_check_sample.py +++ b/samples/api/hire/v1/create_external_background_check_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalBackgroundCheckRequest = CreateExternalBackgroundCheckRequest.builder() \ - .request_body(ExternalBackgroundCheck.builder() - .external_id("123") - .external_application_id("1234111") - .date(1626602069393) - .name("测试.pdf") - .result("1") - .attachment_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalBackgroundCheckRequest = CreateExternalBackgroundCheckRequest.builder() \ + .request_body(ExternalBackgroundCheck.builder() + .external_id("123") + .external_application_id("1234111") + .date(1626602069393) + .name("测试.pdf") + .result("1") + .attachment_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalBackgroundCheckResponse = client.hire.v1.external_background_check.create(request) + # 发起请求 + response: CreateExternalBackgroundCheckResponse = client.hire.v1.external_background_check.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_background_check.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_background_check.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalBackgroundCheckRequest = CreateExternalBackgroundCheckRequest.builder() \ - .request_body(ExternalBackgroundCheck.builder() - .external_id("123") - .external_application_id("1234111") - .date(1626602069393) - .name("测试.pdf") - .result("1") - .attachment_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalBackgroundCheckRequest = CreateExternalBackgroundCheckRequest.builder() \ + .request_body(ExternalBackgroundCheck.builder() + .external_id("123") + .external_application_id("1234111") + .date(1626602069393) + .name("测试.pdf") + .result("1") + .attachment_id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalBackgroundCheckResponse = await client.hire.v1.external_background_check.acreate(request) + # 发起请求 + response: CreateExternalBackgroundCheckResponse = await client.hire.v1.external_background_check.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_background_check.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_background_check.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_external_interview_assessment_sample.py b/samples/api/hire/v1/create_external_interview_assessment_sample.py index 0abfdf897..7b1ea72a6 100644 --- a/samples/api/hire/v1/create_external_interview_assessment_sample.py +++ b/samples/api/hire/v1/create_external_interview_assessment_sample.py @@ -5,73 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInterviewAssessmentRequest = CreateExternalInterviewAssessmentRequest.builder() \ - .request_body(ExternalInterviewAssessment.builder() - .external_id("123") - .username("shaojiale") - .conclusion(1) - .assessment_dimension_list([]) - .content("hello world") - .external_interview_id("6986199832494934316") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInterviewAssessmentRequest = CreateExternalInterviewAssessmentRequest.builder() \ + .request_body(ExternalInterviewAssessment.builder() + .external_id("123") + .username("shaojiale") + .conclusion(1) + .assessment_dimension_list([]) + .content("hello world") + .external_interview_id("6986199832494934316") + .build()) \ + .build() - # 发起请求 - response: CreateExternalInterviewAssessmentResponse = client.hire.v1.external_interview_assessment.create(request) + # 发起请求 + response: CreateExternalInterviewAssessmentResponse = client.hire.v1.external_interview_assessment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview_assessment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview_assessment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInterviewAssessmentRequest = CreateExternalInterviewAssessmentRequest.builder() \ - .request_body(ExternalInterviewAssessment.builder() - .external_id("123") - .username("shaojiale") - .conclusion(1) - .assessment_dimension_list([]) - .content("hello world") - .external_interview_id("6986199832494934316") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInterviewAssessmentRequest = CreateExternalInterviewAssessmentRequest.builder() \ + .request_body(ExternalInterviewAssessment.builder() + .external_id("123") + .username("shaojiale") + .conclusion(1) + .assessment_dimension_list([]) + .content("hello world") + .external_interview_id("6986199832494934316") + .build()) \ + .build() - # 发起请求 - response: CreateExternalInterviewAssessmentResponse = await client.hire.v1.external_interview_assessment.acreate( - request) + # 发起请求 + response: CreateExternalInterviewAssessmentResponse = await client.hire.v1.external_interview_assessment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview_assessment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview_assessment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_external_interview_sample.py b/samples/api/hire/v1/create_external_interview_sample.py index e2d9cf346..ff32cfd14 100644 --- a/samples/api/hire/v1/create_external_interview_sample.py +++ b/samples/api/hire/v1/create_external_interview_sample.py @@ -5,70 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInterviewRequest = CreateExternalInterviewRequest.builder() \ - .request_body(ExternalInterview.builder() - .external_id("123") - .external_application_id("6960663240925956437") - .participate_status(1) - .begin_time(1618500278638) - .end_time(1618500278639) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInterviewRequest = CreateExternalInterviewRequest.builder() \ + .request_body(ExternalInterview.builder() + .external_id("123") + .external_application_id("6960663240925956437") + .participate_status(1) + .begin_time(1618500278638) + .end_time(1618500278639) + .interview_assessments([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalInterviewResponse = client.hire.v1.external_interview.create(request) + # 发起请求 + response: CreateExternalInterviewResponse = client.hire.v1.external_interview.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalInterviewRequest = CreateExternalInterviewRequest.builder() \ - .request_body(ExternalInterview.builder() - .external_id("123") - .external_application_id("6960663240925956437") - .participate_status(1) - .begin_time(1618500278638) - .end_time(1618500278639) - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalInterviewRequest = CreateExternalInterviewRequest.builder() \ + .request_body(ExternalInterview.builder() + .external_id("123") + .external_application_id("6960663240925956437") + .participate_status(1) + .begin_time(1618500278638) + .end_time(1618500278639) + .interview_assessments([]) + .build()) \ + .build() - # 发起请求 - response: CreateExternalInterviewResponse = await client.hire.v1.external_interview.acreate(request) + # 发起请求 + response: CreateExternalInterviewResponse = await client.hire.v1.external_interview.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_external_referral_reward_sample.py b/samples/api/hire/v1/create_external_referral_reward_sample.py index 94764ec3d..3a7e30a01 100644 --- a/samples/api/hire/v1/create_external_referral_reward_sample.py +++ b/samples/api/hire/v1/create_external_referral_reward_sample.py @@ -5,98 +5,98 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalReferralRewardRequest = CreateExternalReferralRewardRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ExternalReward.builder() - .referral_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .create_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .confirm_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .pay_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .external_id("6930815272790114324") - .application_id("6930815272790114325") - .talent_id("6930815272790114326") - .job_id("6930815272790114327") - .reason("首次推荐") - .rule_type(1) - .bonus(BonusAmount.builder().build()) - .stage(1) - .create_time("1704720275000") - .confirm_time("1704720275000") - .pay_time("1704720275001") - .onboard_time("1704720275002") - .conversion_time("1704720275003") - .comment("已发放") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalReferralRewardRequest = CreateExternalReferralRewardRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ExternalReward.builder() + .referral_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .create_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .confirm_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .pay_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .external_id("6930815272790114324") + .application_id("6930815272790114325") + .talent_id("6930815272790114326") + .job_id("6930815272790114327") + .reason("首次推荐") + .rule_type(1) + .bonus(BonusAmount.builder().build()) + .stage(1) + .create_time("1704720275000") + .confirm_time("1704720275000") + .pay_time("1704720275001") + .onboard_time("1704720275002") + .conversion_time("1704720275003") + .comment("已发放") + .build()) \ + .build() - # 发起请求 - response: CreateExternalReferralRewardResponse = client.hire.v1.external_referral_reward.create(request) + # 发起请求 + response: CreateExternalReferralRewardResponse = client.hire.v1.external_referral_reward.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_referral_reward.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_referral_reward.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateExternalReferralRewardRequest = CreateExternalReferralRewardRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ExternalReward.builder() - .referral_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .create_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .confirm_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .pay_user_id("on_94a1ee5551019f18cd73d9f111898cf2") - .external_id("6930815272790114324") - .application_id("6930815272790114325") - .talent_id("6930815272790114326") - .job_id("6930815272790114327") - .reason("首次推荐") - .rule_type(1) - .bonus(BonusAmount.builder().build()) - .stage(1) - .create_time("1704720275000") - .confirm_time("1704720275000") - .pay_time("1704720275001") - .onboard_time("1704720275002") - .conversion_time("1704720275003") - .comment("已发放") - .build()) \ - .build() + # 构造请求对象 + request: CreateExternalReferralRewardRequest = CreateExternalReferralRewardRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ExternalReward.builder() + .referral_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .create_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .confirm_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .pay_user_id("on_94a1ee5551019f18cd73d9f111898cf2") + .external_id("6930815272790114324") + .application_id("6930815272790114325") + .talent_id("6930815272790114326") + .job_id("6930815272790114327") + .reason("首次推荐") + .rule_type(1) + .bonus(BonusAmount.builder().build()) + .stage(1) + .create_time("1704720275000") + .confirm_time("1704720275000") + .pay_time("1704720275001") + .onboard_time("1704720275002") + .conversion_time("1704720275003") + .comment("已发放") + .build()) \ + .build() - # 发起请求 - response: CreateExternalReferralRewardResponse = await client.hire.v1.external_referral_reward.acreate(request) + # 发起请求 + response: CreateExternalReferralRewardResponse = await client.hire.v1.external_referral_reward.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_referral_reward.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_referral_reward.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_job_requirement_sample.py b/samples/api/hire/v1/create_job_requirement_sample.py index b1315878b..1125d1ece 100644 --- a/samples/api/hire/v1/create_job_requirement_sample.py +++ b/samples/api/hire/v1/create_job_requirement_sample.py @@ -5,120 +5,120 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobRequirementRequest = CreateJobRequirementRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(JobRequirement.builder() - .short_code("xx1") - .name("test") - .display_progress(1) - .head_count(11) - .recruitment_type_id("1618209327096") - .employee_type_id("6807409776231254285") - .max_level_id("123") - .min_level_id("11") - .sequence_id("111") - .category(1) - .department_id("1111") - .recruiter_id_list([]) - .jr_hiring_manager_id_list([]) - .direct_leader_id_list([]) - .start_time("1625729379000") - .deadline("1625729379000") - .priority(1) - .required_degree(1) - .max_salary("123") - .min_salary("11") - .address_id("11") - .description("11") - .customized_data_list([]) - .process_type(1) - .job_type_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobRequirementRequest = CreateJobRequirementRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(JobRequirement.builder() + .short_code("xx1") + .name("test") + .display_progress(1) + .head_count(11) + .recruitment_type_id("1618209327096") + .employee_type_id("6807409776231254285") + .max_level_id("123") + .min_level_id("11") + .sequence_id("111") + .category(1) + .department_id("1111") + .recruiter_id_list([]) + .jr_hiring_manager_id_list([]) + .direct_leader_id_list([]) + .start_time("1625729379000") + .deadline("1625729379000") + .priority(1) + .required_degree(1) + .max_salary("123") + .min_salary("11") + .address_id("11") + .description("11") + .customized_data_list([]) + .process_type(1) + .job_type_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: CreateJobRequirementResponse = client.hire.v1.job_requirement.create(request) + # 发起请求 + response: CreateJobRequirementResponse = client.hire.v1.job_requirement.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateJobRequirementRequest = CreateJobRequirementRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(JobRequirement.builder() - .short_code("xx1") - .name("test") - .display_progress(1) - .head_count(11) - .recruitment_type_id("1618209327096") - .employee_type_id("6807409776231254285") - .max_level_id("123") - .min_level_id("11") - .sequence_id("111") - .category(1) - .department_id("1111") - .recruiter_id_list([]) - .jr_hiring_manager_id_list([]) - .direct_leader_id_list([]) - .start_time("1625729379000") - .deadline("1625729379000") - .priority(1) - .required_degree(1) - .max_salary("123") - .min_salary("11") - .address_id("11") - .description("11") - .customized_data_list([]) - .process_type(1) - .job_type_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: CreateJobRequirementRequest = CreateJobRequirementRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(JobRequirement.builder() + .short_code("xx1") + .name("test") + .display_progress(1) + .head_count(11) + .recruitment_type_id("1618209327096") + .employee_type_id("6807409776231254285") + .max_level_id("123") + .min_level_id("11") + .sequence_id("111") + .category(1) + .department_id("1111") + .recruiter_id_list([]) + .jr_hiring_manager_id_list([]) + .direct_leader_id_list([]) + .start_time("1625729379000") + .deadline("1625729379000") + .priority(1) + .required_degree(1) + .max_salary("123") + .min_salary("11") + .address_id("11") + .description("11") + .customized_data_list([]) + .process_type(1) + .job_type_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: CreateJobRequirementResponse = await client.hire.v1.job_requirement.acreate(request) + # 发起请求 + response: CreateJobRequirementResponse = await client.hire.v1.job_requirement.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_note_sample.py b/samples/api/hire/v1/create_note_sample.py index 546ae49ad..d914839a0 100644 --- a/samples/api/hire/v1/create_note_sample.py +++ b/samples/api/hire/v1/create_note_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNoteRequest = CreateNoteRequest.builder() \ - .user_id_type("open_id") \ - .request_body(Note.builder() - .talent_id("6916472453069883661") - .application_id("6891565253964859661") - .creator_id("ou_f476cb099ac9227c9bae09ce46112579") - .content("测试5") - .privacy(2) - .notify_mentioned_user(False) - .mention_entity_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateNoteRequest = CreateNoteRequest.builder() \ + .user_id_type("open_id") \ + .request_body(Note.builder() + .talent_id("6916472453069883661") + .application_id("6891565253964859661") + .creator_id("ou_f476cb099ac9227c9bae09ce46112579") + .content("测试5") + .privacy(2) + .notify_mentioned_user(False) + .mention_entity_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateNoteResponse = client.hire.v1.note.create(request) + # 发起请求 + response: CreateNoteResponse = client.hire.v1.note.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateNoteRequest = CreateNoteRequest.builder() \ - .user_id_type("open_id") \ - .request_body(Note.builder() - .talent_id("6916472453069883661") - .application_id("6891565253964859661") - .creator_id("ou_f476cb099ac9227c9bae09ce46112579") - .content("测试5") - .privacy(2) - .notify_mentioned_user(False) - .mention_entity_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateNoteRequest = CreateNoteRequest.builder() \ + .user_id_type("open_id") \ + .request_body(Note.builder() + .talent_id("6916472453069883661") + .application_id("6891565253964859661") + .creator_id("ou_f476cb099ac9227c9bae09ce46112579") + .content("测试5") + .privacy(2) + .notify_mentioned_user(False) + .mention_entity_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateNoteResponse = await client.hire.v1.note.acreate(request) + # 发起请求 + response: CreateNoteResponse = await client.hire.v1.note.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_offer_sample.py b/samples/api/hire/v1/create_offer_sample.py index 4ffb2ff27..98f62174c 100644 --- a/samples/api/hire/v1/create_offer_sample.py +++ b/samples/api/hire/v1/create_offer_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOfferRequest = CreateOfferRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(OfferInfo.builder() - .application_id("7013552389293279532") - .schema_id("7013318077945596204") - .offer_type(1) - .basic_info(OfferBasicInfo.builder().build()) - .salary_info(OfferSalaryInfo.builder().build()) - .customized_info_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateOfferRequest = CreateOfferRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(OfferInfo.builder() + .application_id("7013552389293279532") + .schema_id("7013318077945596204") + .offer_type(1) + .basic_info(OfferBasicInfo.builder().build()) + .salary_info(OfferSalaryInfo.builder().build()) + .customized_info_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateOfferResponse = client.hire.v1.offer.create(request) + # 发起请求 + response: CreateOfferResponse = client.hire.v1.offer.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateOfferRequest = CreateOfferRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(OfferInfo.builder() - .application_id("7013552389293279532") - .schema_id("7013318077945596204") - .offer_type(1) - .basic_info(OfferBasicInfo.builder().build()) - .salary_info(OfferSalaryInfo.builder().build()) - .customized_info_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateOfferRequest = CreateOfferRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(OfferInfo.builder() + .application_id("7013552389293279532") + .schema_id("7013318077945596204") + .offer_type(1) + .basic_info(OfferBasicInfo.builder().build()) + .salary_info(OfferSalaryInfo.builder().build()) + .customized_info_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateOfferResponse = await client.hire.v1.offer.acreate(request) + # 发起请求 + response: CreateOfferResponse = await client.hire.v1.offer.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_referral_account_sample.py b/samples/api/hire/v1/create_referral_account_sample.py index 350df24e7..ac9c7a1a5 100644 --- a/samples/api/hire/v1/create_referral_account_sample.py +++ b/samples/api/hire/v1/create_referral_account_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateReferralAccountRequest = CreateReferralAccountRequest.builder() \ - .request_body(CreateReferralAccountRequestBody.builder() - .mobile(Mobile.builder().build()) - .email("hire@open.com") - .build()) \ - .build() + # 构造请求对象 + request: CreateReferralAccountRequest = CreateReferralAccountRequest.builder() \ + .request_body(CreateReferralAccountRequestBody.builder() + .mobile(Mobile.builder().build()) + .email("hire@open.com") + .build()) \ + .build() - # 发起请求 - response: CreateReferralAccountResponse = client.hire.v1.referral_account.create(request) + # 发起请求 + response: CreateReferralAccountResponse = client.hire.v1.referral_account.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateReferralAccountRequest = CreateReferralAccountRequest.builder() \ - .request_body(CreateReferralAccountRequestBody.builder() - .mobile(Mobile.builder().build()) - .email("hire@open.com") - .build()) \ - .build() + # 构造请求对象 + request: CreateReferralAccountRequest = CreateReferralAccountRequest.builder() \ + .request_body(CreateReferralAccountRequestBody.builder() + .mobile(Mobile.builder().build()) + .email("hire@open.com") + .build()) \ + .build() - # 发起请求 - response: CreateReferralAccountResponse = await client.hire.v1.referral_account.acreate(request) + # 发起请求 + response: CreateReferralAccountResponse = await client.hire.v1.referral_account.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_talent_external_info_sample.py b/samples/api/hire/v1/create_talent_external_info_sample.py index 183f64f9b..dc5a0b2d3 100644 --- a/samples/api/hire/v1/create_talent_external_info_sample.py +++ b/samples/api/hire/v1/create_talent_external_info_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTalentExternalInfoRequest = CreateTalentExternalInfoRequest.builder() \ - .talent_id("7043758982146345223") \ - .request_body(CreateTalentExternalInfoRequestBody.builder() - .external_create_time("1639992265035") - .build()) \ - .build() + # 构造请求对象 + request: CreateTalentExternalInfoRequest = CreateTalentExternalInfoRequest.builder() \ + .talent_id("7043758982146345223") \ + .request_body(CreateTalentExternalInfoRequestBody.builder() + .external_create_time("1639992265035") + .build()) \ + .build() - # 发起请求 - response: CreateTalentExternalInfoResponse = client.hire.v1.talent_external_info.create(request) + # 发起请求 + response: CreateTalentExternalInfoResponse = client.hire.v1.talent_external_info.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_external_info.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_external_info.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTalentExternalInfoRequest = CreateTalentExternalInfoRequest.builder() \ - .talent_id("7043758982146345223") \ - .request_body(CreateTalentExternalInfoRequestBody.builder() - .external_create_time("1639992265035") - .build()) \ - .build() + # 构造请求对象 + request: CreateTalentExternalInfoRequest = CreateTalentExternalInfoRequest.builder() \ + .talent_id("7043758982146345223") \ + .request_body(CreateTalentExternalInfoRequestBody.builder() + .external_create_time("1639992265035") + .build()) \ + .build() - # 发起请求 - response: CreateTalentExternalInfoResponse = await client.hire.v1.talent_external_info.acreate(request) + # 发起请求 + response: CreateTalentExternalInfoResponse = await client.hire.v1.talent_external_info.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_external_info.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_external_info.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_tripartite_agreement_sample.py b/samples/api/hire/v1/create_tripartite_agreement_sample.py index 4452cbaee..e4ae61808 100644 --- a/samples/api/hire/v1/create_tripartite_agreement_sample.py +++ b/samples/api/hire/v1/create_tripartite_agreement_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTripartiteAgreementRequest = CreateTripartiteAgreementRequest.builder() \ - .request_body(TripartiteAgreementInfo.builder() - .application_id("6930815272790114325") - .state(1) - .create_time("1698292282660") - .build()) \ - .build() + # 构造请求对象 + request: CreateTripartiteAgreementRequest = CreateTripartiteAgreementRequest.builder() \ + .request_body(TripartiteAgreementInfo.builder() + .application_id("6930815272790114325") + .state(1) + .create_time("1698292282660") + .build()) \ + .build() - # 发起请求 - response: CreateTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.create(request) + # 发起请求 + response: CreateTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTripartiteAgreementRequest = CreateTripartiteAgreementRequest.builder() \ - .request_body(TripartiteAgreementInfo.builder() - .application_id("6930815272790114325") - .state(1) - .create_time("1698292282660") - .build()) \ - .build() + # 构造请求对象 + request: CreateTripartiteAgreementRequest = CreateTripartiteAgreementRequest.builder() \ + .request_body(TripartiteAgreementInfo.builder() + .application_id("6930815272790114325") + .state(1) + .create_time("1698292282660") + .build()) \ + .build() - # 发起请求 - response: CreateTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.acreate(request) + # 发起请求 + response: CreateTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_website_channel_sample.py b/samples/api/hire/v1/create_website_channel_sample.py index 063f716fb..da493f53f 100644 --- a/samples/api/hire/v1/create_website_channel_sample.py +++ b/samples/api/hire/v1/create_website_channel_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWebsiteChannelRequest = CreateWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .request_body(CreateWebsiteChannelRequestBody.builder() - .channel_name("小爱侧推广渠道") - .build()) \ - .build() + # 构造请求对象 + request: CreateWebsiteChannelRequest = CreateWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .request_body(CreateWebsiteChannelRequestBody.builder() + .channel_name("小爱侧推广渠道") + .build()) \ + .build() - # 发起请求 - response: CreateWebsiteChannelResponse = client.hire.v1.website_channel.create(request) + # 发起请求 + response: CreateWebsiteChannelResponse = client.hire.v1.website_channel.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWebsiteChannelRequest = CreateWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .request_body(CreateWebsiteChannelRequestBody.builder() - .channel_name("小爱侧推广渠道") - .build()) \ - .build() + # 构造请求对象 + request: CreateWebsiteChannelRequest = CreateWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .request_body(CreateWebsiteChannelRequestBody.builder() + .channel_name("小爱侧推广渠道") + .build()) \ + .build() - # 发起请求 - response: CreateWebsiteChannelResponse = await client.hire.v1.website_channel.acreate(request) + # 发起请求 + response: CreateWebsiteChannelResponse = await client.hire.v1.website_channel.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/create_website_site_user_sample.py b/samples/api/hire/v1/create_website_site_user_sample.py index 268a7ab03..82607fe67 100644 --- a/samples/api/hire/v1/create_website_site_user_sample.py +++ b/samples/api/hire/v1/create_website_site_user_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWebsiteSiteUserRequest = CreateWebsiteSiteUserRequest.builder() \ - .website_id("1618209327096") \ - .request_body(WebsiteUser.builder() - .name("dan27") - .email("dan27@163.com") - .external_id("6960663240925956621") - .mobile("182900291190") - .mobile_country_code("CN_1") - .build()) \ - .build() + # 构造请求对象 + request: CreateWebsiteSiteUserRequest = CreateWebsiteSiteUserRequest.builder() \ + .website_id("1618209327096") \ + .request_body(WebsiteUser.builder() + .name("dan27") + .email("dan27@163.com") + .external_id("6960663240925956621") + .mobile("182900291190") + .mobile_country_code("CN_1") + .build()) \ + .build() - # 发起请求 - response: CreateWebsiteSiteUserResponse = client.hire.v1.website_site_user.create(request) + # 发起请求 + response: CreateWebsiteSiteUserResponse = client.hire.v1.website_site_user.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_site_user.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_site_user.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateWebsiteSiteUserRequest = CreateWebsiteSiteUserRequest.builder() \ - .website_id("1618209327096") \ - .request_body(WebsiteUser.builder() - .name("dan27") - .email("dan27@163.com") - .external_id("6960663240925956621") - .mobile("182900291190") - .mobile_country_code("CN_1") - .build()) \ - .build() + # 构造请求对象 + request: CreateWebsiteSiteUserRequest = CreateWebsiteSiteUserRequest.builder() \ + .website_id("1618209327096") \ + .request_body(WebsiteUser.builder() + .name("dan27") + .email("dan27@163.com") + .external_id("6960663240925956621") + .mobile("182900291190") + .mobile_country_code("CN_1") + .build()) \ + .build() - # 发起请求 - response: CreateWebsiteSiteUserResponse = await client.hire.v1.website_site_user.acreate(request) + # 发起请求 + response: CreateWebsiteSiteUserResponse = await client.hire.v1.website_site_user.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_site_user.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_site_user.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/deactivate_referral_account_sample.py b/samples/api/hire/v1/deactivate_referral_account_sample.py index 7e2f590a0..122db6992 100644 --- a/samples/api/hire/v1/deactivate_referral_account_sample.py +++ b/samples/api/hire/v1/deactivate_referral_account_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeactivateReferralAccountRequest = DeactivateReferralAccountRequest.builder() \ - .referral_account_id("6942778198054125570") \ - .build() + # 构造请求对象 + request: DeactivateReferralAccountRequest = DeactivateReferralAccountRequest.builder() \ + .referral_account_id("6942778198054125570") \ + .build() - # 发起请求 - response: DeactivateReferralAccountResponse = client.hire.v1.referral_account.deactivate(request) + # 发起请求 + response: DeactivateReferralAccountResponse = client.hire.v1.referral_account.deactivate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.deactivate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.deactivate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeactivateReferralAccountRequest = DeactivateReferralAccountRequest.builder() \ - .referral_account_id("6942778198054125570") \ - .build() + # 构造请求对象 + request: DeactivateReferralAccountRequest = DeactivateReferralAccountRequest.builder() \ + .referral_account_id("6942778198054125570") \ + .build() - # 发起请求 - response: DeactivateReferralAccountResponse = await client.hire.v1.referral_account.adeactivate(request) + # 发起请求 + response: DeactivateReferralAccountResponse = await client.hire.v1.referral_account.adeactivate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.adeactivate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.adeactivate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_external_application_sample.py b/samples/api/hire/v1/delete_external_application_sample.py index af6158a41..4e818039e 100644 --- a/samples/api/hire/v1/delete_external_application_sample.py +++ b/samples/api/hire/v1/delete_external_application_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExternalApplicationRequest = DeleteExternalApplicationRequest.builder() \ - .external_application_id("6960663240925956660") \ - .talent_id("6960663240925956660") \ - .build() + # 构造请求对象 + request: DeleteExternalApplicationRequest = DeleteExternalApplicationRequest.builder() \ + .external_application_id("6960663240925956660") \ + .talent_id("6960663240925956660") \ + .build() - # 发起请求 - response: DeleteExternalApplicationResponse = client.hire.v1.external_application.delete(request) + # 发起请求 + response: DeleteExternalApplicationResponse = client.hire.v1.external_application.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExternalApplicationRequest = DeleteExternalApplicationRequest.builder() \ - .external_application_id("6960663240925956660") \ - .talent_id("6960663240925956660") \ - .build() + # 构造请求对象 + request: DeleteExternalApplicationRequest = DeleteExternalApplicationRequest.builder() \ + .external_application_id("6960663240925956660") \ + .talent_id("6960663240925956660") \ + .build() - # 发起请求 - response: DeleteExternalApplicationResponse = await client.hire.v1.external_application.adelete(request) + # 发起请求 + response: DeleteExternalApplicationResponse = await client.hire.v1.external_application.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_external_referral_reward_sample.py b/samples/api/hire/v1/delete_external_referral_reward_sample.py index e2687ec2a..24bc55115 100644 --- a/samples/api/hire/v1/delete_external_referral_reward_sample.py +++ b/samples/api/hire/v1/delete_external_referral_reward_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExternalReferralRewardRequest = DeleteExternalReferralRewardRequest.builder() \ - .external_referral_reward_id("str") \ - .build() + # 构造请求对象 + request: DeleteExternalReferralRewardRequest = DeleteExternalReferralRewardRequest.builder() \ + .external_referral_reward_id("str") \ + .build() - # 发起请求 - response: DeleteExternalReferralRewardResponse = client.hire.v1.external_referral_reward.delete(request) + # 发起请求 + response: DeleteExternalReferralRewardResponse = client.hire.v1.external_referral_reward.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_referral_reward.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_referral_reward.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteExternalReferralRewardRequest = DeleteExternalReferralRewardRequest.builder() \ - .external_referral_reward_id("str") \ - .build() + # 构造请求对象 + request: DeleteExternalReferralRewardRequest = DeleteExternalReferralRewardRequest.builder() \ + .external_referral_reward_id("str") \ + .build() - # 发起请求 - response: DeleteExternalReferralRewardResponse = await client.hire.v1.external_referral_reward.adelete(request) + # 发起请求 + response: DeleteExternalReferralRewardResponse = await client.hire.v1.external_referral_reward.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_referral_reward.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_referral_reward.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_job_requirement_sample.py b/samples/api/hire/v1/delete_job_requirement_sample.py index dd0b19857..620d71798 100644 --- a/samples/api/hire/v1/delete_job_requirement_sample.py +++ b/samples/api/hire/v1/delete_job_requirement_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobRequirementRequest = DeleteJobRequirementRequest.builder() \ - .job_requirement_id("1616161616") \ - .build() + # 构造请求对象 + request: DeleteJobRequirementRequest = DeleteJobRequirementRequest.builder() \ + .job_requirement_id("1616161616") \ + .build() - # 发起请求 - response: DeleteJobRequirementResponse = client.hire.v1.job_requirement.delete(request) + # 发起请求 + response: DeleteJobRequirementResponse = client.hire.v1.job_requirement.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteJobRequirementRequest = DeleteJobRequirementRequest.builder() \ - .job_requirement_id("1616161616") \ - .build() + # 构造请求对象 + request: DeleteJobRequirementRequest = DeleteJobRequirementRequest.builder() \ + .job_requirement_id("1616161616") \ + .build() - # 发起请求 - response: DeleteJobRequirementResponse = await client.hire.v1.job_requirement.adelete(request) + # 发起请求 + response: DeleteJobRequirementResponse = await client.hire.v1.job_requirement.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_note_sample.py b/samples/api/hire/v1/delete_note_sample.py index bc7f1ec1e..dcfba6742 100644 --- a/samples/api/hire/v1/delete_note_sample.py +++ b/samples/api/hire/v1/delete_note_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteNoteRequest = DeleteNoteRequest.builder() \ - .note_id("str") \ - .build() + # 构造请求对象 + request: DeleteNoteRequest = DeleteNoteRequest.builder() \ + .note_id("str") \ + .build() - # 发起请求 - response: DeleteNoteResponse = client.hire.v1.note.delete(request) + # 发起请求 + response: DeleteNoteResponse = client.hire.v1.note.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteNoteRequest = DeleteNoteRequest.builder() \ - .note_id("str") \ - .build() + # 构造请求对象 + request: DeleteNoteRequest = DeleteNoteRequest.builder() \ + .note_id("str") \ + .build() - # 发起请求 - response: DeleteNoteResponse = await client.hire.v1.note.adelete(request) + # 发起请求 + response: DeleteNoteResponse = await client.hire.v1.note.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_tripartite_agreement_sample.py b/samples/api/hire/v1/delete_tripartite_agreement_sample.py index 3ee7fc8cb..c8e544477 100644 --- a/samples/api/hire/v1/delete_tripartite_agreement_sample.py +++ b/samples/api/hire/v1/delete_tripartite_agreement_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTripartiteAgreementRequest = DeleteTripartiteAgreementRequest.builder() \ - .tripartite_agreement_id("str") \ - .build() + # 构造请求对象 + request: DeleteTripartiteAgreementRequest = DeleteTripartiteAgreementRequest.builder() \ + .tripartite_agreement_id("str") \ + .build() - # 发起请求 - response: DeleteTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.delete(request) + # 发起请求 + response: DeleteTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTripartiteAgreementRequest = DeleteTripartiteAgreementRequest.builder() \ - .tripartite_agreement_id("str") \ - .build() + # 构造请求对象 + request: DeleteTripartiteAgreementRequest = DeleteTripartiteAgreementRequest.builder() \ + .tripartite_agreement_id("str") \ + .build() - # 发起请求 - response: DeleteTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.adelete(request) + # 发起请求 + response: DeleteTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/delete_website_channel_sample.py b/samples/api/hire/v1/delete_website_channel_sample.py index d2e832445..25da506f6 100644 --- a/samples/api/hire/v1/delete_website_channel_sample.py +++ b/samples/api/hire/v1/delete_website_channel_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteWebsiteChannelRequest = DeleteWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .channel_id("7085989097067563300") \ - .build() + # 构造请求对象 + request: DeleteWebsiteChannelRequest = DeleteWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .channel_id("7085989097067563300") \ + .build() - # 发起请求 - response: DeleteWebsiteChannelResponse = client.hire.v1.website_channel.delete(request) + # 发起请求 + response: DeleteWebsiteChannelResponse = client.hire.v1.website_channel.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteWebsiteChannelRequest = DeleteWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .channel_id("7085989097067563300") \ - .build() + # 构造请求对象 + request: DeleteWebsiteChannelRequest = DeleteWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .channel_id("7085989097067563300") \ + .build() - # 发起请求 - response: DeleteWebsiteChannelResponse = await client.hire.v1.website_channel.adelete(request) + # 发起请求 + response: DeleteWebsiteChannelResponse = await client.hire.v1.website_channel.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_agency_sample.py b/samples/api/hire/v1/get_agency_sample.py index 3cd13c042..a7cb279fe 100644 --- a/samples/api/hire/v1/get_agency_sample.py +++ b/samples/api/hire/v1/get_agency_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgencyRequest = GetAgencyRequest.builder() \ - .agency_id("6898173495386147079") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetAgencyRequest = GetAgencyRequest.builder() \ + .agency_id("6898173495386147079") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetAgencyResponse = client.hire.v1.agency.get(request) + # 发起请求 + response: GetAgencyResponse = client.hire.v1.agency.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAgencyRequest = GetAgencyRequest.builder() \ - .agency_id("6898173495386147079") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetAgencyRequest = GetAgencyRequest.builder() \ + .agency_id("6898173495386147079") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetAgencyResponse = await client.hire.v1.agency.aget(request) + # 发起请求 + response: GetAgencyResponse = await client.hire.v1.agency.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_application_sample.py b/samples/api/hire/v1/get_application_sample.py index 864f377a1..4122fc843 100644 --- a/samples/api/hire/v1/get_application_sample.py +++ b/samples/api/hire/v1/get_application_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationRequest = GetApplicationRequest.builder() \ - .application_id("6949805467799537964") \ - .user_id_type("user_id") \ - .options([]) \ - .build() + # 构造请求对象 + request: GetApplicationRequest = GetApplicationRequest.builder() \ + .application_id("6949805467799537964") \ + .user_id_type("user_id") \ + .options([]) \ + .build() - # 发起请求 - response: GetApplicationResponse = client.hire.v1.application.get(request) + # 发起请求 + response: GetApplicationResponse = client.hire.v1.application.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetApplicationRequest = GetApplicationRequest.builder() \ - .application_id("6949805467799537964") \ - .user_id_type("user_id") \ - .options([]) \ - .build() + # 构造请求对象 + request: GetApplicationRequest = GetApplicationRequest.builder() \ + .application_id("6949805467799537964") \ + .user_id_type("user_id") \ + .options([]) \ + .build() - # 发起请求 - response: GetApplicationResponse = await client.hire.v1.application.aget(request) + # 发起请求 + response: GetApplicationResponse = await client.hire.v1.application.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_attachment_sample.py b/samples/api/hire/v1/get_attachment_sample.py index 55e0f2a50..46ed64464 100644 --- a/samples/api/hire/v1/get_attachment_sample.py +++ b/samples/api/hire/v1/get_attachment_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .attachment_id("6435242341238") \ - .type(1) \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .attachment_id("6435242341238") \ + .type(1) \ + .build() - # 发起请求 - response: GetAttachmentResponse = client.hire.v1.attachment.get(request) + # 发起请求 + response: GetAttachmentResponse = client.hire.v1.attachment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .attachment_id("6435242341238") \ - .type(1) \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .attachment_id("6435242341238") \ + .type(1) \ + .build() - # 发起请求 - response: GetAttachmentResponse = await client.hire.v1.attachment.aget(request) + # 发起请求 + response: GetAttachmentResponse = await client.hire.v1.attachment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_by_application_employee_sample.py b/samples/api/hire/v1/get_by_application_employee_sample.py index 3ff53b70b..96a96ed9c 100644 --- a/samples/api/hire/v1/get_by_application_employee_sample.py +++ b/samples/api/hire/v1/get_by_application_employee_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByApplicationEmployeeRequest = GetByApplicationEmployeeRequest.builder() \ - .application_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetByApplicationEmployeeRequest = GetByApplicationEmployeeRequest.builder() \ + .application_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetByApplicationEmployeeResponse = client.hire.v1.employee.get_by_application(request) + # 发起请求 + response: GetByApplicationEmployeeResponse = client.hire.v1.employee.get_by_application(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.get_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.get_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByApplicationEmployeeRequest = GetByApplicationEmployeeRequest.builder() \ - .application_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetByApplicationEmployeeRequest = GetByApplicationEmployeeRequest.builder() \ + .application_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetByApplicationEmployeeResponse = await client.hire.v1.employee.aget_by_application(request) + # 发起请求 + response: GetByApplicationEmployeeResponse = await client.hire.v1.employee.aget_by_application(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.aget_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.aget_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_by_application_referral_sample.py b/samples/api/hire/v1/get_by_application_referral_sample.py index c398bb875..b93814bbd 100644 --- a/samples/api/hire/v1/get_by_application_referral_sample.py +++ b/samples/api/hire/v1/get_by_application_referral_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByApplicationReferralRequest = GetByApplicationReferralRequest.builder() \ - .application_id("6134134355464633") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetByApplicationReferralRequest = GetByApplicationReferralRequest.builder() \ + .application_id("6134134355464633") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetByApplicationReferralResponse = client.hire.v1.referral.get_by_application(request) + # 发起请求 + response: GetByApplicationReferralResponse = client.hire.v1.referral.get_by_application(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral.get_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral.get_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByApplicationReferralRequest = GetByApplicationReferralRequest.builder() \ - .application_id("6134134355464633") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetByApplicationReferralRequest = GetByApplicationReferralRequest.builder() \ + .application_id("6134134355464633") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetByApplicationReferralResponse = await client.hire.v1.referral.aget_by_application(request) + # 发起请求 + response: GetByApplicationReferralResponse = await client.hire.v1.referral.aget_by_application(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral.aget_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral.aget_by_application failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_by_talent_interview_sample.py b/samples/api/hire/v1/get_by_talent_interview_sample.py index c1954bad1..644317a14 100644 --- a/samples/api/hire/v1/get_by_talent_interview_sample.py +++ b/samples/api/hire/v1/get_by_talent_interview_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByTalentInterviewRequest = GetByTalentInterviewRequest.builder() \ - .talent_id("6949805467799537964") \ - .user_id_type("open_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetByTalentInterviewRequest = GetByTalentInterviewRequest.builder() \ + .talent_id("6949805467799537964") \ + .user_id_type("open_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetByTalentInterviewResponse = client.hire.v1.interview.get_by_talent(request) + # 发起请求 + response: GetByTalentInterviewResponse = client.hire.v1.interview.get_by_talent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview.get_by_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview.get_by_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetByTalentInterviewRequest = GetByTalentInterviewRequest.builder() \ - .talent_id("6949805467799537964") \ - .user_id_type("open_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetByTalentInterviewRequest = GetByTalentInterviewRequest.builder() \ + .talent_id("6949805467799537964") \ + .user_id_type("open_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetByTalentInterviewResponse = await client.hire.v1.interview.aget_by_talent(request) + # 发起请求 + response: GetByTalentInterviewResponse = await client.hire.v1.interview.aget_by_talent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview.aget_by_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview.aget_by_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_employee_sample.py b/samples/api/hire/v1/get_employee_sample.py index bd837c962..cd43b170a 100644 --- a/samples/api/hire/v1/get_employee_sample.py +++ b/samples/api/hire/v1/get_employee_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEmployeeRequest = GetEmployeeRequest.builder() \ - .employee_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetEmployeeRequest = GetEmployeeRequest.builder() \ + .employee_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetEmployeeResponse = client.hire.v1.employee.get(request) + # 发起请求 + response: GetEmployeeResponse = client.hire.v1.employee.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEmployeeRequest = GetEmployeeRequest.builder() \ - .employee_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetEmployeeRequest = GetEmployeeRequest.builder() \ + .employee_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetEmployeeResponse = await client.hire.v1.employee.aget(request) + # 发起请求 + response: GetEmployeeResponse = await client.hire.v1.employee.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_interview_record_attachment_sample.py b/samples/api/hire/v1/get_interview_record_attachment_sample.py index daf2451d9..96edea210 100644 --- a/samples/api/hire/v1/get_interview_record_attachment_sample.py +++ b/samples/api/hire/v1/get_interview_record_attachment_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInterviewRecordAttachmentRequest = GetInterviewRecordAttachmentRequest.builder() \ - .application_id("6949805467799537964") \ - .interview_record_id("6969137186734393644") \ - .language(1) \ - .build() + # 构造请求对象 + request: GetInterviewRecordAttachmentRequest = GetInterviewRecordAttachmentRequest.builder() \ + .application_id("6949805467799537964") \ + .interview_record_id("6969137186734393644") \ + .language(1) \ + .build() - # 发起请求 - response: GetInterviewRecordAttachmentResponse = client.hire.v1.interview_record_attachment.get(request) + # 发起请求 + response: GetInterviewRecordAttachmentResponse = client.hire.v1.interview_record_attachment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record_attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record_attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInterviewRecordAttachmentRequest = GetInterviewRecordAttachmentRequest.builder() \ - .application_id("6949805467799537964") \ - .interview_record_id("6969137186734393644") \ - .language(1) \ - .build() + # 构造请求对象 + request: GetInterviewRecordAttachmentRequest = GetInterviewRecordAttachmentRequest.builder() \ + .application_id("6949805467799537964") \ + .interview_record_id("6969137186734393644") \ + .language(1) \ + .build() - # 发起请求 - response: GetInterviewRecordAttachmentResponse = await client.hire.v1.interview_record_attachment.aget(request) + # 发起请求 + response: GetInterviewRecordAttachmentResponse = await client.hire.v1.interview_record_attachment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record_attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record_attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_interview_record_sample.py b/samples/api/hire/v1/get_interview_record_sample.py index 0767c70f4..47e3f5d7e 100644 --- a/samples/api/hire/v1/get_interview_record_sample.py +++ b/samples/api/hire/v1/get_interview_record_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInterviewRecordRequest = GetInterviewRecordRequest.builder() \ - .interview_record_id("1618209327096") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetInterviewRecordRequest = GetInterviewRecordRequest.builder() \ + .interview_record_id("1618209327096") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetInterviewRecordResponse = client.hire.v1.interview_record.get(request) + # 发起请求 + response: GetInterviewRecordResponse = client.hire.v1.interview_record.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetInterviewRecordRequest = GetInterviewRecordRequest.builder() \ - .interview_record_id("1618209327096") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetInterviewRecordRequest = GetInterviewRecordRequest.builder() \ + .interview_record_id("1618209327096") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetInterviewRecordResponse = await client.hire.v1.interview_record.aget(request) + # 发起请求 + response: GetInterviewRecordResponse = await client.hire.v1.interview_record.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_job_manager_sample.py b/samples/api/hire/v1/get_job_manager_sample.py index ab317ebfd..2bd14f758 100644 --- a/samples/api/hire/v1/get_job_manager_sample.py +++ b/samples/api/hire/v1/get_job_manager_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobManagerRequest = GetJobManagerRequest.builder() \ - .job_id("1618209327096") \ - .manager_id("1618209327096") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetJobManagerRequest = GetJobManagerRequest.builder() \ + .job_id("1618209327096") \ + .manager_id("1618209327096") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetJobManagerResponse = client.hire.v1.job_manager.get(request) + # 发起请求 + response: GetJobManagerResponse = client.hire.v1.job_manager.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_manager.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_manager.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobManagerRequest = GetJobManagerRequest.builder() \ - .job_id("1618209327096") \ - .manager_id("1618209327096") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetJobManagerRequest = GetJobManagerRequest.builder() \ + .job_id("1618209327096") \ + .manager_id("1618209327096") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetJobManagerResponse = await client.hire.v1.job_manager.aget(request) + # 发起请求 + response: GetJobManagerResponse = await client.hire.v1.job_manager.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_manager.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_manager.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_job_sample.py b/samples/api/hire/v1/get_job_sample.py index 6b53f16ab..0065c9895 100644 --- a/samples/api/hire/v1/get_job_sample.py +++ b/samples/api/hire/v1/get_job_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("6001") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("6001") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .build() - # 发起请求 - response: GetJobResponse = client.hire.v1.job.get(request) + # 发起请求 + response: GetJobResponse = client.hire.v1.job.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetJobRequest = GetJobRequest.builder() \ - .job_id("6001") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .build() + # 构造请求对象 + request: GetJobRequest = GetJobRequest.builder() \ + .job_id("6001") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .build() - # 发起请求 - response: GetJobResponse = await client.hire.v1.job.aget(request) + # 发起请求 + response: GetJobResponse = await client.hire.v1.job.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_note_sample.py b/samples/api/hire/v1/get_note_sample.py index 6e6e87aaf..34c7d680e 100644 --- a/samples/api/hire/v1/get_note_sample.py +++ b/samples/api/hire/v1/get_note_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNoteRequest = GetNoteRequest.builder() \ - .note_id("6949805467799537964") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetNoteRequest = GetNoteRequest.builder() \ + .note_id("6949805467799537964") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetNoteResponse = client.hire.v1.note.get(request) + # 发起请求 + response: GetNoteResponse = client.hire.v1.note.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNoteRequest = GetNoteRequest.builder() \ - .note_id("6949805467799537964") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetNoteRequest = GetNoteRequest.builder() \ + .note_id("6949805467799537964") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetNoteResponse = await client.hire.v1.note.aget(request) + # 发起请求 + response: GetNoteResponse = await client.hire.v1.note.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_offer_application_form_sample.py b/samples/api/hire/v1/get_offer_application_form_sample.py index 13748cd3c..8249a9143 100644 --- a/samples/api/hire/v1/get_offer_application_form_sample.py +++ b/samples/api/hire/v1/get_offer_application_form_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferApplicationFormRequest = GetOfferApplicationFormRequest.builder() \ - .offer_application_form_id("237186812432") \ - .build() + # 构造请求对象 + request: GetOfferApplicationFormRequest = GetOfferApplicationFormRequest.builder() \ + .offer_application_form_id("237186812432") \ + .build() - # 发起请求 - response: GetOfferApplicationFormResponse = client.hire.v1.offer_application_form.get(request) + # 发起请求 + response: GetOfferApplicationFormResponse = client.hire.v1.offer_application_form.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_application_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_application_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferApplicationFormRequest = GetOfferApplicationFormRequest.builder() \ - .offer_application_form_id("237186812432") \ - .build() + # 构造请求对象 + request: GetOfferApplicationFormRequest = GetOfferApplicationFormRequest.builder() \ + .offer_application_form_id("237186812432") \ + .build() - # 发起请求 - response: GetOfferApplicationFormResponse = await client.hire.v1.offer_application_form.aget(request) + # 发起请求 + response: GetOfferApplicationFormResponse = await client.hire.v1.offer_application_form.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_application_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_application_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_offer_sample.py b/samples/api/hire/v1/get_offer_sample.py index d5ae8adce..0383ad9e4 100644 --- a/samples/api/hire/v1/get_offer_sample.py +++ b/samples/api/hire/v1/get_offer_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferRequest = GetOfferRequest.builder() \ - .offer_id("1111111") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetOfferRequest = GetOfferRequest.builder() \ + .offer_id("1111111") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetOfferResponse = client.hire.v1.offer.get(request) + # 发起请求 + response: GetOfferResponse = client.hire.v1.offer.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferRequest = GetOfferRequest.builder() \ - .offer_id("1111111") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: GetOfferRequest = GetOfferRequest.builder() \ + .offer_id("1111111") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: GetOfferResponse = await client.hire.v1.offer.aget(request) + # 发起请求 + response: GetOfferResponse = await client.hire.v1.offer.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_offer_schema_sample.py b/samples/api/hire/v1/get_offer_schema_sample.py index 2bcae735c..7e9c893bd 100644 --- a/samples/api/hire/v1/get_offer_schema_sample.py +++ b/samples/api/hire/v1/get_offer_schema_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferSchemaRequest = GetOfferSchemaRequest.builder() \ - .offer_schema_id("1231231231231") \ - .build() + # 构造请求对象 + request: GetOfferSchemaRequest = GetOfferSchemaRequest.builder() \ + .offer_schema_id("1231231231231") \ + .build() - # 发起请求 - response: GetOfferSchemaResponse = client.hire.v1.offer_schema.get(request) + # 发起请求 + response: GetOfferSchemaResponse = client.hire.v1.offer_schema.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_schema.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_schema.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetOfferSchemaRequest = GetOfferSchemaRequest.builder() \ - .offer_schema_id("1231231231231") \ - .build() + # 构造请求对象 + request: GetOfferSchemaRequest = GetOfferSchemaRequest.builder() \ + .offer_schema_id("1231231231231") \ + .build() - # 发起请求 - response: GetOfferSchemaResponse = await client.hire.v1.offer_schema.aget(request) + # 发起请求 + response: GetOfferSchemaResponse = await client.hire.v1.offer_schema.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_schema.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_schema.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_referral_website_job_post_sample.py b/samples/api/hire/v1/get_referral_website_job_post_sample.py index 1f8403d26..09372600f 100644 --- a/samples/api/hire/v1/get_referral_website_job_post_sample.py +++ b/samples/api/hire/v1/get_referral_website_job_post_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReferralWebsiteJobPostRequest = GetReferralWebsiteJobPostRequest.builder() \ - .job_post_id("6701528341100366094") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetReferralWebsiteJobPostRequest = GetReferralWebsiteJobPostRequest.builder() \ + .job_post_id("6701528341100366094") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetReferralWebsiteJobPostResponse = client.hire.v1.referral_website_job_post.get(request) + # 发起请求 + response: GetReferralWebsiteJobPostResponse = client.hire.v1.referral_website_job_post.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_website_job_post.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_website_job_post.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReferralWebsiteJobPostRequest = GetReferralWebsiteJobPostRequest.builder() \ - .job_post_id("6701528341100366094") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetReferralWebsiteJobPostRequest = GetReferralWebsiteJobPostRequest.builder() \ + .job_post_id("6701528341100366094") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetReferralWebsiteJobPostResponse = await client.hire.v1.referral_website_job_post.aget(request) + # 发起请求 + response: GetReferralWebsiteJobPostResponse = await client.hire.v1.referral_website_job_post.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_website_job_post.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_website_job_post.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_role_sample.py b/samples/api/hire/v1/get_role_sample.py index e73520235..bf31aca62 100644 --- a/samples/api/hire/v1/get_role_sample.py +++ b/samples/api/hire/v1/get_role_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoleRequest = GetRoleRequest.builder() \ - .role_id("str") \ - .build() + # 构造请求对象 + request: GetRoleRequest = GetRoleRequest.builder() \ + .role_id("str") \ + .build() - # 发起请求 - response: GetRoleResponse = client.hire.v1.role.get(request) + # 发起请求 + response: GetRoleResponse = client.hire.v1.role.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.role.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.role.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoleRequest = GetRoleRequest.builder() \ - .role_id("str") \ - .build() + # 构造请求对象 + request: GetRoleRequest = GetRoleRequest.builder() \ + .role_id("str") \ + .build() - # 发起请求 - response: GetRoleResponse = await client.hire.v1.role.aget(request) + # 发起请求 + response: GetRoleResponse = await client.hire.v1.role.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.role.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.role.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_talent_sample.py b/samples/api/hire/v1/get_talent_sample.py index 325ccb824..81a3412a9 100644 --- a/samples/api/hire/v1/get_talent_sample.py +++ b/samples/api/hire/v1/get_talent_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTalentRequest = GetTalentRequest.builder() \ - .talent_id("6891560630172518670") \ - .user_id_type("people_admin_id") \ - .build() + # 构造请求对象 + request: GetTalentRequest = GetTalentRequest.builder() \ + .talent_id("6891560630172518670") \ + .user_id_type("people_admin_id") \ + .build() - # 发起请求 - response: GetTalentResponse = client.hire.v1.talent.get(request) + # 发起请求 + response: GetTalentResponse = client.hire.v1.talent.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTalentRequest = GetTalentRequest.builder() \ - .talent_id("6891560630172518670") \ - .user_id_type("people_admin_id") \ - .build() + # 构造请求对象 + request: GetTalentRequest = GetTalentRequest.builder() \ + .talent_id("6891560630172518670") \ + .user_id_type("people_admin_id") \ + .build() - # 发起请求 - response: GetTalentResponse = await client.hire.v1.talent.aget(request) + # 发起请求 + response: GetTalentResponse = await client.hire.v1.talent.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_website_delivery_task_sample.py b/samples/api/hire/v1/get_website_delivery_task_sample.py index 71c6a53a4..4bc8b4086 100644 --- a/samples/api/hire/v1/get_website_delivery_task_sample.py +++ b/samples/api/hire/v1/get_website_delivery_task_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWebsiteDeliveryTaskRequest = GetWebsiteDeliveryTaskRequest.builder() \ - .website_id("7047318856652261676") \ - .delivery_task_id("f1c2a0f138ec492d99d7ab73594158ad") \ - .build() + # 构造请求对象 + request: GetWebsiteDeliveryTaskRequest = GetWebsiteDeliveryTaskRequest.builder() \ + .website_id("7047318856652261676") \ + .delivery_task_id("f1c2a0f138ec492d99d7ab73594158ad") \ + .build() - # 发起请求 - response: GetWebsiteDeliveryTaskResponse = client.hire.v1.website_delivery_task.get(request) + # 发起请求 + response: GetWebsiteDeliveryTaskResponse = client.hire.v1.website_delivery_task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery_task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWebsiteDeliveryTaskRequest = GetWebsiteDeliveryTaskRequest.builder() \ - .website_id("7047318856652261676") \ - .delivery_task_id("f1c2a0f138ec492d99d7ab73594158ad") \ - .build() + # 构造请求对象 + request: GetWebsiteDeliveryTaskRequest = GetWebsiteDeliveryTaskRequest.builder() \ + .website_id("7047318856652261676") \ + .delivery_task_id("f1c2a0f138ec492d99d7ab73594158ad") \ + .build() - # 发起请求 - response: GetWebsiteDeliveryTaskResponse = await client.hire.v1.website_delivery_task.aget(request) + # 发起请求 + response: GetWebsiteDeliveryTaskResponse = await client.hire.v1.website_delivery_task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_delivery_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_delivery_task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/get_website_job_post_sample.py b/samples/api/hire/v1/get_website_job_post_sample.py index bd9189687..a519629de 100644 --- a/samples/api/hire/v1/get_website_job_post_sample.py +++ b/samples/api/hire/v1/get_website_job_post_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWebsiteJobPostRequest = GetWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .job_post_id("111") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetWebsiteJobPostRequest = GetWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .job_post_id("111") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetWebsiteJobPostResponse = client.hire.v1.website_job_post.get(request) + # 发起请求 + response: GetWebsiteJobPostResponse = client.hire.v1.website_job_post.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetWebsiteJobPostRequest = GetWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .job_post_id("111") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: GetWebsiteJobPostRequest = GetWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .job_post_id("111") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: GetWebsiteJobPostResponse = await client.hire.v1.website_job_post.aget(request) + # 发起请求 + response: GetWebsiteJobPostResponse = await client.hire.v1.website_job_post.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/intern_offer_status_offer_sample.py b/samples/api/hire/v1/intern_offer_status_offer_sample.py index 3b08e1588..d0df1945d 100644 --- a/samples/api/hire/v1/intern_offer_status_offer_sample.py +++ b/samples/api/hire/v1/intern_offer_status_offer_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternOfferStatusOfferRequest = InternOfferStatusOfferRequest.builder() \ - .offer_id("7016605170635213100") \ - .request_body(InternOfferStatus.builder() - .operation("confirm_onboarding") - .onboarding_info(InternOfferOnboardingInfo.builder().build()) - .offboarding_info(InternOfferOffboardingInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: InternOfferStatusOfferRequest = InternOfferStatusOfferRequest.builder() \ + .offer_id("7016605170635213100") \ + .request_body(InternOfferStatus.builder() + .operation("confirm_onboarding") + .onboarding_info(InternOfferOnboardingInfo.builder().build()) + .offboarding_info(InternOfferOffboardingInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: InternOfferStatusOfferResponse = client.hire.v1.offer.intern_offer_status(request) + # 发起请求 + response: InternOfferStatusOfferResponse = client.hire.v1.offer.intern_offer_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.intern_offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.intern_offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InternOfferStatusOfferRequest = InternOfferStatusOfferRequest.builder() \ - .offer_id("7016605170635213100") \ - .request_body(InternOfferStatus.builder() - .operation("confirm_onboarding") - .onboarding_info(InternOfferOnboardingInfo.builder().build()) - .offboarding_info(InternOfferOffboardingInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: InternOfferStatusOfferRequest = InternOfferStatusOfferRequest.builder() \ + .offer_id("7016605170635213100") \ + .request_body(InternOfferStatus.builder() + .operation("confirm_onboarding") + .onboarding_info(InternOfferOnboardingInfo.builder().build()) + .offboarding_info(InternOfferOffboardingInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: InternOfferStatusOfferResponse = await client.hire.v1.offer.aintern_offer_status(request) + # 发起请求 + response: InternOfferStatusOfferResponse = await client.hire.v1.offer.aintern_offer_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.aintern_offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.aintern_offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_application_interview_sample.py b/samples/api/hire/v1/list_application_interview_sample.py index 058f93198..190635668 100644 --- a/samples/api/hire/v1/list_application_interview_sample.py +++ b/samples/api/hire/v1/list_application_interview_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationInterviewRequest = ListApplicationInterviewRequest.builder() \ - .application_id("6960663240925956555") \ - .page_size(10) \ - .page_token("xx") \ - .user_id_type("open_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: ListApplicationInterviewRequest = ListApplicationInterviewRequest.builder() \ + .application_id("6960663240925956555") \ + .page_size(10) \ + .page_token("xx") \ + .user_id_type("open_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: ListApplicationInterviewResponse = client.hire.v1.application_interview.list(request) + # 发起请求 + response: ListApplicationInterviewResponse = client.hire.v1.application_interview.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application_interview.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application_interview.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationInterviewRequest = ListApplicationInterviewRequest.builder() \ - .application_id("6960663240925956555") \ - .page_size(10) \ - .page_token("xx") \ - .user_id_type("open_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: ListApplicationInterviewRequest = ListApplicationInterviewRequest.builder() \ + .application_id("6960663240925956555") \ + .page_size(10) \ + .page_token("xx") \ + .user_id_type("open_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: ListApplicationInterviewResponse = await client.hire.v1.application_interview.alist(request) + # 发起请求 + response: ListApplicationInterviewResponse = await client.hire.v1.application_interview.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application_interview.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application_interview.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_application_sample.py b/samples/api/hire/v1/list_application_sample.py index 9d2411173..b302142cf 100644 --- a/samples/api/hire/v1/list_application_sample.py +++ b/samples/api/hire/v1/list_application_sample.py @@ -5,74 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationRequest = ListApplicationRequest.builder() \ - .process_id("6960663240925956554") \ - .stage_id("614218419274131") \ - .talent_id("6891560630172518670") \ - .active_status("1") \ - .job_id("7334134355464633") \ - .page_token("1") \ - .page_size(10) \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .build() + # 构造请求对象 + request: ListApplicationRequest = ListApplicationRequest.builder() \ + .process_id("6960663240925956554") \ + .stage_id("614218419274131") \ + .talent_id("6891560630172518670") \ + .active_status("1") \ + .job_id("7334134355464633") \ + .lock_status([]) \ + .page_token("1") \ + .page_size(10) \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .build() - # 发起请求 - response: ListApplicationResponse = client.hire.v1.application.list(request) + # 发起请求 + response: ListApplicationResponse = client.hire.v1.application.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListApplicationRequest = ListApplicationRequest.builder() \ - .process_id("6960663240925956554") \ - .stage_id("614218419274131") \ - .talent_id("6891560630172518670") \ - .active_status("1") \ - .job_id("7334134355464633") \ - .page_token("1") \ - .page_size(10) \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .build() + # 构造请求对象 + request: ListApplicationRequest = ListApplicationRequest.builder() \ + .process_id("6960663240925956554") \ + .stage_id("614218419274131") \ + .talent_id("6891560630172518670") \ + .active_status("1") \ + .job_id("7334134355464633") \ + .lock_status([]) \ + .page_token("1") \ + .page_size(10) \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .build() - # 发起请求 - response: ListApplicationResponse = await client.hire.v1.application.alist(request) + # 发起请求 + response: ListApplicationResponse = await client.hire.v1.application.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_background_check_order_sample.py b/samples/api/hire/v1/list_background_check_order_sample.py index b5a2ede3f..d03a1da2c 100644 --- a/samples/api/hire/v1/list_background_check_order_sample.py +++ b/samples/api/hire/v1/list_background_check_order_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBackgroundCheckOrderRequest = ListBackgroundCheckOrderRequest.builder() \ - .user_id_type("open_id") \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .application_id("6985833807195212076") \ - .update_start_time("1638848468868") \ - .update_end_time("1638848468869") \ - .build() + # 构造请求对象 + request: ListBackgroundCheckOrderRequest = ListBackgroundCheckOrderRequest.builder() \ + .user_id_type("open_id") \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .application_id("6985833807195212076") \ + .update_start_time("1638848468868") \ + .update_end_time("1638848468869") \ + .build() - # 发起请求 - response: ListBackgroundCheckOrderResponse = client.hire.v1.background_check_order.list(request) + # 发起请求 + response: ListBackgroundCheckOrderResponse = client.hire.v1.background_check_order.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.background_check_order.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.background_check_order.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListBackgroundCheckOrderRequest = ListBackgroundCheckOrderRequest.builder() \ - .user_id_type("open_id") \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .application_id("6985833807195212076") \ - .update_start_time("1638848468868") \ - .update_end_time("1638848468869") \ - .build() + # 构造请求对象 + request: ListBackgroundCheckOrderRequest = ListBackgroundCheckOrderRequest.builder() \ + .user_id_type("open_id") \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .application_id("6985833807195212076") \ + .update_start_time("1638848468868") \ + .update_end_time("1638848468869") \ + .build() - # 发起请求 - response: ListBackgroundCheckOrderResponse = await client.hire.v1.background_check_order.alist(request) + # 发起请求 + response: ListBackgroundCheckOrderResponse = await client.hire.v1.background_check_order.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.background_check_order.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.background_check_order.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_by_id_job_requirement_sample.py b/samples/api/hire/v1/list_by_id_job_requirement_sample.py index 4e11418bc..5b7949e23 100644 --- a/samples/api/hire/v1/list_by_id_job_requirement_sample.py +++ b/samples/api/hire/v1/list_by_id_job_requirement_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListByIdJobRequirementRequest = ListByIdJobRequirementRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(ListByIdJobRequirementRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: ListByIdJobRequirementRequest = ListByIdJobRequirementRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(ListByIdJobRequirementRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: ListByIdJobRequirementResponse = client.hire.v1.job_requirement.list_by_id(request) + # 发起请求 + response: ListByIdJobRequirementResponse = client.hire.v1.job_requirement.list_by_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.list_by_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.list_by_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListByIdJobRequirementRequest = ListByIdJobRequirementRequest.builder() \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(ListByIdJobRequirementRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: ListByIdJobRequirementRequest = ListByIdJobRequirementRequest.builder() \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(ListByIdJobRequirementRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: ListByIdJobRequirementResponse = await client.hire.v1.job_requirement.alist_by_id(request) + # 发起请求 + response: ListByIdJobRequirementResponse = await client.hire.v1.job_requirement.alist_by_id(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.alist_by_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.alist_by_id failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_evaluation_sample.py b/samples/api/hire/v1/list_evaluation_sample.py index 1f2029b43..028ae2402 100644 --- a/samples/api/hire/v1/list_evaluation_sample.py +++ b/samples/api/hire/v1/list_evaluation_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEvaluationRequest = ListEvaluationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .application_id("6875569957036738823") \ - .update_start_time("1600843767338") \ - .update_end_time("1600843938726") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListEvaluationRequest = ListEvaluationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .application_id("6875569957036738823") \ + .update_start_time("1600843767338") \ + .update_end_time("1600843938726") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListEvaluationResponse = client.hire.v1.evaluation.list(request) + # 发起请求 + response: ListEvaluationResponse = client.hire.v1.evaluation.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.evaluation.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.evaluation.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEvaluationRequest = ListEvaluationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .application_id("6875569957036738823") \ - .update_start_time("1600843767338") \ - .update_end_time("1600843938726") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListEvaluationRequest = ListEvaluationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .application_id("6875569957036738823") \ + .update_start_time("1600843767338") \ + .update_end_time("1600843938726") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListEvaluationResponse = await client.hire.v1.evaluation.alist(request) + # 发起请求 + response: ListEvaluationResponse = await client.hire.v1.evaluation.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.evaluation.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.evaluation.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_evaluation_task_sample.py b/samples/api/hire/v1/list_evaluation_task_sample.py index c45f2183e..381443131 100644 --- a/samples/api/hire/v1/list_evaluation_task_sample.py +++ b/samples/api/hire/v1/list_evaluation_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEvaluationTaskRequest = ListEvaluationTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEvaluationTaskRequest = ListEvaluationTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEvaluationTaskResponse = client.hire.v1.evaluation_task.list(request) + # 发起请求 + response: ListEvaluationTaskResponse = client.hire.v1.evaluation_task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.evaluation_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.evaluation_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEvaluationTaskRequest = ListEvaluationTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEvaluationTaskRequest = ListEvaluationTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEvaluationTaskResponse = await client.hire.v1.evaluation_task.alist(request) + # 发起请求 + response: ListEvaluationTaskResponse = await client.hire.v1.evaluation_task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.evaluation_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.evaluation_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_exam_marking_task_sample.py b/samples/api/hire/v1/list_exam_marking_task_sample.py index 6e0124cf7..9eca2c0f5 100644 --- a/samples/api/hire/v1/list_exam_marking_task_sample.py +++ b/samples/api/hire/v1/list_exam_marking_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExamMarkingTaskRequest = ListExamMarkingTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListExamMarkingTaskRequest = ListExamMarkingTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListExamMarkingTaskResponse = client.hire.v1.exam_marking_task.list(request) + # 发起请求 + response: ListExamMarkingTaskResponse = client.hire.v1.exam_marking_task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.exam_marking_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.exam_marking_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExamMarkingTaskRequest = ListExamMarkingTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListExamMarkingTaskRequest = ListExamMarkingTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListExamMarkingTaskResponse = await client.hire.v1.exam_marking_task.alist(request) + # 发起请求 + response: ListExamMarkingTaskResponse = await client.hire.v1.exam_marking_task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.exam_marking_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.exam_marking_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_external_application_sample.py b/samples/api/hire/v1/list_external_application_sample.py index 0c8efbd88..36f74e92d 100644 --- a/samples/api/hire/v1/list_external_application_sample.py +++ b/samples/api/hire/v1/list_external_application_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExternalApplicationRequest = ListExternalApplicationRequest.builder() \ - .talent_id("6960663240925956660") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .build() + # 构造请求对象 + request: ListExternalApplicationRequest = ListExternalApplicationRequest.builder() \ + .talent_id("6960663240925956660") \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .build() - # 发起请求 - response: ListExternalApplicationResponse = client.hire.v1.external_application.list(request) + # 发起请求 + response: ListExternalApplicationResponse = client.hire.v1.external_application.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListExternalApplicationRequest = ListExternalApplicationRequest.builder() \ - .talent_id("6960663240925956660") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .build() + # 构造请求对象 + request: ListExternalApplicationRequest = ListExternalApplicationRequest.builder() \ + .talent_id("6960663240925956660") \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .build() - # 发起请求 - response: ListExternalApplicationResponse = await client.hire.v1.external_application.alist(request) + # 发起请求 + response: ListExternalApplicationResponse = await client.hire.v1.external_application.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_feedback_form_sample.py b/samples/api/hire/v1/list_interview_feedback_form_sample.py index 71b0117b5..650e60e09 100644 --- a/samples/api/hire/v1/list_interview_feedback_form_sample.py +++ b/samples/api/hire/v1/list_interview_feedback_form_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewFeedbackFormRequest = ListInterviewFeedbackFormRequest.builder() \ - .interview_feedback_form_ids([]) \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListInterviewFeedbackFormRequest = ListInterviewFeedbackFormRequest.builder() \ + .interview_feedback_form_ids([]) \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListInterviewFeedbackFormResponse = client.hire.v1.interview_feedback_form.list(request) + # 发起请求 + response: ListInterviewFeedbackFormResponse = client.hire.v1.interview_feedback_form.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_feedback_form.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_feedback_form.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewFeedbackFormRequest = ListInterviewFeedbackFormRequest.builder() \ - .interview_feedback_form_ids([]) \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListInterviewFeedbackFormRequest = ListInterviewFeedbackFormRequest.builder() \ + .interview_feedback_form_ids([]) \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListInterviewFeedbackFormResponse = await client.hire.v1.interview_feedback_form.alist(request) + # 发起请求 + response: ListInterviewFeedbackFormResponse = await client.hire.v1.interview_feedback_form.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_feedback_form.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_feedback_form.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_record_sample.py b/samples/api/hire/v1/list_interview_record_sample.py index 31024448e..9629cccb2 100644 --- a/samples/api/hire/v1/list_interview_record_sample.py +++ b/samples/api/hire/v1/list_interview_record_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRecordRequest = ListInterviewRecordRequest.builder() \ - .page_size(10) \ - .page_token("str") \ - .ids([]) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewRecordRequest = ListInterviewRecordRequest.builder() \ + .page_size(10) \ + .page_token("str") \ + .ids([]) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewRecordResponse = client.hire.v1.interview_record.list(request) + # 发起请求 + response: ListInterviewRecordResponse = client.hire.v1.interview_record.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRecordRequest = ListInterviewRecordRequest.builder() \ - .page_size(10) \ - .page_token("str") \ - .ids([]) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewRecordRequest = ListInterviewRecordRequest.builder() \ + .page_size(10) \ + .page_token("str") \ + .ids([]) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewRecordResponse = await client.hire.v1.interview_record.alist(request) + # 发起请求 + response: ListInterviewRecordResponse = await client.hire.v1.interview_record.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_record.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_registration_schema_sample.py b/samples/api/hire/v1/list_interview_registration_schema_sample.py index 56cb02d22..702ab9bc0 100644 --- a/samples/api/hire/v1/list_interview_registration_schema_sample.py +++ b/samples/api/hire/v1/list_interview_registration_schema_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRegistrationSchemaRequest = ListInterviewRegistrationSchemaRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListInterviewRegistrationSchemaRequest = ListInterviewRegistrationSchemaRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListInterviewRegistrationSchemaResponse = client.hire.v1.interview_registration_schema.list(request) + # 发起请求 + response: ListInterviewRegistrationSchemaResponse = client.hire.v1.interview_registration_schema.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_registration_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_registration_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRegistrationSchemaRequest = ListInterviewRegistrationSchemaRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListInterviewRegistrationSchemaRequest = ListInterviewRegistrationSchemaRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListInterviewRegistrationSchemaResponse = await client.hire.v1.interview_registration_schema.alist( - request) + # 发起请求 + response: ListInterviewRegistrationSchemaResponse = await client.hire.v1.interview_registration_schema.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_registration_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_registration_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_round_type_sample.py b/samples/api/hire/v1/list_interview_round_type_sample.py index 440f3fb74..0f449d626 100644 --- a/samples/api/hire/v1/list_interview_round_type_sample.py +++ b/samples/api/hire/v1/list_interview_round_type_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRoundTypeRequest = ListInterviewRoundTypeRequest.builder() \ - .process_type(1) \ - .build() + # 构造请求对象 + request: ListInterviewRoundTypeRequest = ListInterviewRoundTypeRequest.builder() \ + .process_type(1) \ + .build() - # 发起请求 - response: ListInterviewRoundTypeResponse = client.hire.v1.interview_round_type.list(request) + # 发起请求 + response: ListInterviewRoundTypeResponse = client.hire.v1.interview_round_type.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_round_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_round_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRoundTypeRequest = ListInterviewRoundTypeRequest.builder() \ - .process_type(1) \ - .build() + # 构造请求对象 + request: ListInterviewRoundTypeRequest = ListInterviewRoundTypeRequest.builder() \ + .process_type(1) \ + .build() - # 发起请求 - response: ListInterviewRoundTypeResponse = await client.hire.v1.interview_round_type.alist(request) + # 发起请求 + response: ListInterviewRoundTypeResponse = await client.hire.v1.interview_round_type.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_round_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_round_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_sample.py b/samples/api/hire/v1/list_interview_sample.py index c561bfe5f..45f748626 100644 --- a/samples/api/hire/v1/list_interview_sample.py +++ b/samples/api/hire/v1/list_interview_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRequest = ListInterviewRequest.builder() \ - .page_size(10) \ - .page_token("xx") \ - .application_id("6134134355464633") \ - .interview_id("6888217964693309704") \ - .start_time("1609489908000") \ - .end_time("1610489908000") \ - .job_level_id_type("people_admin_job_level_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewRequest = ListInterviewRequest.builder() \ + .page_size(10) \ + .page_token("xx") \ + .application_id("6134134355464633") \ + .interview_id("6888217964693309704") \ + .start_time("1609489908000") \ + .end_time("1610489908000") \ + .job_level_id_type("people_admin_job_level_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewResponse = client.hire.v1.interview.list(request) + # 发起请求 + response: ListInterviewResponse = client.hire.v1.interview.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewRequest = ListInterviewRequest.builder() \ - .page_size(10) \ - .page_token("xx") \ - .application_id("6134134355464633") \ - .interview_id("6888217964693309704") \ - .start_time("1609489908000") \ - .end_time("1610489908000") \ - .job_level_id_type("people_admin_job_level_id") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewRequest = ListInterviewRequest.builder() \ + .page_size(10) \ + .page_token("xx") \ + .application_id("6134134355464633") \ + .interview_id("6888217964693309704") \ + .start_time("1609489908000") \ + .end_time("1610489908000") \ + .job_level_id_type("people_admin_job_level_id") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewResponse = await client.hire.v1.interview.alist(request) + # 发起请求 + response: ListInterviewResponse = await client.hire.v1.interview.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_interview_task_sample.py b/samples/api/hire/v1/list_interview_task_sample.py index da94d559b..720f98e9d 100644 --- a/samples/api/hire/v1/list_interview_task_sample.py +++ b/samples/api/hire/v1/list_interview_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewTaskRequest = ListInterviewTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewTaskRequest = ListInterviewTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewTaskResponse = client.hire.v1.interview_task.list(request) + # 发起请求 + response: ListInterviewTaskResponse = client.hire.v1.interview_task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListInterviewTaskRequest = ListInterviewTaskRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id("ou_e6139117c300506837def50545420c6a") \ - .activity_status(1) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListInterviewTaskRequest = ListInterviewTaskRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id("ou_e6139117c300506837def50545420c6a") \ + .activity_status(1) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListInterviewTaskResponse = await client.hire.v1.interview_task.alist(request) + # 发起请求 + response: ListInterviewTaskResponse = await client.hire.v1.interview_task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.interview_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interview_task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_function_sample.py b/samples/api/hire/v1/list_job_function_sample.py index 869c4277f..4fb67d977 100644 --- a/samples/api/hire/v1/list_job_function_sample.py +++ b/samples/api/hire/v1/list_job_function_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFunctionRequest = ListJobFunctionRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .build() + # 构造请求对象 + request: ListJobFunctionRequest = ListJobFunctionRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .build() - # 发起请求 - response: ListJobFunctionResponse = client.hire.v1.job_function.list(request) + # 发起请求 + response: ListJobFunctionResponse = client.hire.v1.job_function.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_function.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_function.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobFunctionRequest = ListJobFunctionRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .build() + # 构造请求对象 + request: ListJobFunctionRequest = ListJobFunctionRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .build() - # 发起请求 - response: ListJobFunctionResponse = await client.hire.v1.job_function.alist(request) + # 发起请求 + response: ListJobFunctionResponse = await client.hire.v1.job_function.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_function.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_function.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_process_sample.py b/samples/api/hire/v1/list_job_process_sample.py index 4645d8442..2eb28db9f 100644 --- a/samples/api/hire/v1/list_job_process_sample.py +++ b/samples/api/hire/v1/list_job_process_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobProcessRequest = ListJobProcessRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .build() + # 构造请求对象 + request: ListJobProcessRequest = ListJobProcessRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .build() - # 发起请求 - response: ListJobProcessResponse = client.hire.v1.job_process.list(request) + # 发起请求 + response: ListJobProcessResponse = client.hire.v1.job_process.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_process.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_process.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobProcessRequest = ListJobProcessRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .build() + # 构造请求对象 + request: ListJobProcessRequest = ListJobProcessRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .build() - # 发起请求 - response: ListJobProcessResponse = await client.hire.v1.job_process.alist(request) + # 发起请求 + response: ListJobProcessResponse = await client.hire.v1.job_process.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_process.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_process.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_requirement_sample.py b/samples/api/hire/v1/list_job_requirement_sample.py index 7f3adfaaf..204102cd6 100644 --- a/samples/api/hire/v1/list_job_requirement_sample.py +++ b/samples/api/hire/v1/list_job_requirement_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequirementRequest = ListJobRequirementRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .job_id("6001") \ - .create_time_begin("1658980233000") \ - .create_time_end("1658980233000") \ - .update_time_begin("1658980233000") \ - .update_time_end("1658980233000") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: ListJobRequirementRequest = ListJobRequirementRequest.builder() \ + .page_token("1231231987") \ + .page_size(1) \ + .job_id("6001") \ + .create_time_begin("1658980233000") \ + .create_time_end("1658980233000") \ + .update_time_begin("1658980233000") \ + .update_time_end("1658980233000") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: ListJobRequirementResponse = client.hire.v1.job_requirement.list(request) + # 发起请求 + response: ListJobRequirementResponse = client.hire.v1.job_requirement.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequirementRequest = ListJobRequirementRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .job_id("6001") \ - .create_time_begin("1658980233000") \ - .create_time_end("1658980233000") \ - .update_time_begin("1658980233000") \ - .update_time_end("1658980233000") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: ListJobRequirementRequest = ListJobRequirementRequest.builder() \ + .page_token("1231231987") \ + .page_size(1) \ + .job_id("6001") \ + .create_time_begin("1658980233000") \ + .create_time_end("1658980233000") \ + .update_time_begin("1658980233000") \ + .update_time_end("1658980233000") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: ListJobRequirementResponse = await client.hire.v1.job_requirement.alist(request) + # 发起请求 + response: ListJobRequirementResponse = await client.hire.v1.job_requirement.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_requirement_schema_sample.py b/samples/api/hire/v1/list_job_requirement_schema_sample.py index 88ea8505a..4999c5e63 100644 --- a/samples/api/hire/v1/list_job_requirement_schema_sample.py +++ b/samples/api/hire/v1/list_job_requirement_schema_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequirementSchemaRequest = ListJobRequirementSchemaRequest.builder() \ - .page_token("1231231987") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListJobRequirementSchemaRequest = ListJobRequirementSchemaRequest.builder() \ + .page_token("1231231987") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListJobRequirementSchemaResponse = client.hire.v1.job_requirement_schema.list(request) + # 发起请求 + response: ListJobRequirementSchemaResponse = client.hire.v1.job_requirement_schema.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequirementSchemaRequest = ListJobRequirementSchemaRequest.builder() \ - .page_token("1231231987") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListJobRequirementSchemaRequest = ListJobRequirementSchemaRequest.builder() \ + .page_token("1231231987") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListJobRequirementSchemaResponse = await client.hire.v1.job_requirement_schema.alist(request) + # 发起请求 + response: ListJobRequirementSchemaResponse = await client.hire.v1.job_requirement_schema.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_sample.py b/samples/api/hire/v1/list_job_sample.py index 0a80da882..de411b444 100644 --- a/samples/api/hire/v1/list_job_sample.py +++ b/samples/api/hire/v1/list_job_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .build() - # 发起请求 - response: ListJobResponse = client.hire.v1.job.list(request) + # 发起请求 + response: ListJobResponse = client.hire.v1.job.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobRequest = ListJobRequest.builder() \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .build() + # 构造请求对象 + request: ListJobRequest = ListJobRequest.builder() \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .build() - # 发起请求 - response: ListJobResponse = await client.hire.v1.job.alist(request) + # 发起请求 + response: ListJobResponse = await client.hire.v1.job.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_schema_sample.py b/samples/api/hire/v1/list_job_schema_sample.py index 49af88d1e..3ae0349dc 100644 --- a/samples/api/hire/v1/list_job_schema_sample.py +++ b/samples/api/hire/v1/list_job_schema_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobSchemaRequest = ListJobSchemaRequest.builder() \ - .page_token("1231231987") \ - .page_size(100) \ - .scenario(1) \ - .build() + # 构造请求对象 + request: ListJobSchemaRequest = ListJobSchemaRequest.builder() \ + .page_token("1231231987") \ + .page_size(100) \ + .scenario(1) \ + .build() - # 发起请求 - response: ListJobSchemaResponse = client.hire.v1.job_schema.list(request) + # 发起请求 + response: ListJobSchemaResponse = client.hire.v1.job_schema.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobSchemaRequest = ListJobSchemaRequest.builder() \ - .page_token("1231231987") \ - .page_size(100) \ - .scenario(1) \ - .build() + # 构造请求对象 + request: ListJobSchemaRequest = ListJobSchemaRequest.builder() \ + .page_token("1231231987") \ + .page_size(100) \ + .scenario(1) \ + .build() - # 发起请求 - response: ListJobSchemaResponse = await client.hire.v1.job_schema.alist(request) + # 发起请求 + response: ListJobSchemaResponse = await client.hire.v1.job_schema.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_job_type_sample.py b/samples/api/hire/v1/list_job_type_sample.py index c41e73211..693a77c3e 100644 --- a/samples/api/hire/v1/list_job_type_sample.py +++ b/samples/api/hire/v1/list_job_type_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobTypeRequest = ListJobTypeRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListJobTypeRequest = ListJobTypeRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListJobTypeResponse = client.hire.v1.job_type.list(request) + # 发起请求 + response: ListJobTypeResponse = client.hire.v1.job_type.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_type.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListJobTypeRequest = ListJobTypeRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: ListJobTypeRequest = ListJobTypeRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .build() - # 发起请求 - response: ListJobTypeResponse = await client.hire.v1.job_type.alist(request) + # 发起请求 + response: ListJobTypeResponse = await client.hire.v1.job_type.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_type.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_location_sample.py b/samples/api/hire/v1/list_location_sample.py index 6f0004e0c..9387b13b6 100644 --- a/samples/api/hire/v1/list_location_sample.py +++ b/samples/api/hire/v1/list_location_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListLocationRequest = ListLocationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .usage("interview_location") \ - .build() + # 构造请求对象 + request: ListLocationRequest = ListLocationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .usage("interview_location") \ + .build() - # 发起请求 - response: ListLocationResponse = client.hire.v1.location.list(request) + # 发起请求 + response: ListLocationResponse = client.hire.v1.location.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.location.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.location.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListLocationRequest = ListLocationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .usage("interview_location") \ - .build() + # 构造请求对象 + request: ListLocationRequest = ListLocationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .usage("interview_location") \ + .build() - # 发起请求 - response: ListLocationResponse = await client.hire.v1.location.alist(request) + # 发起请求 + response: ListLocationResponse = await client.hire.v1.location.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.location.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.location.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_note_sample.py b/samples/api/hire/v1/list_note_sample.py index 3697c5618..0c188ca74 100644 --- a/samples/api/hire/v1/list_note_sample.py +++ b/samples/api/hire/v1/list_note_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListNoteRequest = ListNoteRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .talent_id("6916472453069883661") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListNoteRequest = ListNoteRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .talent_id("6916472453069883661") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListNoteResponse = client.hire.v1.note.list(request) + # 发起请求 + response: ListNoteResponse = client.hire.v1.note.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListNoteRequest = ListNoteRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .talent_id("6916472453069883661") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListNoteRequest = ListNoteRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .talent_id("6916472453069883661") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListNoteResponse = await client.hire.v1.note.alist(request) + # 发起请求 + response: ListNoteResponse = await client.hire.v1.note.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_offer_application_form_sample.py b/samples/api/hire/v1/list_offer_application_form_sample.py index c3bd8a545..334846736 100644 --- a/samples/api/hire/v1/list_offer_application_form_sample.py +++ b/samples/api/hire/v1/list_offer_application_form_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOfferApplicationFormRequest = ListOfferApplicationFormRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .build() + # 构造请求对象 + request: ListOfferApplicationFormRequest = ListOfferApplicationFormRequest.builder() \ + .page_token("1231231987") \ + .page_size(1) \ + .build() - # 发起请求 - response: ListOfferApplicationFormResponse = client.hire.v1.offer_application_form.list(request) + # 发起请求 + response: ListOfferApplicationFormResponse = client.hire.v1.offer_application_form.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_application_form.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_application_form.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOfferApplicationFormRequest = ListOfferApplicationFormRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .build() + # 构造请求对象 + request: ListOfferApplicationFormRequest = ListOfferApplicationFormRequest.builder() \ + .page_token("1231231987") \ + .page_size(1) \ + .build() - # 发起请求 - response: ListOfferApplicationFormResponse = await client.hire.v1.offer_application_form.alist(request) + # 发起请求 + response: ListOfferApplicationFormResponse = await client.hire.v1.offer_application_form.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_application_form.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_application_form.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_offer_sample.py b/samples/api/hire/v1/list_offer_sample.py index c29d12d98..e90d4505d 100644 --- a/samples/api/hire/v1/list_offer_sample.py +++ b/samples/api/hire/v1/list_offer_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOfferRequest = ListOfferRequest.builder() \ - .page_token("1231231987") \ - .page_size(10) \ - .talent_id("7096320678581242123") \ - .user_id_type("user_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: ListOfferRequest = ListOfferRequest.builder() \ + .page_token("1231231987") \ + .page_size(10) \ + .talent_id("7096320678581242123") \ + .user_id_type("user_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: ListOfferResponse = client.hire.v1.offer.list(request) + # 发起请求 + response: ListOfferResponse = client.hire.v1.offer.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListOfferRequest = ListOfferRequest.builder() \ - .page_token("1231231987") \ - .page_size(10) \ - .talent_id("7096320678581242123") \ - .user_id_type("user_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: ListOfferRequest = ListOfferRequest.builder() \ + .page_token("1231231987") \ + .page_size(10) \ + .talent_id("7096320678581242123") \ + .user_id_type("user_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: ListOfferResponse = await client.hire.v1.offer.alist(request) + # 发起请求 + response: ListOfferResponse = await client.hire.v1.offer.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_questionnaire_sample.py b/samples/api/hire/v1/list_questionnaire_sample.py index 591f0d537..0d7086cdb 100644 --- a/samples/api/hire/v1/list_questionnaire_sample.py +++ b/samples/api/hire/v1/list_questionnaire_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListQuestionnaireRequest = ListQuestionnaireRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .application_id("6985833807195212076") \ - .interview_id("7038435261598763308") \ - .update_start_time("1638848468868") \ - .update_end_time("1638848468869") \ - .build() + # 构造请求对象 + request: ListQuestionnaireRequest = ListQuestionnaireRequest.builder() \ + .page_token("1231231987") \ + .page_size(20) \ + .application_id("6985833807195212076") \ + .interview_id("7038435261598763308") \ + .update_start_time("1638848468868") \ + .update_end_time("1638848468869") \ + .build() - # 发起请求 - response: ListQuestionnaireResponse = client.hire.v1.questionnaire.list(request) + # 发起请求 + response: ListQuestionnaireResponse = client.hire.v1.questionnaire.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.questionnaire.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.questionnaire.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListQuestionnaireRequest = ListQuestionnaireRequest.builder() \ - .page_token("1231231987") \ - .page_size(1) \ - .application_id("6985833807195212076") \ - .interview_id("7038435261598763308") \ - .update_start_time("1638848468868") \ - .update_end_time("1638848468869") \ - .build() + # 构造请求对象 + request: ListQuestionnaireRequest = ListQuestionnaireRequest.builder() \ + .page_token("1231231987") \ + .page_size(20) \ + .application_id("6985833807195212076") \ + .interview_id("7038435261598763308") \ + .update_start_time("1638848468868") \ + .update_end_time("1638848468869") \ + .build() - # 发起请求 - response: ListQuestionnaireResponse = await client.hire.v1.questionnaire.alist(request) + # 发起请求 + response: ListQuestionnaireResponse = await client.hire.v1.questionnaire.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.questionnaire.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.questionnaire.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_referral_website_job_post_sample.py b/samples/api/hire/v1/list_referral_website_job_post_sample.py index 2affb4a51..1346e87f3 100644 --- a/samples/api/hire/v1/list_referral_website_job_post_sample.py +++ b/samples/api/hire/v1/list_referral_website_job_post_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListReferralWebsiteJobPostRequest = ListReferralWebsiteJobPostRequest.builder() \ - .process_type(1) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: ListReferralWebsiteJobPostRequest = ListReferralWebsiteJobPostRequest.builder() \ + .process_type(1) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: ListReferralWebsiteJobPostResponse = client.hire.v1.referral_website_job_post.list(request) + # 发起请求 + response: ListReferralWebsiteJobPostResponse = client.hire.v1.referral_website_job_post.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_website_job_post.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_website_job_post.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListReferralWebsiteJobPostRequest = ListReferralWebsiteJobPostRequest.builder() \ - .process_type(1) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .build() + # 构造请求对象 + request: ListReferralWebsiteJobPostRequest = ListReferralWebsiteJobPostRequest.builder() \ + .process_type(1) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .build() - # 发起请求 - response: ListReferralWebsiteJobPostResponse = await client.hire.v1.referral_website_job_post.alist(request) + # 发起请求 + response: ListReferralWebsiteJobPostResponse = await client.hire.v1.referral_website_job_post.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_website_job_post.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_website_job_post.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_registration_schema_sample.py b/samples/api/hire/v1/list_registration_schema_sample.py index e7853d8fa..f41df1316 100644 --- a/samples/api/hire/v1/list_registration_schema_sample.py +++ b/samples/api/hire/v1/list_registration_schema_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRegistrationSchemaRequest = ListRegistrationSchemaRequest.builder() \ - .page_size(10) \ - .page_token("6930815272790114324") \ - .scenario(5) \ - .build() + # 构造请求对象 + request: ListRegistrationSchemaRequest = ListRegistrationSchemaRequest.builder() \ + .page_size(10) \ + .page_token("6930815272790114324") \ + .scenario(5) \ + .build() - # 发起请求 - response: ListRegistrationSchemaResponse = client.hire.v1.registration_schema.list(request) + # 发起请求 + response: ListRegistrationSchemaResponse = client.hire.v1.registration_schema.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.registration_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.registration_schema.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRegistrationSchemaRequest = ListRegistrationSchemaRequest.builder() \ - .page_size(10) \ - .page_token("6930815272790114324") \ - .scenario(5) \ - .build() + # 构造请求对象 + request: ListRegistrationSchemaRequest = ListRegistrationSchemaRequest.builder() \ + .page_size(10) \ + .page_token("6930815272790114324") \ + .scenario(5) \ + .build() - # 发起请求 - response: ListRegistrationSchemaResponse = await client.hire.v1.registration_schema.alist(request) + # 发起请求 + response: ListRegistrationSchemaResponse = await client.hire.v1.registration_schema.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.registration_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.registration_schema.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_resume_source_sample.py b/samples/api/hire/v1/list_resume_source_sample.py index f99cd5d00..2c6f42ccb 100644 --- a/samples/api/hire/v1/list_resume_source_sample.py +++ b/samples/api/hire/v1/list_resume_source_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListResumeSourceRequest = ListResumeSourceRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .build() + # 构造请求对象 + request: ListResumeSourceRequest = ListResumeSourceRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .build() - # 发起请求 - response: ListResumeSourceResponse = client.hire.v1.resume_source.list(request) + # 发起请求 + response: ListResumeSourceResponse = client.hire.v1.resume_source.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.resume_source.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.resume_source.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListResumeSourceRequest = ListResumeSourceRequest.builder() \ - .page_size(10) \ - .page_token("1") \ - .build() + # 构造请求对象 + request: ListResumeSourceRequest = ListResumeSourceRequest.builder() \ + .page_size(10) \ + .page_token("1") \ + .build() - # 发起请求 - response: ListResumeSourceResponse = await client.hire.v1.resume_source.alist(request) + # 发起请求 + response: ListResumeSourceResponse = await client.hire.v1.resume_source.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.resume_source.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.resume_source.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_role_sample.py b/samples/api/hire/v1/list_role_sample.py index 1ef84a102..4e1d5879c 100644 --- a/samples/api/hire/v1/list_role_sample.py +++ b/samples/api/hire/v1/list_role_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoleRequest = ListRoleRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListRoleRequest = ListRoleRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListRoleResponse = client.hire.v1.role.list(request) + # 发起请求 + response: ListRoleResponse = client.hire.v1.role.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.role.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.role.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoleRequest = ListRoleRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListRoleRequest = ListRoleRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListRoleResponse = await client.hire.v1.role.alist(request) + # 发起请求 + response: ListRoleResponse = await client.hire.v1.role.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.role.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.role.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_subject_sample.py b/samples/api/hire/v1/list_subject_sample.py index 90c916a2f..b343a6424 100644 --- a/samples/api/hire/v1/list_subject_sample.py +++ b/samples/api/hire/v1/list_subject_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubjectRequest = ListSubjectRequest.builder() \ - .user_id_type("open_id") \ - .subject_ids([]) \ - .page_token("1231231987") \ - .page_size(1) \ - .build() + # 构造请求对象 + request: ListSubjectRequest = ListSubjectRequest.builder() \ + .user_id_type("open_id") \ + .subject_ids([]) \ + .page_token("1231231987") \ + .page_size(1) \ + .build() - # 发起请求 - response: ListSubjectResponse = client.hire.v1.subject.list(request) + # 发起请求 + response: ListSubjectResponse = client.hire.v1.subject.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.subject.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.subject.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSubjectRequest = ListSubjectRequest.builder() \ - .user_id_type("open_id") \ - .subject_ids([]) \ - .page_token("1231231987") \ - .page_size(1) \ - .build() + # 构造请求对象 + request: ListSubjectRequest = ListSubjectRequest.builder() \ + .user_id_type("open_id") \ + .subject_ids([]) \ + .page_token("1231231987") \ + .page_size(1) \ + .build() - # 发起请求 - response: ListSubjectResponse = await client.hire.v1.subject.alist(request) + # 发起请求 + response: ListSubjectResponse = await client.hire.v1.subject.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.subject.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.subject.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_talent_folder_sample.py b/samples/api/hire/v1/list_talent_folder_sample.py index bdf297a2d..e685866cd 100644 --- a/samples/api/hire/v1/list_talent_folder_sample.py +++ b/samples/api/hire/v1/list_talent_folder_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTalentFolderRequest = ListTalentFolderRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTalentFolderRequest = ListTalentFolderRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTalentFolderResponse = client.hire.v1.talent_folder.list(request) + # 发起请求 + response: ListTalentFolderResponse = client.hire.v1.talent_folder.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_folder.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_folder.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTalentFolderRequest = ListTalentFolderRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ - .page_size(10) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTalentFolderRequest = ListTalentFolderRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9") \ + .page_size(10) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTalentFolderResponse = await client.hire.v1.talent_folder.alist(request) + # 发起请求 + response: ListTalentFolderResponse = await client.hire.v1.talent_folder.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_folder.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_folder.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_talent_sample.py b/samples/api/hire/v1/list_talent_sample.py index 696df9be2..5688bcbd4 100644 --- a/samples/api/hire/v1/list_talent_sample.py +++ b/samples/api/hire/v1/list_talent_sample.py @@ -5,68 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTalentRequest = ListTalentRequest.builder() \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id_type("people_admin_id") \ - .query_option("ignore_empty_error") \ - .build() + # 构造请求对象 + request: ListTalentRequest = ListTalentRequest.builder() \ + .keyword("张三 and 产品经理") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .page_size(10) \ + .sort_by(1) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id_type("people_admin_id") \ + .query_option("ignore_empty_error") \ + .build() - # 发起请求 - response: ListTalentResponse = client.hire.v1.talent.list(request) + # 发起请求 + response: ListTalentResponse = client.hire.v1.talent.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTalentRequest = ListTalentRequest.builder() \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .user_id_type("people_admin_id") \ - .query_option("ignore_empty_error") \ - .build() + # 构造请求对象 + request: ListTalentRequest = ListTalentRequest.builder() \ + .keyword("张三 and 产品经理") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .page_size(10) \ + .sort_by(1) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .user_id_type("people_admin_id") \ + .query_option("ignore_empty_error") \ + .build() - # 发起请求 - response: ListTalentResponse = await client.hire.v1.talent.alist(request) + # 发起请求 + response: ListTalentResponse = await client.hire.v1.talent.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_termination_reason_sample.py b/samples/api/hire/v1/list_termination_reason_sample.py index e1dc7b2e4..4c9263cfe 100644 --- a/samples/api/hire/v1/list_termination_reason_sample.py +++ b/samples/api/hire/v1/list_termination_reason_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTerminationReasonRequest = ListTerminationReasonRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListTerminationReasonRequest = ListTerminationReasonRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListTerminationReasonResponse = client.hire.v1.termination_reason.list(request) + # 发起请求 + response: ListTerminationReasonResponse = client.hire.v1.termination_reason.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.termination_reason.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.termination_reason.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTerminationReasonRequest = ListTerminationReasonRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListTerminationReasonRequest = ListTerminationReasonRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListTerminationReasonResponse = await client.hire.v1.termination_reason.alist(request) + # 发起请求 + response: ListTerminationReasonResponse = await client.hire.v1.termination_reason.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.termination_reason.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.termination_reason.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_todo_sample.py b/samples/api/hire/v1/list_todo_sample.py index 89839468e..3de19eb13 100644 --- a/samples/api/hire/v1/list_todo_sample.py +++ b/samples/api/hire/v1/list_todo_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTodoRequest = ListTodoRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size("100") \ - .user_id("ou_xxx") \ - .user_id_type("people_admin_id") \ - .type("interview") \ - .build() + # 构造请求对象 + request: ListTodoRequest = ListTodoRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size("10") \ + .user_id("ou_xxx") \ + .user_id_type("people_admin_id") \ + .type("interview") \ + .build() - # 发起请求 - response: ListTodoResponse = client.hire.v1.todo.list(request) + # 发起请求 + response: ListTodoResponse = client.hire.v1.todo.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.todo.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.todo.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTodoRequest = ListTodoRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size("100") \ - .user_id("ou_xxx") \ - .user_id_type("people_admin_id") \ - .type("interview") \ - .build() + # 构造请求对象 + request: ListTodoRequest = ListTodoRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size("10") \ + .user_id("ou_xxx") \ + .user_id_type("people_admin_id") \ + .type("interview") \ + .build() - # 发起请求 - response: ListTodoResponse = await client.hire.v1.todo.alist(request) + # 发起请求 + response: ListTodoResponse = await client.hire.v1.todo.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.todo.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.todo.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_tripartite_agreement_sample.py b/samples/api/hire/v1/list_tripartite_agreement_sample.py index a832d6417..73ffdcefd 100644 --- a/samples/api/hire/v1/list_tripartite_agreement_sample.py +++ b/samples/api/hire/v1/list_tripartite_agreement_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTripartiteAgreementRequest = ListTripartiteAgreementRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .application_id("6930815272790114324") \ - .tripartite_agreement_id("6930815272790114325") \ - .build() + # 构造请求对象 + request: ListTripartiteAgreementRequest = ListTripartiteAgreementRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .application_id("6930815272790114324") \ + .tripartite_agreement_id("6930815272790114325") \ + .build() - # 发起请求 - response: ListTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.list(request) + # 发起请求 + response: ListTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTripartiteAgreementRequest = ListTripartiteAgreementRequest.builder() \ - .page_size(int) \ - .page_token("str") \ - .application_id("6930815272790114324") \ - .tripartite_agreement_id("6930815272790114325") \ - .build() + # 构造请求对象 + request: ListTripartiteAgreementRequest = ListTripartiteAgreementRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .application_id("6930815272790114324") \ + .tripartite_agreement_id("6930815272790114325") \ + .build() - # 发起请求 - response: ListTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.alist(request) + # 发起请求 + response: ListTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_website_channel_sample.py b/samples/api/hire/v1/list_website_channel_sample.py index 33cf45e87..07474424a 100644 --- a/samples/api/hire/v1/list_website_channel_sample.py +++ b/samples/api/hire/v1/list_website_channel_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteChannelRequest = ListWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .page_size("10") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1NTUyMjM2NzIsImlkIjpudWxsfQ") \ - .build() + # 构造请求对象 + request: ListWebsiteChannelRequest = ListWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .page_size("10") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1NTUyMjM2NzIsImlkIjpudWxsfQ") \ + .build() - # 发起请求 - response: ListWebsiteChannelResponse = client.hire.v1.website_channel.list(request) + # 发起请求 + response: ListWebsiteChannelResponse = client.hire.v1.website_channel.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteChannelRequest = ListWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .page_size("10") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1NTUyMjM2NzIsImlkIjpudWxsfQ") \ - .build() + # 构造请求对象 + request: ListWebsiteChannelRequest = ListWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .page_size("10") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1NTUyMjM2NzIsImlkIjpudWxsfQ") \ + .build() - # 发起请求 - response: ListWebsiteChannelResponse = await client.hire.v1.website_channel.alist(request) + # 发起请求 + response: ListWebsiteChannelResponse = await client.hire.v1.website_channel.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_website_job_post_sample.py b/samples/api/hire/v1/list_website_job_post_sample.py index 9b1e1144f..1dd428ac6 100644 --- a/samples/api/hire/v1/list_website_job_post_sample.py +++ b/samples/api/hire/v1/list_website_job_post_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteJobPostRequest = ListWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .create_start_time("1618500278663") \ - .create_end_time("1618500278663") \ - .build() + # 构造请求对象 + request: ListWebsiteJobPostRequest = ListWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .create_start_time("1618500278663") \ + .create_end_time("1618500278663") \ + .build() - # 发起请求 - response: ListWebsiteJobPostResponse = client.hire.v1.website_job_post.list(request) + # 发起请求 + response: ListWebsiteJobPostResponse = client.hire.v1.website_job_post.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteJobPostRequest = ListWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .update_start_time("1618500278663") \ - .update_end_time("1618500278663") \ - .create_start_time("1618500278663") \ - .create_end_time("1618500278663") \ - .build() + # 构造请求对象 + request: ListWebsiteJobPostRequest = ListWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .create_start_time("1618500278663") \ + .create_end_time("1618500278663") \ + .build() - # 发起请求 - response: ListWebsiteJobPostResponse = await client.hire.v1.website_job_post.alist(request) + # 发起请求 + response: ListWebsiteJobPostResponse = await client.hire.v1.website_job_post.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/list_website_sample.py b/samples/api/hire/v1/list_website_sample.py index 24c3a49bb..5775a69b1 100644 --- a/samples/api/hire/v1/list_website_sample.py +++ b/samples/api/hire/v1/list_website_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteRequest = ListWebsiteRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListWebsiteRequest = ListWebsiteRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListWebsiteResponse = client.hire.v1.website.list(request) + # 发起请求 + response: ListWebsiteResponse = client.hire.v1.website.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListWebsiteRequest = ListWebsiteRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListWebsiteRequest = ListWebsiteRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListWebsiteResponse = await client.hire.v1.website.alist(request) + # 发起请求 + response: ListWebsiteResponse = await client.hire.v1.website.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/login_info_eco_exam_sample.py b/samples/api/hire/v1/login_info_eco_exam_sample.py index 9abc97bc9..ba756c5a6 100644 --- a/samples/api/hire/v1/login_info_eco_exam_sample.py +++ b/samples/api/hire/v1/login_info_eco_exam_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LoginInfoEcoExamRequest = LoginInfoEcoExamRequest.builder() \ - .exam_id("7178536692385679677") \ - .request_body(LoginInfoEcoExamRequestBody.builder() - .result(0) - .msg("success") - .exam_login_info(EcoExamLoginInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: LoginInfoEcoExamRequest = LoginInfoEcoExamRequest.builder() \ + .exam_id("7178536692385679677") \ + .request_body(LoginInfoEcoExamRequestBody.builder() + .result(0) + .msg("success") + .exam_login_info(EcoExamLoginInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: LoginInfoEcoExamResponse = client.hire.v1.eco_exam.login_info(request) + # 发起请求 + response: LoginInfoEcoExamResponse = client.hire.v1.eco_exam.login_info(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam.login_info failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam.login_info failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LoginInfoEcoExamRequest = LoginInfoEcoExamRequest.builder() \ - .exam_id("7178536692385679677") \ - .request_body(LoginInfoEcoExamRequestBody.builder() - .result(0) - .msg("success") - .exam_login_info(EcoExamLoginInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: LoginInfoEcoExamRequest = LoginInfoEcoExamRequest.builder() \ + .exam_id("7178536692385679677") \ + .request_body(LoginInfoEcoExamRequestBody.builder() + .result(0) + .msg("success") + .exam_login_info(EcoExamLoginInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: LoginInfoEcoExamResponse = await client.hire.v1.eco_exam.alogin_info(request) + # 发起请求 + response: LoginInfoEcoExamResponse = await client.hire.v1.eco_exam.alogin_info(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam.alogin_info failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam.alogin_info failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/move_talent_talent_pool_sample.py b/samples/api/hire/v1/move_talent_talent_pool_sample.py index 6684adcf9..ce1671bc3 100644 --- a/samples/api/hire/v1/move_talent_talent_pool_sample.py +++ b/samples/api/hire/v1/move_talent_talent_pool_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveTalentTalentPoolRequest = MoveTalentTalentPoolRequest.builder() \ - .talent_pool_id("6930815272790114325") \ - .request_body(MoveTalentTalentPoolRequestBody.builder() - .talent_id("6930815272790114324") - .add_type(1) - .build()) \ - .build() + # 构造请求对象 + request: MoveTalentTalentPoolRequest = MoveTalentTalentPoolRequest.builder() \ + .talent_pool_id("6930815272790114325") \ + .request_body(MoveTalentTalentPoolRequestBody.builder() + .talent_id("6930815272790114324") + .add_type(1) + .build()) \ + .build() - # 发起请求 - response: MoveTalentTalentPoolResponse = client.hire.v1.talent_pool.move_talent(request) + # 发起请求 + response: MoveTalentTalentPoolResponse = client.hire.v1.talent_pool.move_talent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_pool.move_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_pool.move_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveTalentTalentPoolRequest = MoveTalentTalentPoolRequest.builder() \ - .talent_pool_id("6930815272790114325") \ - .request_body(MoveTalentTalentPoolRequestBody.builder() - .talent_id("6930815272790114324") - .add_type(1) - .build()) \ - .build() + # 构造请求对象 + request: MoveTalentTalentPoolRequest = MoveTalentTalentPoolRequest.builder() \ + .talent_pool_id("6930815272790114325") \ + .request_body(MoveTalentTalentPoolRequestBody.builder() + .talent_id("6930815272790114324") + .add_type(1) + .build()) \ + .build() - # 发起请求 - response: MoveTalentTalentPoolResponse = await client.hire.v1.talent_pool.amove_talent(request) + # 发起请求 + response: MoveTalentTalentPoolResponse = await client.hire.v1.talent_pool.amove_talent(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_pool.amove_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_pool.amove_talent failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/offer_application_sample.py b/samples/api/hire/v1/offer_application_sample.py index 9c833fcb8..a7b825162 100644 --- a/samples/api/hire/v1/offer_application_sample.py +++ b/samples/api/hire/v1/offer_application_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OfferApplicationRequest = OfferApplicationRequest.builder() \ - .application_id("6949805467799537964") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: OfferApplicationRequest = OfferApplicationRequest.builder() \ + .application_id("6949805467799537964") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: OfferApplicationResponse = client.hire.v1.application.offer(request) + # 发起请求 + response: OfferApplicationResponse = client.hire.v1.application.offer(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.offer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.offer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OfferApplicationRequest = OfferApplicationRequest.builder() \ - .application_id("6949805467799537964") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .build() + # 构造请求对象 + request: OfferApplicationRequest = OfferApplicationRequest.builder() \ + .application_id("6949805467799537964") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .build() - # 发起请求 - response: OfferApplicationResponse = await client.hire.v1.application.aoffer(request) + # 发起请求 + response: OfferApplicationResponse = await client.hire.v1.application.aoffer(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.aoffer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.aoffer failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/offer_status_offer_sample.py b/samples/api/hire/v1/offer_status_offer_sample.py index dc5336755..cb192e294 100644 --- a/samples/api/hire/v1/offer_status_offer_sample.py +++ b/samples/api/hire/v1/offer_status_offer_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OfferStatusOfferRequest = OfferStatusOfferRequest.builder() \ - .offer_id("6930815272790114324") \ - .request_body(OfferStatusOfferRequestBody.builder() - .offer_status(2) - .expiration_date("2023-01-01") - .termination_reason_id_list([]) - .termination_reason_note("不符合期望") - .build()) \ - .build() + # 构造请求对象 + request: OfferStatusOfferRequest = OfferStatusOfferRequest.builder() \ + .offer_id("6930815272790114324") \ + .request_body(OfferStatusOfferRequestBody.builder() + .offer_status(2) + .expiration_date("2023-01-01") + .termination_reason_id_list([]) + .termination_reason_note("不符合期望") + .build()) \ + .build() - # 发起请求 - response: OfferStatusOfferResponse = client.hire.v1.offer.offer_status(request) + # 发起请求 + response: OfferStatusOfferResponse = client.hire.v1.offer.offer_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.offer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OfferStatusOfferRequest = OfferStatusOfferRequest.builder() \ - .offer_id("6930815272790114324") \ - .request_body(OfferStatusOfferRequestBody.builder() - .offer_status(2) - .expiration_date("2023-01-01") - .termination_reason_id_list([]) - .termination_reason_note("不符合期望") - .build()) \ - .build() + # 构造请求对象 + request: OfferStatusOfferRequest = OfferStatusOfferRequest.builder() \ + .offer_id("6930815272790114324") \ + .request_body(OfferStatusOfferRequestBody.builder() + .offer_status(2) + .expiration_date("2023-01-01") + .termination_reason_id_list([]) + .termination_reason_note("不符合期望") + .build()) \ + .build() - # 发起请求 - response: OfferStatusOfferResponse = await client.hire.v1.offer.aoffer_status(request) + # 发起请求 + response: OfferStatusOfferResponse = await client.hire.v1.offer.aoffer_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.aoffer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.aoffer_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/onboard_status_talent_sample.py b/samples/api/hire/v1/onboard_status_talent_sample.py index 0bf986b91..887f34172 100644 --- a/samples/api/hire/v1/onboard_status_talent_sample.py +++ b/samples/api/hire/v1/onboard_status_talent_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OnboardStatusTalentRequest = OnboardStatusTalentRequest.builder() \ - .talent_id("6960663240925956661") \ - .request_body(OnboardStatusTalentRequestBody.builder() - .operation(1) - .onboard_time("1676548784889") - .overboard_time("1676548784890") - .build()) \ - .build() + # 构造请求对象 + request: OnboardStatusTalentRequest = OnboardStatusTalentRequest.builder() \ + .talent_id("6960663240925956661") \ + .request_body(OnboardStatusTalentRequestBody.builder() + .operation(1) + .onboard_time("1676548784889") + .overboard_time("1676548784890") + .build()) \ + .build() - # 发起请求 - response: OnboardStatusTalentResponse = client.hire.v1.talent.onboard_status(request) + # 发起请求 + response: OnboardStatusTalentResponse = client.hire.v1.talent.onboard_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.onboard_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.onboard_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OnboardStatusTalentRequest = OnboardStatusTalentRequest.builder() \ - .talent_id("6960663240925956661") \ - .request_body(OnboardStatusTalentRequestBody.builder() - .operation(1) - .onboard_time("1676548784889") - .overboard_time("1676548784890") - .build()) \ - .build() + # 构造请求对象 + request: OnboardStatusTalentRequest = OnboardStatusTalentRequest.builder() \ + .talent_id("6960663240925956661") \ + .request_body(OnboardStatusTalentRequestBody.builder() + .operation(1) + .onboard_time("1676548784889") + .overboard_time("1676548784890") + .build()) \ + .build() - # 发起请求 - response: OnboardStatusTalentResponse = await client.hire.v1.talent.aonboard_status(request) + # 发起请求 + response: OnboardStatusTalentResponse = await client.hire.v1.talent.aonboard_status(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent.aonboard_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent.aonboard_status failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/open_job_sample.py b/samples/api/hire/v1/open_job_sample.py index 112981383..9f4b57b78 100644 --- a/samples/api/hire/v1/open_job_sample.py +++ b/samples/api/hire/v1/open_job_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OpenJobRequest = OpenJobRequest.builder() \ - .job_id("6960663240925956555") \ - .request_body(OpenJobRequestBody.builder() - .expiry_time(0) - .is_never_expired(True) - .build()) \ - .build() + # 构造请求对象 + request: OpenJobRequest = OpenJobRequest.builder() \ + .job_id("6960663240925956555") \ + .request_body(OpenJobRequestBody.builder() + .expiry_time(0) + .is_never_expired(True) + .build()) \ + .build() - # 发起请求 - response: OpenJobResponse = client.hire.v1.job.open(request) + # 发起请求 + response: OpenJobResponse = client.hire.v1.job.open(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: OpenJobRequest = OpenJobRequest.builder() \ - .job_id("6960663240925956555") \ - .request_body(OpenJobRequestBody.builder() - .expiry_time(0) - .is_never_expired(True) - .build()) \ - .build() + # 构造请求对象 + request: OpenJobRequest = OpenJobRequest.builder() \ + .job_id("6960663240925956555") \ + .request_body(OpenJobRequestBody.builder() + .expiry_time(0) + .is_never_expired(True) + .build()) \ + .build() - # 发起请求 - response: OpenJobResponse = await client.hire.v1.job.aopen(request) + # 发起请求 + response: OpenJobResponse = await client.hire.v1.job.aopen(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.aopen failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.aopen failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/patch_ehr_import_task_sample.py b/samples/api/hire/v1/patch_ehr_import_task_sample.py index 0f3b6c87c..da7f355e8 100644 --- a/samples/api/hire/v1/patch_ehr_import_task_sample.py +++ b/samples/api/hire/v1/patch_ehr_import_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEhrImportTaskRequest = PatchEhrImportTaskRequest.builder() \ - .ehr_import_task_id("623455234") \ - .request_body(EhrImportTask.builder() - .fail_reason("当前HC不可用") - .redirect_url("https://example.com") - .state(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchEhrImportTaskRequest = PatchEhrImportTaskRequest.builder() \ + .ehr_import_task_id("623455234") \ + .request_body(EhrImportTask.builder() + .fail_reason("当前HC不可用") + .redirect_url("https://example.com") + .state(1) + .build()) \ + .build() - # 发起请求 - response: PatchEhrImportTaskResponse = client.hire.v1.ehr_import_task.patch(request) + # 发起请求 + response: PatchEhrImportTaskResponse = client.hire.v1.ehr_import_task.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.ehr_import_task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.ehr_import_task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEhrImportTaskRequest = PatchEhrImportTaskRequest.builder() \ - .ehr_import_task_id("623455234") \ - .request_body(EhrImportTask.builder() - .fail_reason("当前HC不可用") - .redirect_url("https://example.com") - .state(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchEhrImportTaskRequest = PatchEhrImportTaskRequest.builder() \ + .ehr_import_task_id("623455234") \ + .request_body(EhrImportTask.builder() + .fail_reason("当前HC不可用") + .redirect_url("https://example.com") + .state(1) + .build()) \ + .build() - # 发起请求 - response: PatchEhrImportTaskResponse = await client.hire.v1.ehr_import_task.apatch(request) + # 发起请求 + response: PatchEhrImportTaskResponse = await client.hire.v1.ehr_import_task.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.ehr_import_task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.ehr_import_task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/patch_employee_sample.py b/samples/api/hire/v1/patch_employee_sample.py index 16c51bf89..9fc3ea076 100644 --- a/samples/api/hire/v1/patch_employee_sample.py +++ b/samples/api/hire/v1/patch_employee_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmployeeRequest = PatchEmployeeRequest.builder() \ - .employee_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(ChangeEmployeeStage.builder() - .operation(1) - .conversion_info(EmployeeConversionInfo.builder().build()) - .overboard_info(EmployeeOverboardInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchEmployeeRequest = PatchEmployeeRequest.builder() \ + .employee_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(ChangeEmployeeStage.builder() + .operation(1) + .conversion_info(EmployeeConversionInfo.builder().build()) + .overboard_info(EmployeeOverboardInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchEmployeeResponse = client.hire.v1.employee.patch(request) + # 发起请求 + response: PatchEmployeeResponse = client.hire.v1.employee.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchEmployeeRequest = PatchEmployeeRequest.builder() \ - .employee_id("123") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(ChangeEmployeeStage.builder() - .operation(1) - .conversion_info(EmployeeConversionInfo.builder().build()) - .overboard_info(EmployeeOverboardInfo.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchEmployeeRequest = PatchEmployeeRequest.builder() \ + .employee_id("123") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(ChangeEmployeeStage.builder() + .operation(1) + .conversion_info(EmployeeConversionInfo.builder().build()) + .overboard_info(EmployeeOverboardInfo.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchEmployeeResponse = await client.hire.v1.employee.apatch(request) + # 发起请求 + response: PatchEmployeeResponse = await client.hire.v1.employee.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.employee.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.employee.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/patch_external_interview_assessment_sample.py b/samples/api/hire/v1/patch_external_interview_assessment_sample.py index f7d6e3f2e..01c063ca0 100644 --- a/samples/api/hire/v1/patch_external_interview_assessment_sample.py +++ b/samples/api/hire/v1/patch_external_interview_assessment_sample.py @@ -5,71 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchExternalInterviewAssessmentRequest = PatchExternalInterviewAssessmentRequest.builder() \ - .external_interview_assessment_id("6930815272790114324") \ - .request_body(ExternalInterviewAssessment.builder() - .username("shaojiale") - .conclusion(1) - .assessment_dimension_list([]) - .content("hello world") - .build()) \ - .build() + # 构造请求对象 + request: PatchExternalInterviewAssessmentRequest = PatchExternalInterviewAssessmentRequest.builder() \ + .external_interview_assessment_id("6930815272790114324") \ + .request_body(ExternalInterviewAssessment.builder() + .username("shaojiale") + .conclusion(1) + .assessment_dimension_list([]) + .content("hello world") + .build()) \ + .build() - # 发起请求 - response: PatchExternalInterviewAssessmentResponse = client.hire.v1.external_interview_assessment.patch(request) + # 发起请求 + response: PatchExternalInterviewAssessmentResponse = client.hire.v1.external_interview_assessment.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview_assessment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview_assessment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchExternalInterviewAssessmentRequest = PatchExternalInterviewAssessmentRequest.builder() \ - .external_interview_assessment_id("6930815272790114324") \ - .request_body(ExternalInterviewAssessment.builder() - .username("shaojiale") - .conclusion(1) - .assessment_dimension_list([]) - .content("hello world") - .build()) \ - .build() + # 构造请求对象 + request: PatchExternalInterviewAssessmentRequest = PatchExternalInterviewAssessmentRequest.builder() \ + .external_interview_assessment_id("6930815272790114324") \ + .request_body(ExternalInterviewAssessment.builder() + .username("shaojiale") + .conclusion(1) + .assessment_dimension_list([]) + .content("hello world") + .build()) \ + .build() - # 发起请求 - response: PatchExternalInterviewAssessmentResponse = await client.hire.v1.external_interview_assessment.apatch( - request) + # 发起请求 + response: PatchExternalInterviewAssessmentResponse = await client.hire.v1.external_interview_assessment.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_interview_assessment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_interview_assessment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/patch_note_sample.py b/samples/api/hire/v1/patch_note_sample.py index bd92ae128..ae1961fb5 100644 --- a/samples/api/hire/v1/patch_note_sample.py +++ b/samples/api/hire/v1/patch_note_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNoteRequest = PatchNoteRequest.builder() \ - .note_id("6960663240925956401") \ - .user_id_type("open_id") \ - .request_body(PatchNoteRequestBody.builder() - .content("111") - .operator_id("ou_f476cb099ac9227c9bae09ce46112579") - .notify_mentioned_user(False) - .mention_entity_list([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchNoteRequest = PatchNoteRequest.builder() \ + .note_id("6960663240925956401") \ + .user_id_type("open_id") \ + .request_body(PatchNoteRequestBody.builder() + .content("111") + .operator_id("ou_f476cb099ac9227c9bae09ce46112579") + .notify_mentioned_user(False) + .mention_entity_list([]) + .build()) \ + .build() - # 发起请求 - response: PatchNoteResponse = client.hire.v1.note.patch(request) + # 发起请求 + response: PatchNoteResponse = client.hire.v1.note.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchNoteRequest = PatchNoteRequest.builder() \ - .note_id("6960663240925956401") \ - .user_id_type("open_id") \ - .request_body(PatchNoteRequestBody.builder() - .content("111") - .operator_id("ou_f476cb099ac9227c9bae09ce46112579") - .notify_mentioned_user(False) - .mention_entity_list([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchNoteRequest = PatchNoteRequest.builder() \ + .note_id("6960663240925956401") \ + .user_id_type("open_id") \ + .request_body(PatchNoteRequestBody.builder() + .content("111") + .operator_id("ou_f476cb099ac9227c9bae09ce46112579") + .notify_mentioned_user(False) + .mention_entity_list([]) + .build()) \ + .build() - # 发起请求 - response: PatchNoteResponse = await client.hire.v1.note.apatch(request) + # 发起请求 + response: PatchNoteResponse = await client.hire.v1.note.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.note.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.note.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/preview_attachment_sample.py b/samples/api/hire/v1/preview_attachment_sample.py index 07b17d5c5..42e7af8a5 100644 --- a/samples/api/hire/v1/preview_attachment_sample.py +++ b/samples/api/hire/v1/preview_attachment_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewAttachmentRequest = PreviewAttachmentRequest.builder() \ - .attachment_id("11111") \ - .build() + # 构造请求对象 + request: PreviewAttachmentRequest = PreviewAttachmentRequest.builder() \ + .attachment_id("11111") \ + .build() - # 发起请求 - response: PreviewAttachmentResponse = client.hire.v1.attachment.preview(request) + # 发起请求 + response: PreviewAttachmentResponse = client.hire.v1.attachment.preview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.preview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PreviewAttachmentRequest = PreviewAttachmentRequest.builder() \ - .attachment_id("11111") \ - .build() + # 构造请求对象 + request: PreviewAttachmentRequest = PreviewAttachmentRequest.builder() \ + .attachment_id("11111") \ + .build() - # 发起请求 - response: PreviewAttachmentResponse = await client.hire.v1.attachment.apreview(request) + # 发起请求 + response: PreviewAttachmentResponse = await client.hire.v1.attachment.apreview(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.attachment.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.attachment.apreview failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/protect_agency_sample.py b/samples/api/hire/v1/protect_agency_sample.py index e059f6dc1..fd036d9bd 100644 --- a/samples/api/hire/v1/protect_agency_sample.py +++ b/samples/api/hire/v1/protect_agency_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProtectAgencyRequest = ProtectAgencyRequest.builder() \ - .user_id_type("open_id") \ - .request_body(ProtectAgencyRequestBody.builder() - .talent_id("6962051712422398239") - .supplier_id("6898173495386147079") - .consultant_id("ou_f476cb099ac9227c9bae09ce46112579") - .protect_create_time(1610695587000) - .protect_expire_time(1626333987000) - .comment("此候选人非常优秀,建议录用。") - .current_salary("15k * 13") - .expected_salary("18k * 16") - .build()) \ - .build() + # 构造请求对象 + request: ProtectAgencyRequest = ProtectAgencyRequest.builder() \ + .user_id_type("open_id") \ + .request_body(ProtectAgencyRequestBody.builder() + .talent_id("6962051712422398239") + .supplier_id("6898173495386147079") + .consultant_id("ou_f476cb099ac9227c9bae09ce46112579") + .protect_create_time(1610695587000) + .protect_expire_time(1626333987000) + .comment("此候选人非常优秀,建议录用。") + .current_salary("15k * 13") + .expected_salary("18k * 16") + .build()) \ + .build() - # 发起请求 - response: ProtectAgencyResponse = client.hire.v1.agency.protect(request) + # 发起请求 + response: ProtectAgencyResponse = client.hire.v1.agency.protect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.protect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.protect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProtectAgencyRequest = ProtectAgencyRequest.builder() \ - .user_id_type("open_id") \ - .request_body(ProtectAgencyRequestBody.builder() - .talent_id("6962051712422398239") - .supplier_id("6898173495386147079") - .consultant_id("ou_f476cb099ac9227c9bae09ce46112579") - .protect_create_time(1610695587000) - .protect_expire_time(1626333987000) - .comment("此候选人非常优秀,建议录用。") - .current_salary("15k * 13") - .expected_salary("18k * 16") - .build()) \ - .build() + # 构造请求对象 + request: ProtectAgencyRequest = ProtectAgencyRequest.builder() \ + .user_id_type("open_id") \ + .request_body(ProtectAgencyRequestBody.builder() + .talent_id("6962051712422398239") + .supplier_id("6898173495386147079") + .consultant_id("ou_f476cb099ac9227c9bae09ce46112579") + .protect_create_time(1610695587000) + .protect_expire_time(1626333987000) + .comment("此候选人非常优秀,建议录用。") + .current_salary("15k * 13") + .expected_salary("18k * 16") + .build()) \ + .build() - # 发起请求 - response: ProtectAgencyResponse = await client.hire.v1.agency.aprotect(request) + # 发起请求 + response: ProtectAgencyResponse = await client.hire.v1.agency.aprotect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.aprotect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.aprotect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/protect_search_agency_sample.py b/samples/api/hire/v1/protect_search_agency_sample.py index 2913963c6..292873951 100644 --- a/samples/api/hire/v1/protect_search_agency_sample.py +++ b/samples/api/hire/v1/protect_search_agency_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProtectSearchAgencyRequest = ProtectSearchAgencyRequest.builder() \ - .request_body(ProtectSearchAgencyRequestBody.builder() - .talent_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: ProtectSearchAgencyRequest = ProtectSearchAgencyRequest.builder() \ + .request_body(ProtectSearchAgencyRequestBody.builder() + .talent_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: ProtectSearchAgencyResponse = client.hire.v1.agency.protect_search(request) + # 发起请求 + response: ProtectSearchAgencyResponse = client.hire.v1.agency.protect_search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.protect_search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.protect_search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ProtectSearchAgencyRequest = ProtectSearchAgencyRequest.builder() \ - .request_body(ProtectSearchAgencyRequestBody.builder() - .talent_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: ProtectSearchAgencyRequest = ProtectSearchAgencyRequest.builder() \ + .request_body(ProtectSearchAgencyRequestBody.builder() + .talent_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: ProtectSearchAgencyResponse = await client.hire.v1.agency.aprotect_search(request) + # 发起请求 + response: ProtectSearchAgencyResponse = await client.hire.v1.agency.aprotect_search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.aprotect_search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.aprotect_search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/publish_advertisement_sample.py b/samples/api/hire/v1/publish_advertisement_sample.py index 0f40651c3..5d50e4115 100644 --- a/samples/api/hire/v1/publish_advertisement_sample.py +++ b/samples/api/hire/v1/publish_advertisement_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PublishAdvertisementRequest = PublishAdvertisementRequest.builder() \ - .advertisement_id("6960663240925956660") \ - .request_body(PublishAdvertisementRequestBody.builder() - .job_channel_id("6960663240925956631") - .build()) \ - .build() + # 构造请求对象 + request: PublishAdvertisementRequest = PublishAdvertisementRequest.builder() \ + .advertisement_id("6960663240925956660") \ + .request_body(PublishAdvertisementRequestBody.builder() + .job_channel_id("6960663240925956631") + .build()) \ + .build() - # 发起请求 - response: PublishAdvertisementResponse = client.hire.v1.advertisement.publish(request) + # 发起请求 + response: PublishAdvertisementResponse = client.hire.v1.advertisement.publish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.advertisement.publish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.advertisement.publish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PublishAdvertisementRequest = PublishAdvertisementRequest.builder() \ - .advertisement_id("6960663240925956660") \ - .request_body(PublishAdvertisementRequestBody.builder() - .job_channel_id("6960663240925956631") - .build()) \ - .build() + # 构造请求对象 + request: PublishAdvertisementRequest = PublishAdvertisementRequest.builder() \ + .advertisement_id("6960663240925956660") \ + .request_body(PublishAdvertisementRequestBody.builder() + .job_channel_id("6960663240925956631") + .build()) \ + .build() - # 发起请求 - response: PublishAdvertisementResponse = await client.hire.v1.advertisement.apublish(request) + # 发起请求 + response: PublishAdvertisementResponse = await client.hire.v1.advertisement.apublish(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.advertisement.apublish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.advertisement.apublish failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/query_agency_sample.py b/samples/api/hire/v1/query_agency_sample.py index b7baa4bd0..a5db0a11c 100644 --- a/samples/api/hire/v1/query_agency_sample.py +++ b/samples/api/hire/v1/query_agency_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryAgencyRequest = QueryAgencyRequest.builder() \ - .name("超越猎头公司") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryAgencyRequest = QueryAgencyRequest.builder() \ + .name("超越猎头公司") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryAgencyResponse = client.hire.v1.agency.query(request) + # 发起请求 + response: QueryAgencyResponse = client.hire.v1.agency.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryAgencyRequest = QueryAgencyRequest.builder() \ - .name("超越猎头公司") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryAgencyRequest = QueryAgencyRequest.builder() \ + .name("超越猎头公司") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryAgencyResponse = await client.hire.v1.agency.aquery(request) + # 发起请求 + response: QueryAgencyResponse = await client.hire.v1.agency.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.agency.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.agency.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/query_location_sample.py b/samples/api/hire/v1/query_location_sample.py index fd3d2aa90..7872cbb99 100644 --- a/samples/api/hire/v1/query_location_sample.py +++ b/samples/api/hire/v1/query_location_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryLocationRequest = QueryLocationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(100) \ - .request_body(QueryLocationRequestBody.builder() - .code_list([]) - .location_type(1) - .build()) \ - .build() + # 构造请求对象 + request: QueryLocationRequest = QueryLocationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(100) \ + .request_body(QueryLocationRequestBody.builder() + .code_list([]) + .location_type(1) + .build()) \ + .build() - # 发起请求 - response: QueryLocationResponse = client.hire.v1.location.query(request) + # 发起请求 + response: QueryLocationResponse = client.hire.v1.location.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.location.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.location.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryLocationRequest = QueryLocationRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(100) \ - .request_body(QueryLocationRequestBody.builder() - .code_list([]) - .location_type(1) - .build()) \ - .build() + # 构造请求对象 + request: QueryLocationRequest = QueryLocationRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(100) \ + .request_body(QueryLocationRequestBody.builder() + .code_list([]) + .location_type(1) + .build()) \ + .build() - # 发起请求 - response: QueryLocationResponse = await client.hire.v1.location.aquery(request) + # 发起请求 + response: QueryLocationResponse = await client.hire.v1.location.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.location.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.location.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/query_talent_object_sample.py b/samples/api/hire/v1/query_talent_object_sample.py index baa78930d..916de04fd 100644 --- a/samples/api/hire/v1/query_talent_object_sample.py +++ b/samples/api/hire/v1/query_talent_object_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTalentObjectRequest = QueryTalentObjectRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTalentObjectRequest = QueryTalentObjectRequest.builder() \ + .build() - # 发起请求 - response: QueryTalentObjectResponse = client.hire.v1.talent_object.query(request) + # 发起请求 + response: QueryTalentObjectResponse = client.hire.v1.talent_object.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_object.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_object.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTalentObjectRequest = QueryTalentObjectRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTalentObjectRequest = QueryTalentObjectRequest.builder() \ + .build() - # 发起请求 - response: QueryTalentObjectResponse = await client.hire.v1.talent_object.aquery(request) + # 发起请求 + response: QueryTalentObjectResponse = await client.hire.v1.talent_object.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_object.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_object.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/reconciliation_referral_account_sample.py b/samples/api/hire/v1/reconciliation_referral_account_sample.py index 7e2331d96..4bfd8753d 100644 --- a/samples/api/hire/v1/reconciliation_referral_account_sample.py +++ b/samples/api/hire/v1/reconciliation_referral_account_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReconciliationReferralAccountRequest = ReconciliationReferralAccountRequest.builder() \ - .request_body(ReconciliationReferralAccountRequestBody.builder() - .start_trans_time("1685416831621") - .end_trans_time("1685416831622") - .trade_details([]) - .build()) \ - .build() + # 构造请求对象 + request: ReconciliationReferralAccountRequest = ReconciliationReferralAccountRequest.builder() \ + .request_body(ReconciliationReferralAccountRequestBody.builder() + .start_trans_time("1685416831621") + .end_trans_time("1685416831622") + .trade_details([]) + .build()) \ + .build() - # 发起请求 - response: ReconciliationReferralAccountResponse = client.hire.v1.referral_account.reconciliation(request) + # 发起请求 + response: ReconciliationReferralAccountResponse = client.hire.v1.referral_account.reconciliation(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.reconciliation failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.reconciliation failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReconciliationReferralAccountRequest = ReconciliationReferralAccountRequest.builder() \ - .request_body(ReconciliationReferralAccountRequestBody.builder() - .start_trans_time("1685416831621") - .end_trans_time("1685416831622") - .trade_details([]) - .build()) \ - .build() + # 构造请求对象 + request: ReconciliationReferralAccountRequest = ReconciliationReferralAccountRequest.builder() \ + .request_body(ReconciliationReferralAccountRequestBody.builder() + .start_trans_time("1685416831621") + .end_trans_time("1685416831622") + .trade_details([]) + .build()) \ + .build() - # 发起请求 - response: ReconciliationReferralAccountResponse = await client.hire.v1.referral_account.areconciliation(request) + # 发起请求 + response: ReconciliationReferralAccountResponse = await client.hire.v1.referral_account.areconciliation(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.areconciliation failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.areconciliation failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/recover_application_sample.py b/samples/api/hire/v1/recover_application_sample.py index ec68f1a0c..397351406 100644 --- a/samples/api/hire/v1/recover_application_sample.py +++ b/samples/api/hire/v1/recover_application_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RecoverApplicationRequest = RecoverApplicationRequest.builder() \ - .application_id("12312312312") \ - .build() + # 构造请求对象 + request: RecoverApplicationRequest = RecoverApplicationRequest.builder() \ + .application_id("12312312312") \ + .build() - # 发起请求 - response: RecoverApplicationResponse = client.hire.v1.application.recover(request) + # 发起请求 + response: RecoverApplicationResponse = client.hire.v1.application.recover(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.recover failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.recover failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RecoverApplicationRequest = RecoverApplicationRequest.builder() \ - .application_id("12312312312") \ - .build() + # 构造请求对象 + request: RecoverApplicationRequest = RecoverApplicationRequest.builder() \ + .application_id("12312312312") \ + .build() - # 发起请求 - response: RecoverApplicationResponse = await client.hire.v1.application.arecover(request) + # 发起请求 + response: RecoverApplicationResponse = await client.hire.v1.application.arecover(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.arecover failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.arecover failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/recruiter_job_sample.py b/samples/api/hire/v1/recruiter_job_sample.py index 668c2eb49..a8a675d6c 100644 --- a/samples/api/hire/v1/recruiter_job_sample.py +++ b/samples/api/hire/v1/recruiter_job_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RecruiterJobRequest = RecruiterJobRequest.builder() \ - .job_id("6960663240925956555") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: RecruiterJobRequest = RecruiterJobRequest.builder() \ + .job_id("6960663240925956555") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: RecruiterJobResponse = client.hire.v1.job.recruiter(request) + # 发起请求 + response: RecruiterJobResponse = client.hire.v1.job.recruiter(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.recruiter failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.recruiter failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RecruiterJobRequest = RecruiterJobRequest.builder() \ - .job_id("6960663240925956555") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: RecruiterJobRequest = RecruiterJobRequest.builder() \ + .job_id("6960663240925956555") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: RecruiterJobResponse = await client.hire.v1.job.arecruiter(request) + # 发起请求 + response: RecruiterJobResponse = await client.hire.v1.job.arecruiter(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.arecruiter failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.arecruiter failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_diversity_inclusion_sample.py b/samples/api/hire/v1/search_diversity_inclusion_sample.py index 560de41a9..f6a37e631 100644 --- a/samples/api/hire/v1/search_diversity_inclusion_sample.py +++ b/samples/api/hire/v1/search_diversity_inclusion_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDiversityInclusionRequest = SearchDiversityInclusionRequest.builder() \ - .request_body(SearchDiversityInclusionRequestBody.builder() - .talent_ids([]) - .application_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchDiversityInclusionRequest = SearchDiversityInclusionRequest.builder() \ + .request_body(SearchDiversityInclusionRequestBody.builder() + .talent_ids([]) + .application_ids([]) + .build()) \ + .build() - # 发起请求 - response: SearchDiversityInclusionResponse = client.hire.v1.diversity_inclusion.search(request) + # 发起请求 + response: SearchDiversityInclusionResponse = client.hire.v1.diversity_inclusion.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.diversity_inclusion.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.diversity_inclusion.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchDiversityInclusionRequest = SearchDiversityInclusionRequest.builder() \ - .request_body(SearchDiversityInclusionRequestBody.builder() - .talent_ids([]) - .application_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchDiversityInclusionRequest = SearchDiversityInclusionRequest.builder() \ + .request_body(SearchDiversityInclusionRequestBody.builder() + .talent_ids([]) + .application_ids([]) + .build()) \ + .build() - # 发起请求 - response: SearchDiversityInclusionResponse = await client.hire.v1.diversity_inclusion.asearch(request) + # 发起请求 + response: SearchDiversityInclusionResponse = await client.hire.v1.diversity_inclusion.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.diversity_inclusion.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.diversity_inclusion.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_job_publish_record_sample.py b/samples/api/hire/v1/search_job_publish_record_sample.py index 451a8fe1a..3e6e571b7 100644 --- a/samples/api/hire/v1/search_job_publish_record_sample.py +++ b/samples/api/hire/v1/search_job_publish_record_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchJobPublishRecordRequest = SearchJobPublishRecordRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(SearchJobPublishRecordRequestBody.builder() - .job_channel_id("7047318856652261676") - .build()) \ - .build() + # 构造请求对象 + request: SearchJobPublishRecordRequest = SearchJobPublishRecordRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(SearchJobPublishRecordRequestBody.builder() + .job_channel_id("7047318856652261676") + .build()) \ + .build() - # 发起请求 - response: SearchJobPublishRecordResponse = client.hire.v1.job_publish_record.search(request) + # 发起请求 + response: SearchJobPublishRecordResponse = client.hire.v1.job_publish_record.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_publish_record.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_publish_record.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchJobPublishRecordRequest = SearchJobPublishRecordRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .request_body(SearchJobPublishRecordRequestBody.builder() - .job_channel_id("7047318856652261676") - .build()) \ - .build() + # 构造请求对象 + request: SearchJobPublishRecordRequest = SearchJobPublishRecordRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .request_body(SearchJobPublishRecordRequestBody.builder() + .job_channel_id("7047318856652261676") + .build()) \ + .build() - # 发起请求 - response: SearchJobPublishRecordResponse = await client.hire.v1.job_publish_record.asearch(request) + # 发起请求 + response: SearchJobPublishRecordResponse = await client.hire.v1.job_publish_record.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_publish_record.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_publish_record.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_referral_sample.py b/samples/api/hire/v1/search_referral_sample.py index e421cea52..cd9c2135d 100644 --- a/samples/api/hire/v1/search_referral_sample.py +++ b/samples/api/hire/v1/search_referral_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchReferralRequest = SearchReferralRequest.builder() \ - .user_id_type("open_id") \ - .request_body(SearchReferralRequestBody.builder() - .talent_id("6930815272790114324") - .start_time("str") - .end_time("str") - .build()) \ - .build() + # 构造请求对象 + request: SearchReferralRequest = SearchReferralRequest.builder() \ + .user_id_type("open_id") \ + .request_body(SearchReferralRequestBody.builder() + .talent_id("6930815272790114324") + .start_time("str") + .end_time("str") + .build()) \ + .build() - # 发起请求 - response: SearchReferralResponse = client.hire.v1.referral.search(request) + # 发起请求 + response: SearchReferralResponse = client.hire.v1.referral.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchReferralRequest = SearchReferralRequest.builder() \ - .user_id_type("open_id") \ - .request_body(SearchReferralRequestBody.builder() - .talent_id("6930815272790114324") - .start_time("str") - .end_time("str") - .build()) \ - .build() + # 构造请求对象 + request: SearchReferralRequest = SearchReferralRequest.builder() \ + .user_id_type("open_id") \ + .request_body(SearchReferralRequestBody.builder() + .talent_id("6930815272790114324") + .start_time("str") + .end_time("str") + .build()) \ + .build() - # 发起请求 - response: SearchReferralResponse = await client.hire.v1.referral.asearch(request) + # 发起请求 + response: SearchReferralResponse = await client.hire.v1.referral.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_talent_operation_log_sample.py b/samples/api/hire/v1/search_talent_operation_log_sample.py index af079d7f8..d558bed89 100644 --- a/samples/api/hire/v1/search_talent_operation_log_sample.py +++ b/samples/api/hire/v1/search_talent_operation_log_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTalentOperationLogRequest = SearchTalentOperationLogRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .request_body(SearchTalentOperationLogRequestBody.builder() - .job_id_list([]) - .operator_id_list([]) - .operation_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchTalentOperationLogRequest = SearchTalentOperationLogRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .request_body(SearchTalentOperationLogRequestBody.builder() + .job_id_list([]) + .operator_id_list([]) + .operation_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchTalentOperationLogResponse = client.hire.v1.talent_operation_log.search(request) + # 发起请求 + response: SearchTalentOperationLogResponse = client.hire.v1.talent_operation_log.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_operation_log.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_operation_log.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTalentOperationLogRequest = SearchTalentOperationLogRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .request_body(SearchTalentOperationLogRequestBody.builder() - .job_id_list([]) - .operator_id_list([]) - .operation_list([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchTalentOperationLogRequest = SearchTalentOperationLogRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .request_body(SearchTalentOperationLogRequestBody.builder() + .job_id_list([]) + .operator_id_list([]) + .operation_list([]) + .build()) \ + .build() - # 发起请求 - response: SearchTalentOperationLogResponse = await client.hire.v1.talent_operation_log.asearch(request) + # 发起请求 + response: SearchTalentOperationLogResponse = await client.hire.v1.talent_operation_log.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_operation_log.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_operation_log.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_talent_pool_sample.py b/samples/api/hire/v1/search_talent_pool_sample.py index 071c8483e..272ce1b78 100644 --- a/samples/api/hire/v1/search_talent_pool_sample.py +++ b/samples/api/hire/v1/search_talent_pool_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTalentPoolRequest = SearchTalentPoolRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .id_list([]) \ - .build() + # 构造请求对象 + request: SearchTalentPoolRequest = SearchTalentPoolRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .id_list([]) \ + .build() - # 发起请求 - response: SearchTalentPoolResponse = client.hire.v1.talent_pool.search(request) + # 发起请求 + response: SearchTalentPoolResponse = client.hire.v1.talent_pool.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_pool.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_pool.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTalentPoolRequest = SearchTalentPoolRequest.builder() \ - .page_size(10) \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .id_list([]) \ - .build() + # 构造请求对象 + request: SearchTalentPoolRequest = SearchTalentPoolRequest.builder() \ + .page_size(10) \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .id_list([]) \ + .build() - # 发起请求 - response: SearchTalentPoolResponse = await client.hire.v1.talent_pool.asearch(request) + # 发起请求 + response: SearchTalentPoolResponse = await client.hire.v1.talent_pool.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_pool.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_pool.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_test_sample.py b/samples/api/hire/v1/search_test_sample.py index a3c2d0cb6..24bf28c31 100644 --- a/samples/api/hire/v1/search_test_sample.py +++ b/samples/api/hire/v1/search_test_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTestRequest = SearchTestRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("user_id") \ - .request_body(SearchTestRequestBody.builder() - .application_id_list([]) - .test_start_time_min("1608725989000") - .test_start_time_max("1608726989000") - .build()) \ - .build() + # 构造请求对象 + request: SearchTestRequest = SearchTestRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("user_id") \ + .request_body(SearchTestRequestBody.builder() + .application_id_list([]) + .test_start_time_min("1608725989000") + .test_start_time_max("1608726989000") + .build()) \ + .build() - # 发起请求 - response: SearchTestResponse = client.hire.v1.test.search(request) + # 发起请求 + response: SearchTestResponse = client.hire.v1.test.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.test.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.test.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchTestRequest = SearchTestRequest.builder() \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("user_id") \ - .request_body(SearchTestRequestBody.builder() - .application_id_list([]) - .test_start_time_min("1608725989000") - .test_start_time_max("1608726989000") - .build()) \ - .build() + # 构造请求对象 + request: SearchTestRequest = SearchTestRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("user_id") \ + .request_body(SearchTestRequestBody.builder() + .application_id_list([]) + .test_start_time_min("1608725989000") + .test_start_time_max("1608726989000") + .build()) \ + .build() - # 发起请求 - response: SearchTestResponse = await client.hire.v1.test.asearch(request) + # 发起请求 + response: SearchTestResponse = await client.hire.v1.test.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.test.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.test.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/search_website_job_post_sample.py b/samples/api/hire/v1/search_website_job_post_sample.py index c233a04e2..faa256001 100644 --- a/samples/api/hire/v1/search_website_job_post_sample.py +++ b/samples/api/hire/v1/search_website_job_post_sample.py @@ -5,90 +5,90 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWebsiteJobPostRequest = SearchWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .request_body(SearchWebsiteJobPostRequestBody.builder() - .job_type_id_list([]) - .city_code_list([]) - .job_function_id_list([]) - .subject_id_list([]) - .keyword("HR") - .update_start_time("1618500278663") - .update_end_time("1618500278663") - .create_start_time("1618500278663") - .create_end_time("1618500278663") - .build()) \ - .build() + # 构造请求对象 + request: SearchWebsiteJobPostRequest = SearchWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .request_body(SearchWebsiteJobPostRequestBody.builder() + .job_type_id_list([]) + .city_code_list([]) + .job_function_id_list([]) + .subject_id_list([]) + .keyword("HR") + .update_start_time("1618500278663") + .update_end_time("1618500278663") + .create_start_time("1618500278663") + .create_end_time("1618500278663") + .build()) \ + .build() - # 发起请求 - response: SearchWebsiteJobPostResponse = client.hire.v1.website_job_post.search(request) + # 发起请求 + response: SearchWebsiteJobPostResponse = client.hire.v1.website_job_post.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWebsiteJobPostRequest = SearchWebsiteJobPostRequest.builder() \ - .website_id("111") \ - .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ - .page_size(10) \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .request_body(SearchWebsiteJobPostRequestBody.builder() - .job_type_id_list([]) - .city_code_list([]) - .job_function_id_list([]) - .subject_id_list([]) - .keyword("HR") - .update_start_time("1618500278663") - .update_end_time("1618500278663") - .create_start_time("1618500278663") - .create_end_time("1618500278663") - .build()) \ - .build() + # 构造请求对象 + request: SearchWebsiteJobPostRequest = SearchWebsiteJobPostRequest.builder() \ + .website_id("111") \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .request_body(SearchWebsiteJobPostRequestBody.builder() + .job_type_id_list([]) + .city_code_list([]) + .job_function_id_list([]) + .subject_id_list([]) + .keyword("HR") + .update_start_time("1618500278663") + .update_end_time("1618500278663") + .create_start_time("1618500278663") + .create_end_time("1618500278663") + .build()) \ + .build() - # 发起请求 - response: SearchWebsiteJobPostResponse = await client.hire.v1.website_job_post.asearch(request) + # 发起请求 + response: SearchWebsiteJobPostResponse = await client.hire.v1.website_job_post.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_job_post.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_job_post.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/terminate_application_sample.py b/samples/api/hire/v1/terminate_application_sample.py index 5bb509459..0f8665def 100644 --- a/samples/api/hire/v1/terminate_application_sample.py +++ b/samples/api/hire/v1/terminate_application_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TerminateApplicationRequest = TerminateApplicationRequest.builder() \ - .application_id("12312312312") \ - .request_body(TerminateApplicationRequestBody.builder() - .termination_type(1) - .termination_reason_list([]) - .termination_reason_note("不符合期望") - .build()) \ - .build() + # 构造请求对象 + request: TerminateApplicationRequest = TerminateApplicationRequest.builder() \ + .application_id("12312312312") \ + .request_body(TerminateApplicationRequestBody.builder() + .termination_type(1) + .termination_reason_list([]) + .termination_reason_note("不符合期望") + .build()) \ + .build() - # 发起请求 - response: TerminateApplicationResponse = client.hire.v1.application.terminate(request) + # 发起请求 + response: TerminateApplicationResponse = client.hire.v1.application.terminate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.terminate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.terminate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TerminateApplicationRequest = TerminateApplicationRequest.builder() \ - .application_id("12312312312") \ - .request_body(TerminateApplicationRequestBody.builder() - .termination_type(1) - .termination_reason_list([]) - .termination_reason_note("不符合期望") - .build()) \ - .build() + # 构造请求对象 + request: TerminateApplicationRequest = TerminateApplicationRequest.builder() \ + .application_id("12312312312") \ + .request_body(TerminateApplicationRequestBody.builder() + .termination_type(1) + .termination_reason_list([]) + .termination_reason_note("不符合期望") + .build()) \ + .build() - # 发起请求 - response: TerminateApplicationResponse = await client.hire.v1.application.aterminate(request) + # 发起请求 + response: TerminateApplicationResponse = await client.hire.v1.application.aterminate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.aterminate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.aterminate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/transfer_onboard_application_sample.py b/samples/api/hire/v1/transfer_onboard_application_sample.py index 1ebea698f..c62ae3191 100644 --- a/samples/api/hire/v1/transfer_onboard_application_sample.py +++ b/samples/api/hire/v1/transfer_onboard_application_sample.py @@ -5,92 +5,92 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferOnboardApplicationRequest = TransferOnboardApplicationRequest.builder() \ - .application_id("7073372582620416300") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(TransferOnboardApplicationRequestBody.builder() - .actual_onboard_time(0) - .expected_conversion_time(0) - .job_requirement_id("6960663240925956402") - .operator_id("ou-xxx") - .onboard_city_code("CT_2") - .department("6966123381141866028") - .leader("ou-xxx") - .sequence("7006234385490345986") - .level("6937934036379650311") - .employee_type("1") - .build()) \ - .build() + # 构造请求对象 + request: TransferOnboardApplicationRequest = TransferOnboardApplicationRequest.builder() \ + .application_id("7073372582620416300") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(TransferOnboardApplicationRequestBody.builder() + .actual_onboard_time(0) + .expected_conversion_time(0) + .job_requirement_id("6960663240925956402") + .operator_id("ou-xxx") + .onboard_city_code("CT_2") + .department("6966123381141866028") + .leader("ou-xxx") + .sequence("7006234385490345986") + .level("6937934036379650311") + .employee_type("1") + .build()) \ + .build() - # 发起请求 - response: TransferOnboardApplicationResponse = client.hire.v1.application.transfer_onboard(request) + # 发起请求 + response: TransferOnboardApplicationResponse = client.hire.v1.application.transfer_onboard(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.transfer_onboard failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.transfer_onboard failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferOnboardApplicationRequest = TransferOnboardApplicationRequest.builder() \ - .application_id("7073372582620416300") \ - .user_id_type("open_id") \ - .department_id_type("people_admin_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(TransferOnboardApplicationRequestBody.builder() - .actual_onboard_time(0) - .expected_conversion_time(0) - .job_requirement_id("6960663240925956402") - .operator_id("ou-xxx") - .onboard_city_code("CT_2") - .department("6966123381141866028") - .leader("ou-xxx") - .sequence("7006234385490345986") - .level("6937934036379650311") - .employee_type("1") - .build()) \ - .build() + # 构造请求对象 + request: TransferOnboardApplicationRequest = TransferOnboardApplicationRequest.builder() \ + .application_id("7073372582620416300") \ + .user_id_type("open_id") \ + .department_id_type("people_admin_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(TransferOnboardApplicationRequestBody.builder() + .actual_onboard_time(0) + .expected_conversion_time(0) + .job_requirement_id("6960663240925956402") + .operator_id("ou-xxx") + .onboard_city_code("CT_2") + .department("6966123381141866028") + .leader("ou-xxx") + .sequence("7006234385490345986") + .level("6937934036379650311") + .employee_type("1") + .build()) \ + .build() - # 发起请求 - response: TransferOnboardApplicationResponse = await client.hire.v1.application.atransfer_onboard(request) + # 发起请求 + response: TransferOnboardApplicationResponse = await client.hire.v1.application.atransfer_onboard(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.atransfer_onboard failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.atransfer_onboard failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/transfer_stage_application_sample.py b/samples/api/hire/v1/transfer_stage_application_sample.py index f743a9e54..f37145546 100644 --- a/samples/api/hire/v1/transfer_stage_application_sample.py +++ b/samples/api/hire/v1/transfer_stage_application_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferStageApplicationRequest = TransferStageApplicationRequest.builder() \ - .application_id("6960663240925956401") \ - .request_body(TransferStageApplicationRequestBody.builder() - .stage_id("6960663240925956402") - .build()) \ - .build() + # 构造请求对象 + request: TransferStageApplicationRequest = TransferStageApplicationRequest.builder() \ + .application_id("6960663240925956401") \ + .request_body(TransferStageApplicationRequestBody.builder() + .stage_id("6960663240925956402") + .build()) \ + .build() - # 发起请求 - response: TransferStageApplicationResponse = client.hire.v1.application.transfer_stage(request) + # 发起请求 + response: TransferStageApplicationResponse = client.hire.v1.application.transfer_stage(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.transfer_stage failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.transfer_stage failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TransferStageApplicationRequest = TransferStageApplicationRequest.builder() \ - .application_id("6960663240925956401") \ - .request_body(TransferStageApplicationRequestBody.builder() - .stage_id("6960663240925956402") - .build()) \ - .build() + # 构造请求对象 + request: TransferStageApplicationRequest = TransferStageApplicationRequest.builder() \ + .application_id("6960663240925956401") \ + .request_body(TransferStageApplicationRequestBody.builder() + .stage_id("6960663240925956402") + .build()) \ + .build() - # 发起请求 - response: TransferStageApplicationResponse = await client.hire.v1.application.atransfer_stage(request) + # 发起请求 + response: TransferStageApplicationResponse = await client.hire.v1.application.atransfer_stage(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.application.atransfer_stage failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.application.atransfer_stage failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_config_job_sample.py b/samples/api/hire/v1/update_config_job_sample.py index eaf1a9016..17b2a3ed7 100644 --- a/samples/api/hire/v1/update_config_job_sample.py +++ b/samples/api/hire/v1/update_config_job_sample.py @@ -5,88 +5,88 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateConfigJobRequest = UpdateConfigJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("user_id") \ - .request_body(JobConfig.builder() - .offer_apply_schema_id("6960663240925956573") - .offer_process_conf("6960663240925956572") - .recommended_evaluator_id_list([]) - .update_option_list([]) - .assessment_template_biz_id("6960663240925956571") - .interview_round_conf_list([]) - .jr_id_list([]) - .interview_registration_schema_id("6930815272790114324") - .onboard_registration_schema_id("6930815272790114324") - .interview_round_type_conf_list([]) - .related_job_id_list([]) - .interview_appointment_config(InterviewAppointmentConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateConfigJobRequest = UpdateConfigJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("user_id") \ + .request_body(JobConfig.builder() + .offer_apply_schema_id("6960663240925956573") + .offer_process_conf("6960663240925956572") + .recommended_evaluator_id_list([]) + .update_option_list([]) + .assessment_template_biz_id("6960663240925956571") + .interview_round_conf_list([]) + .jr_id_list([]) + .interview_registration_schema_id("6930815272790114324") + .onboard_registration_schema_id("6930815272790114324") + .interview_round_type_conf_list([]) + .related_job_id_list([]) + .interview_appointment_config(InterviewAppointmentConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateConfigJobResponse = client.hire.v1.job.update_config(request) + # 发起请求 + response: UpdateConfigJobResponse = client.hire.v1.job.update_config(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.update_config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.update_config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateConfigJobRequest = UpdateConfigJobRequest.builder() \ - .job_id("6960663240925956660") \ - .user_id_type("user_id") \ - .request_body(JobConfig.builder() - .offer_apply_schema_id("6960663240925956573") - .offer_process_conf("6960663240925956572") - .recommended_evaluator_id_list([]) - .update_option_list([]) - .assessment_template_biz_id("6960663240925956571") - .interview_round_conf_list([]) - .jr_id_list([]) - .interview_registration_schema_id("6930815272790114324") - .onboard_registration_schema_id("6930815272790114324") - .interview_round_type_conf_list([]) - .related_job_id_list([]) - .interview_appointment_config(InterviewAppointmentConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateConfigJobRequest = UpdateConfigJobRequest.builder() \ + .job_id("6960663240925956660") \ + .user_id_type("user_id") \ + .request_body(JobConfig.builder() + .offer_apply_schema_id("6960663240925956573") + .offer_process_conf("6960663240925956572") + .recommended_evaluator_id_list([]) + .update_option_list([]) + .assessment_template_biz_id("6960663240925956571") + .interview_round_conf_list([]) + .jr_id_list([]) + .interview_registration_schema_id("6930815272790114324") + .onboard_registration_schema_id("6930815272790114324") + .interview_round_type_conf_list([]) + .related_job_id_list([]) + .interview_appointment_config(InterviewAppointmentConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateConfigJobResponse = await client.hire.v1.job.aupdate_config(request) + # 发起请求 + response: UpdateConfigJobResponse = await client.hire.v1.job.aupdate_config(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job.aupdate_config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job.aupdate_config failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_external_application_sample.py b/samples/api/hire/v1/update_external_application_sample.py index 5a1fa7079..9a231cc0d 100644 --- a/samples/api/hire/v1/update_external_application_sample.py +++ b/samples/api/hire/v1/update_external_application_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateExternalApplicationRequest = UpdateExternalApplicationRequest.builder() \ - .external_application_id("6960663240925956660") \ - .request_body(ExternalApplication.builder() - .external_id("123") - .job_recruitment_type(1) - .job_title("高级Java") - .resume_source("lagou") - .stage("1") - .talent_id("6960663240925956459") - .termination_reason("不合适") - .delivery_type(1) - .modify_time(1618500278645) - .create_time(1618500278644) - .termination_type("health") - .build()) \ - .build() + # 构造请求对象 + request: UpdateExternalApplicationRequest = UpdateExternalApplicationRequest.builder() \ + .external_application_id("6960663240925956660") \ + .request_body(ExternalApplication.builder() + .external_id("123") + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .talent_id("6960663240925956459") + .termination_reason("不合适") + .delivery_type(1) + .modify_time(1618500278645) + .create_time(1618500278644) + .termination_type("health") + .build()) \ + .build() - # 发起请求 - response: UpdateExternalApplicationResponse = client.hire.v1.external_application.update(request) + # 发起请求 + response: UpdateExternalApplicationResponse = client.hire.v1.external_application.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateExternalApplicationRequest = UpdateExternalApplicationRequest.builder() \ - .external_application_id("6960663240925956660") \ - .request_body(ExternalApplication.builder() - .external_id("123") - .job_recruitment_type(1) - .job_title("高级Java") - .resume_source("lagou") - .stage("1") - .talent_id("6960663240925956459") - .termination_reason("不合适") - .delivery_type(1) - .modify_time(1618500278645) - .create_time(1618500278644) - .termination_type("health") - .build()) \ - .build() + # 构造请求对象 + request: UpdateExternalApplicationRequest = UpdateExternalApplicationRequest.builder() \ + .external_application_id("6960663240925956660") \ + .request_body(ExternalApplication.builder() + .external_id("123") + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .talent_id("6960663240925956459") + .termination_reason("不合适") + .delivery_type(1) + .modify_time(1618500278645) + .create_time(1618500278644) + .termination_type("health") + .build()) \ + .build() - # 发起请求 - response: UpdateExternalApplicationResponse = await client.hire.v1.external_application.aupdate(request) + # 发起请求 + response: UpdateExternalApplicationResponse = await client.hire.v1.external_application.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.external_application.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.external_application.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_job_requirement_sample.py b/samples/api/hire/v1/update_job_requirement_sample.py index 528d6cf9d..162c4b289 100644 --- a/samples/api/hire/v1/update_job_requirement_sample.py +++ b/samples/api/hire/v1/update_job_requirement_sample.py @@ -5,120 +5,120 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobRequirementRequest = UpdateJobRequirementRequest.builder() \ - .job_requirement_id("623455234") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(JobRequirement.builder() - .name("test") - .display_progress(1) - .head_count(11) - .recruitment_type_id("1618209327096") - .employee_type_id("6807409776231254285") - .max_level_id("123") - .min_level_id("11") - .sequence_id("111") - .category(1) - .department_id("1111") - .recruiter_id_list([]) - .jr_hiring_manager_id_list([]) - .direct_leader_id_list([]) - .start_time("1625729379000") - .deadline("1625729379000") - .priority(1) - .required_degree(1) - .max_salary("123") - .min_salary("11") - .address_id("11") - .description("11") - .customized_data_list([]) - .process_type(1) - .job_type_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobRequirementRequest = UpdateJobRequirementRequest.builder() \ + .job_requirement_id("623455234") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(JobRequirement.builder() + .name("test") + .display_progress(1) + .head_count(11) + .recruitment_type_id("1618209327096") + .employee_type_id("6807409776231254285") + .max_level_id("123") + .min_level_id("11") + .sequence_id("111") + .category(1) + .department_id("1111") + .recruiter_id_list([]) + .jr_hiring_manager_id_list([]) + .direct_leader_id_list([]) + .start_time("1625729379000") + .deadline("1625729379000") + .priority(1) + .required_degree(1) + .max_salary("123") + .min_salary("11") + .address_id("11") + .description("11") + .customized_data_list([]) + .process_type(1) + .job_type_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: UpdateJobRequirementResponse = client.hire.v1.job_requirement.update(request) + # 发起请求 + response: UpdateJobRequirementResponse = client.hire.v1.job_requirement.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateJobRequirementRequest = UpdateJobRequirementRequest.builder() \ - .job_requirement_id("623455234") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(JobRequirement.builder() - .name("test") - .display_progress(1) - .head_count(11) - .recruitment_type_id("1618209327096") - .employee_type_id("6807409776231254285") - .max_level_id("123") - .min_level_id("11") - .sequence_id("111") - .category(1) - .department_id("1111") - .recruiter_id_list([]) - .jr_hiring_manager_id_list([]) - .direct_leader_id_list([]) - .start_time("1625729379000") - .deadline("1625729379000") - .priority(1) - .required_degree(1) - .max_salary("123") - .min_salary("11") - .address_id("11") - .description("11") - .customized_data_list([]) - .process_type(1) - .job_type_id("6930815272790114324") - .build()) \ - .build() + # 构造请求对象 + request: UpdateJobRequirementRequest = UpdateJobRequirementRequest.builder() \ + .job_requirement_id("623455234") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(JobRequirement.builder() + .name("test") + .display_progress(1) + .head_count(11) + .recruitment_type_id("1618209327096") + .employee_type_id("6807409776231254285") + .max_level_id("123") + .min_level_id("11") + .sequence_id("111") + .category(1) + .department_id("1111") + .recruiter_id_list([]) + .jr_hiring_manager_id_list([]) + .direct_leader_id_list([]) + .start_time("1625729379000") + .deadline("1625729379000") + .priority(1) + .required_degree(1) + .max_salary("123") + .min_salary("11") + .address_id("11") + .description("11") + .customized_data_list([]) + .process_type(1) + .job_type_id("6930815272790114324") + .build()) \ + .build() - # 发起请求 - response: UpdateJobRequirementResponse = await client.hire.v1.job_requirement.aupdate(request) + # 发起请求 + response: UpdateJobRequirementResponse = await client.hire.v1.job_requirement.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.job_requirement.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.job_requirement.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_offer_custom_field_sample.py b/samples/api/hire/v1/update_offer_custom_field_sample.py index ee92375b2..12cd33b14 100644 --- a/samples/api/hire/v1/update_offer_custom_field_sample.py +++ b/samples/api/hire/v1/update_offer_custom_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateOfferCustomFieldRequest = UpdateOfferCustomFieldRequest.builder() \ - .offer_custom_field_id("6906755946257615112") \ - .request_body(OfferCustomField.builder() - .name(I18n.builder().build()) - .config(OfferCustomFieldConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateOfferCustomFieldRequest = UpdateOfferCustomFieldRequest.builder() \ + .offer_custom_field_id("6906755946257615112") \ + .request_body(OfferCustomField.builder() + .name(I18n.builder().build()) + .config(OfferCustomFieldConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateOfferCustomFieldResponse = client.hire.v1.offer_custom_field.update(request) + # 发起请求 + response: UpdateOfferCustomFieldResponse = client.hire.v1.offer_custom_field.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_custom_field.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_custom_field.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateOfferCustomFieldRequest = UpdateOfferCustomFieldRequest.builder() \ - .offer_custom_field_id("6906755946257615112") \ - .request_body(OfferCustomField.builder() - .name(I18n.builder().build()) - .config(OfferCustomFieldConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateOfferCustomFieldRequest = UpdateOfferCustomFieldRequest.builder() \ + .offer_custom_field_id("6906755946257615112") \ + .request_body(OfferCustomField.builder() + .name(I18n.builder().build()) + .config(OfferCustomFieldConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateOfferCustomFieldResponse = await client.hire.v1.offer_custom_field.aupdate(request) + # 发起请求 + response: UpdateOfferCustomFieldResponse = await client.hire.v1.offer_custom_field.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer_custom_field.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer_custom_field.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_offer_sample.py b/samples/api/hire/v1/update_offer_sample.py index 786a31a48..246fc5019 100644 --- a/samples/api/hire/v1/update_offer_sample.py +++ b/samples/api/hire/v1/update_offer_sample.py @@ -5,80 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateOfferRequest = UpdateOfferRequest.builder() \ - .offer_id("7016605170635213100") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(OfferInfo.builder() - .schema_id("7013318077945596204") - .basic_info(OfferBasicInfo.builder().build()) - .salary_info(OfferSalaryInfo.builder().build()) - .customized_info_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateOfferRequest = UpdateOfferRequest.builder() \ + .offer_id("7016605170635213100") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(OfferInfo.builder() + .schema_id("7013318077945596204") + .basic_info(OfferBasicInfo.builder().build()) + .salary_info(OfferSalaryInfo.builder().build()) + .customized_info_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateOfferResponse = client.hire.v1.offer.update(request) + # 发起请求 + response: UpdateOfferResponse = client.hire.v1.offer.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateOfferRequest = UpdateOfferRequest.builder() \ - .offer_id("7016605170635213100") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .job_level_id_type("people_admin_job_level_id") \ - .job_family_id_type("people_admin_job_category_id") \ - .employee_type_id_type("people_admin_employee_type_id") \ - .request_body(OfferInfo.builder() - .schema_id("7013318077945596204") - .basic_info(OfferBasicInfo.builder().build()) - .salary_info(OfferSalaryInfo.builder().build()) - .customized_info_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateOfferRequest = UpdateOfferRequest.builder() \ + .offer_id("7016605170635213100") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .job_level_id_type("people_admin_job_level_id") \ + .job_family_id_type("people_admin_job_category_id") \ + .employee_type_id_type("people_admin_employee_type_id") \ + .request_body(OfferInfo.builder() + .schema_id("7013318077945596204") + .basic_info(OfferBasicInfo.builder().build()) + .salary_info(OfferSalaryInfo.builder().build()) + .customized_info_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateOfferResponse = await client.hire.v1.offer.aupdate(request) + # 发起请求 + response: UpdateOfferResponse = await client.hire.v1.offer.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.offer.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.offer.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_progress_eco_background_check_sample.py b/samples/api/hire/v1/update_progress_eco_background_check_sample.py index 01b6da0c8..039f8949b 100644 --- a/samples/api/hire/v1/update_progress_eco_background_check_sample.py +++ b/samples/api/hire/v1/update_progress_eco_background_check_sample.py @@ -5,75 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProgressEcoBackgroundCheckRequest = UpdateProgressEcoBackgroundCheckRequest.builder() \ - .request_body(UpdateProgressEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .stage_id("6931286400470354183") - .stage_en_name("stage report") - .stage_name("阶段报告") - .stage_time("1660123456789") - .result("通过") - .report_file_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProgressEcoBackgroundCheckRequest = UpdateProgressEcoBackgroundCheckRequest.builder() \ + .request_body(UpdateProgressEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .stage_id("6931286400470354183") + .stage_en_name("stage report") + .stage_name("阶段报告") + .stage_time("1660123456789") + .result("通过") + .report_file_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateProgressEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.update_progress(request) + # 发起请求 + response: UpdateProgressEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.update_progress(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.update_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.update_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProgressEcoBackgroundCheckRequest = UpdateProgressEcoBackgroundCheckRequest.builder() \ - .request_body(UpdateProgressEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .stage_id("6931286400470354183") - .stage_en_name("stage report") - .stage_name("阶段报告") - .stage_time("1660123456789") - .result("通过") - .report_file_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProgressEcoBackgroundCheckRequest = UpdateProgressEcoBackgroundCheckRequest.builder() \ + .request_body(UpdateProgressEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .stage_id("6931286400470354183") + .stage_en_name("stage report") + .stage_name("阶段报告") + .stage_time("1660123456789") + .result("通过") + .report_file_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateProgressEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.aupdate_progress( - request) + # 发起请求 + response: UpdateProgressEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.aupdate_progress(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.aupdate_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.aupdate_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_result_eco_background_check_sample.py b/samples/api/hire/v1/update_result_eco_background_check_sample.py index 70f0df8ef..63057b6f8 100644 --- a/samples/api/hire/v1/update_result_eco_background_check_sample.py +++ b/samples/api/hire/v1/update_result_eco_background_check_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateResultEcoBackgroundCheckRequest = UpdateResultEcoBackgroundCheckRequest.builder() \ - .request_body(UpdateResultEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .result("无差异") - .result_time("1660123456789") - .report_file_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateResultEcoBackgroundCheckRequest = UpdateResultEcoBackgroundCheckRequest.builder() \ + .request_body(UpdateResultEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .result("无差异") + .result_time("1660123456789") + .report_file_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateResultEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.update_result(request) + # 发起请求 + response: UpdateResultEcoBackgroundCheckResponse = client.hire.v1.eco_background_check.update_result(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.update_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.update_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateResultEcoBackgroundCheckRequest = UpdateResultEcoBackgroundCheckRequest.builder() \ - .request_body(UpdateResultEcoBackgroundCheckRequestBody.builder() - .background_check_id("6931286400470354183") - .result("无差异") - .result_time("1660123456789") - .report_file_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateResultEcoBackgroundCheckRequest = UpdateResultEcoBackgroundCheckRequest.builder() \ + .request_body(UpdateResultEcoBackgroundCheckRequestBody.builder() + .background_check_id("6931286400470354183") + .result("无差异") + .result_time("1660123456789") + .report_file_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateResultEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.aupdate_result(request) + # 发起请求 + response: UpdateResultEcoBackgroundCheckResponse = await client.hire.v1.eco_background_check.aupdate_result(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_background_check.aupdate_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_background_check.aupdate_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_result_eco_exam_sample.py b/samples/api/hire/v1/update_result_eco_exam_sample.py index 6bde8bfd7..3755e5ad8 100644 --- a/samples/api/hire/v1/update_result_eco_exam_sample.py +++ b/samples/api/hire/v1/update_result_eco_exam_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateResultEcoExamRequest = UpdateResultEcoExamRequest.builder() \ - .exam_id("7178536692385679677") \ - .request_body(EcoExamResult.builder() - .result("60.5") - .result_time("1658676234053") - .report_list([]) - .detail_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateResultEcoExamRequest = UpdateResultEcoExamRequest.builder() \ + .exam_id("7178536692385679677") \ + .request_body(EcoExamResult.builder() + .result("60.5") + .result_time("1658676234053") + .report_list([]) + .detail_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateResultEcoExamResponse = client.hire.v1.eco_exam.update_result(request) + # 发起请求 + response: UpdateResultEcoExamResponse = client.hire.v1.eco_exam.update_result(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam.update_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam.update_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateResultEcoExamRequest = UpdateResultEcoExamRequest.builder() \ - .exam_id("7178536692385679677") \ - .request_body(EcoExamResult.builder() - .result("60.5") - .result_time("1658676234053") - .report_list([]) - .detail_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateResultEcoExamRequest = UpdateResultEcoExamRequest.builder() \ + .exam_id("7178536692385679677") \ + .request_body(EcoExamResult.builder() + .result("60.5") + .result_time("1658676234053") + .report_list([]) + .detail_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateResultEcoExamResponse = await client.hire.v1.eco_exam.aupdate_result(request) + # 发起请求 + response: UpdateResultEcoExamResponse = await client.hire.v1.eco_exam.aupdate_result(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.eco_exam.aupdate_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.eco_exam.aupdate_result failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_talent_external_info_sample.py b/samples/api/hire/v1/update_talent_external_info_sample.py index 739c86a77..b4afe2d77 100644 --- a/samples/api/hire/v1/update_talent_external_info_sample.py +++ b/samples/api/hire/v1/update_talent_external_info_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTalentExternalInfoRequest = UpdateTalentExternalInfoRequest.builder() \ - .talent_id("7043758982146345223") \ - .request_body(UpdateTalentExternalInfoRequestBody.builder() - .external_create_time("1639992265035") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTalentExternalInfoRequest = UpdateTalentExternalInfoRequest.builder() \ + .talent_id("7043758982146345223") \ + .request_body(UpdateTalentExternalInfoRequestBody.builder() + .external_create_time("1639992265035") + .build()) \ + .build() - # 发起请求 - response: UpdateTalentExternalInfoResponse = client.hire.v1.talent_external_info.update(request) + # 发起请求 + response: UpdateTalentExternalInfoResponse = client.hire.v1.talent_external_info.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_external_info.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_external_info.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTalentExternalInfoRequest = UpdateTalentExternalInfoRequest.builder() \ - .talent_id("7043758982146345223") \ - .request_body(UpdateTalentExternalInfoRequestBody.builder() - .external_create_time("1639992265035") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTalentExternalInfoRequest = UpdateTalentExternalInfoRequest.builder() \ + .talent_id("7043758982146345223") \ + .request_body(UpdateTalentExternalInfoRequestBody.builder() + .external_create_time("1639992265035") + .build()) \ + .build() - # 发起请求 - response: UpdateTalentExternalInfoResponse = await client.hire.v1.talent_external_info.aupdate(request) + # 发起请求 + response: UpdateTalentExternalInfoResponse = await client.hire.v1.talent_external_info.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.talent_external_info.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.talent_external_info.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_tripartite_agreement_sample.py b/samples/api/hire/v1/update_tripartite_agreement_sample.py index 4a61b1c39..618f4e1d7 100644 --- a/samples/api/hire/v1/update_tripartite_agreement_sample.py +++ b/samples/api/hire/v1/update_tripartite_agreement_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTripartiteAgreementRequest = UpdateTripartiteAgreementRequest.builder() \ - .tripartite_agreement_id("str") \ - .request_body(TripartiteAgreementInfo.builder() - .state(1) - .modify_time("1698292282661") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTripartiteAgreementRequest = UpdateTripartiteAgreementRequest.builder() \ + .tripartite_agreement_id("str") \ + .request_body(TripartiteAgreementInfo.builder() + .state(1) + .modify_time("1698292282661") + .build()) \ + .build() - # 发起请求 - response: UpdateTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.update(request) + # 发起请求 + response: UpdateTripartiteAgreementResponse = client.hire.v1.tripartite_agreement.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTripartiteAgreementRequest = UpdateTripartiteAgreementRequest.builder() \ - .tripartite_agreement_id("str") \ - .request_body(TripartiteAgreementInfo.builder() - .state(1) - .modify_time("1698292282661") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTripartiteAgreementRequest = UpdateTripartiteAgreementRequest.builder() \ + .tripartite_agreement_id("str") \ + .request_body(TripartiteAgreementInfo.builder() + .state(1) + .modify_time("1698292282661") + .build()) \ + .build() - # 发起请求 - response: UpdateTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.aupdate(request) + # 发起请求 + response: UpdateTripartiteAgreementResponse = await client.hire.v1.tripartite_agreement.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.tripartite_agreement.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.tripartite_agreement.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/update_website_channel_sample.py b/samples/api/hire/v1/update_website_channel_sample.py index 9406bc57c..cf9da3dc1 100644 --- a/samples/api/hire/v1/update_website_channel_sample.py +++ b/samples/api/hire/v1/update_website_channel_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateWebsiteChannelRequest = UpdateWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .channel_id("7085989097067563300") \ - .request_body(UpdateWebsiteChannelRequestBody.builder() - .channel_name("小爱侧推广渠道") - .build()) \ - .build() + # 构造请求对象 + request: UpdateWebsiteChannelRequest = UpdateWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .channel_id("7085989097067563300") \ + .request_body(UpdateWebsiteChannelRequestBody.builder() + .channel_name("小爱侧推广渠道") + .build()) \ + .build() - # 发起请求 - response: UpdateWebsiteChannelResponse = client.hire.v1.website_channel.update(request) + # 发起请求 + response: UpdateWebsiteChannelResponse = client.hire.v1.website_channel.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateWebsiteChannelRequest = UpdateWebsiteChannelRequest.builder() \ - .website_id("1618209327096") \ - .channel_id("7085989097067563300") \ - .request_body(UpdateWebsiteChannelRequestBody.builder() - .channel_name("小爱侧推广渠道") - .build()) \ - .build() + # 构造请求对象 + request: UpdateWebsiteChannelRequest = UpdateWebsiteChannelRequest.builder() \ + .website_id("1618209327096") \ + .channel_id("7085989097067563300") \ + .request_body(UpdateWebsiteChannelRequestBody.builder() + .channel_name("小爱侧推广渠道") + .build()) \ + .build() - # 发起请求 - response: UpdateWebsiteChannelResponse = await client.hire.v1.website_channel.aupdate(request) + # 发起请求 + response: UpdateWebsiteChannelResponse = await client.hire.v1.website_channel.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.website_channel.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.website_channel.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/hire/v1/withdraw_referral_account_sample.py b/samples/api/hire/v1/withdraw_referral_account_sample.py index 830c11580..388a38e11 100644 --- a/samples/api/hire/v1/withdraw_referral_account_sample.py +++ b/samples/api/hire/v1/withdraw_referral_account_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: WithdrawReferralAccountRequest = WithdrawReferralAccountRequest.builder() \ - .referral_account_id("6942778198054125570") \ - .request_body(WithdrawReferralAccountRequestBody.builder() - .withdraw_bonus_type([]) - .external_order_id("6942778198054125570") - .build()) \ - .build() + # 构造请求对象 + request: WithdrawReferralAccountRequest = WithdrawReferralAccountRequest.builder() \ + .referral_account_id("6942778198054125570") \ + .request_body(WithdrawReferralAccountRequestBody.builder() + .withdraw_bonus_type([]) + .external_order_id("6942778198054125570") + .build()) \ + .build() - # 发起请求 - response: WithdrawReferralAccountResponse = client.hire.v1.referral_account.withdraw(request) + # 发起请求 + response: WithdrawReferralAccountResponse = client.hire.v1.referral_account.withdraw(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.withdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.withdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: WithdrawReferralAccountRequest = WithdrawReferralAccountRequest.builder() \ - .referral_account_id("6942778198054125570") \ - .request_body(WithdrawReferralAccountRequestBody.builder() - .withdraw_bonus_type([]) - .external_order_id("6942778198054125570") - .build()) \ - .build() + # 构造请求对象 + request: WithdrawReferralAccountRequest = WithdrawReferralAccountRequest.builder() \ + .referral_account_id("6942778198054125570") \ + .request_body(WithdrawReferralAccountRequestBody.builder() + .withdraw_bonus_type([]) + .external_order_id("6942778198054125570") + .build()) \ + .build() - # 发起请求 - response: WithdrawReferralAccountResponse = await client.hire.v1.referral_account.awithdraw(request) + # 发起请求 + response: WithdrawReferralAccountResponse = await client.hire.v1.referral_account.awithdraw(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.hire.v1.referral_account.awithdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.referral_account.awithdraw failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/human_authentication/v1/create_identity_sample.py b/samples/api/human_authentication/v1/create_identity_sample.py index 78a2db53a..438c2889d 100644 --- a/samples/api/human_authentication/v1/create_identity_sample.py +++ b/samples/api/human_authentication/v1/create_identity_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateIdentityRequest = CreateIdentityRequest.builder() \ - .user_id("ou_2eb5483cb377daa5054bc6f86e2089a5") \ - .user_id_type("open_id") \ - .request_body(CreateIdentityRequestBody.builder() - .identity_name("张三") - .identity_code("4xxxxxxxx") - .mobile("13xxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateIdentityRequest = CreateIdentityRequest.builder() \ + .user_id("ou_2eb5483cb377daa5054bc6f86e2089a5") \ + .user_id_type("open_id") \ + .request_body(CreateIdentityRequestBody.builder() + .identity_name("张三") + .identity_code("4xxxxxxxx") + .mobile("13xxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateIdentityResponse = client.human_authentication.v1.identity.create(request) + # 发起请求 + response: CreateIdentityResponse = client.human_authentication.v1.identity.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.human_authentication.v1.identity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.human_authentication.v1.identity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateIdentityRequest = CreateIdentityRequest.builder() \ - .user_id("ou_2eb5483cb377daa5054bc6f86e2089a5") \ - .user_id_type("open_id") \ - .request_body(CreateIdentityRequestBody.builder() - .identity_name("张三") - .identity_code("4xxxxxxxx") - .mobile("13xxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateIdentityRequest = CreateIdentityRequest.builder() \ + .user_id("ou_2eb5483cb377daa5054bc6f86e2089a5") \ + .user_id_type("open_id") \ + .request_body(CreateIdentityRequestBody.builder() + .identity_name("张三") + .identity_code("4xxxxxxxx") + .mobile("13xxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateIdentityResponse = await client.human_authentication.v1.identity.acreate(request) + # 发起请求 + response: CreateIdentityResponse = await client.human_authentication.v1.identity.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.human_authentication.v1.identity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.human_authentication.v1.identity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/add_managers_chat_managers_sample.py b/samples/api/im/v1/add_managers_chat_managers_sample.py index cecb55ca1..f14510e06 100644 --- a/samples/api/im/v1/add_managers_chat_managers_sample.py +++ b/samples/api/im/v1/add_managers_chat_managers_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddManagersChatManagersRequest = AddManagersChatManagersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(AddManagersChatManagersRequestBody.builder() - .manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: AddManagersChatManagersRequest = AddManagersChatManagersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(AddManagersChatManagersRequestBody.builder() + .manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: AddManagersChatManagersResponse = client.im.v1.chat_managers.add_managers(request) + # 发起请求 + response: AddManagersChatManagersResponse = client.im.v1.chat_managers.add_managers(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_managers.add_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_managers.add_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddManagersChatManagersRequest = AddManagersChatManagersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(AddManagersChatManagersRequestBody.builder() - .manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: AddManagersChatManagersRequest = AddManagersChatManagersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(AddManagersChatManagersRequestBody.builder() + .manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: AddManagersChatManagersResponse = await client.im.v1.chat_managers.aadd_managers(request) + # 发起请求 + response: AddManagersChatManagersResponse = await client.im.v1.chat_managers.aadd_managers(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_managers.aadd_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_managers.aadd_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_chat_members_sample.py b/samples/api/im/v1/create_chat_members_sample.py index 4d6584d2c..b23112502 100644 --- a/samples/api/im/v1/create_chat_members_sample.py +++ b/samples/api/im/v1/create_chat_members_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatMembersRequest = CreateChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .succeed_type(0) \ - .request_body(CreateChatMembersRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatMembersRequest = CreateChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .succeed_type(0) \ + .request_body(CreateChatMembersRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateChatMembersResponse = client.im.v1.chat_members.create(request) + # 发起请求 + response: CreateChatMembersResponse = client.im.v1.chat_members.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatMembersRequest = CreateChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .succeed_type(0) \ - .request_body(CreateChatMembersRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatMembersRequest = CreateChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .succeed_type(0) \ + .request_body(CreateChatMembersRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateChatMembersResponse = await client.im.v1.chat_members.acreate(request) + # 发起请求 + response: CreateChatMembersResponse = await client.im.v1.chat_members.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_chat_menu_tree_sample.py b/samples/api/im/v1/create_chat_menu_tree_sample.py index bd4e7532c..954c18235 100644 --- a/samples/api/im/v1/create_chat_menu_tree_sample.py +++ b/samples/api/im/v1/create_chat_menu_tree_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatMenuTreeRequest = CreateChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(CreateChatMenuTreeRequestBody.builder() - .menu_tree(ChatMenuTree.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatMenuTreeRequest = CreateChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(CreateChatMenuTreeRequestBody.builder() + .menu_tree(ChatMenuTree.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateChatMenuTreeResponse = client.im.v1.chat_menu_tree.create(request) + # 发起请求 + response: CreateChatMenuTreeResponse = client.im.v1.chat_menu_tree.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatMenuTreeRequest = CreateChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(CreateChatMenuTreeRequestBody.builder() - .menu_tree(ChatMenuTree.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatMenuTreeRequest = CreateChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(CreateChatMenuTreeRequestBody.builder() + .menu_tree(ChatMenuTree.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateChatMenuTreeResponse = await client.im.v1.chat_menu_tree.acreate(request) + # 发起请求 + response: CreateChatMenuTreeResponse = await client.im.v1.chat_menu_tree.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_chat_sample.py b/samples/api/im/v1/create_chat_sample.py index 255475c20..9dd655ebe 100644 --- a/samples/api/im/v1/create_chat_sample.py +++ b/samples/api/im/v1/create_chat_sample.py @@ -5,102 +5,102 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatRequest = CreateChatRequest.builder() \ - .user_id_type("open_id") \ - .set_bot_manager(False) \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(CreateChatRequestBody.builder() - .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") - .name("测试群名称") - .description("测试群描述") - .i18n_names(I18nNames.builder().build()) - .owner_id("4d7a3c6g") - .user_id_list([]) - .bot_id_list([]) - .group_message_type("chat") - .chat_mode("group") - .chat_type("private") - .join_message_visibility("all_members") - .leave_message_visibility("all_members") - .membership_approval("no_approval_required") - .restricted_mode_setting(RestrictedModeSetting.builder().build()) - .urgent_setting("all_members") - .video_conference_setting("all_members") - .edit_permission("all_members") - .hide_member_count_setting("all_members") - .build()) \ - .build() + # 构造请求对象 + request: CreateChatRequest = CreateChatRequest.builder() \ + .user_id_type("open_id") \ + .set_bot_manager(False) \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(CreateChatRequestBody.builder() + .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") + .name("测试群名称") + .description("测试群描述") + .i18n_names(I18nNames.builder().build()) + .owner_id("4d7a3c6g") + .user_id_list([]) + .bot_id_list([]) + .group_message_type("chat") + .chat_mode("group") + .chat_type("private") + .join_message_visibility("all_members") + .leave_message_visibility("all_members") + .membership_approval("no_approval_required") + .restricted_mode_setting(RestrictedModeSetting.builder().build()) + .urgent_setting("all_members") + .video_conference_setting("all_members") + .edit_permission("all_members") + .hide_member_count_setting("all_members") + .build()) \ + .build() - # 发起请求 - response: CreateChatResponse = client.im.v1.chat.create(request) + # 发起请求 + response: CreateChatResponse = client.im.v1.chat.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatRequest = CreateChatRequest.builder() \ - .user_id_type("open_id") \ - .set_bot_manager(False) \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(CreateChatRequestBody.builder() - .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") - .name("测试群名称") - .description("测试群描述") - .i18n_names(I18nNames.builder().build()) - .owner_id("4d7a3c6g") - .user_id_list([]) - .bot_id_list([]) - .group_message_type("chat") - .chat_mode("group") - .chat_type("private") - .join_message_visibility("all_members") - .leave_message_visibility("all_members") - .membership_approval("no_approval_required") - .restricted_mode_setting(RestrictedModeSetting.builder().build()) - .urgent_setting("all_members") - .video_conference_setting("all_members") - .edit_permission("all_members") - .hide_member_count_setting("all_members") - .build()) \ - .build() + # 构造请求对象 + request: CreateChatRequest = CreateChatRequest.builder() \ + .user_id_type("open_id") \ + .set_bot_manager(False) \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(CreateChatRequestBody.builder() + .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") + .name("测试群名称") + .description("测试群描述") + .i18n_names(I18nNames.builder().build()) + .owner_id("4d7a3c6g") + .user_id_list([]) + .bot_id_list([]) + .group_message_type("chat") + .chat_mode("group") + .chat_type("private") + .join_message_visibility("all_members") + .leave_message_visibility("all_members") + .membership_approval("no_approval_required") + .restricted_mode_setting(RestrictedModeSetting.builder().build()) + .urgent_setting("all_members") + .video_conference_setting("all_members") + .edit_permission("all_members") + .hide_member_count_setting("all_members") + .build()) \ + .build() - # 发起请求 - response: CreateChatResponse = await client.im.v1.chat.acreate(request) + # 发起请求 + response: CreateChatResponse = await client.im.v1.chat.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_chat_tab_sample.py b/samples/api/im/v1/create_chat_tab_sample.py index bc37f20b2..1a6aa61f2 100644 --- a/samples/api/im/v1/create_chat_tab_sample.py +++ b/samples/api/im/v1/create_chat_tab_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatTabRequest = CreateChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(CreateChatTabRequestBody.builder() - .chat_tabs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatTabRequest = CreateChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(CreateChatTabRequestBody.builder() + .chat_tabs([]) + .build()) \ + .build() - # 发起请求 - response: CreateChatTabResponse = client.im.v1.chat_tab.create(request) + # 发起请求 + response: CreateChatTabResponse = client.im.v1.chat_tab.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateChatTabRequest = CreateChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(CreateChatTabRequestBody.builder() - .chat_tabs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateChatTabRequest = CreateChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(CreateChatTabRequestBody.builder() + .chat_tabs([]) + .build()) \ + .build() - # 发起请求 - response: CreateChatTabResponse = await client.im.v1.chat_tab.acreate(request) + # 发起请求 + response: CreateChatTabResponse = await client.im.v1.chat_tab.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_file_sample.py b/samples/api/im/v1/create_file_sample.py index 80594bc7c..56494d553 100644 --- a/samples/api/im/v1/create_file_sample.py +++ b/samples/api/im/v1/create_file_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateFileRequest = CreateFileRequest.builder() \ - .request_body(CreateFileRequestBody.builder() - .file_type("mp4") - .file_name("测试视频.mp4") - .duration(3000) - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateFileRequest = CreateFileRequest.builder() \ + .request_body(CreateFileRequestBody.builder() + .file_type("mp4") + .file_name("测试视频.mp4") + .duration(3000) + .file(file) + .build()) \ + .build() - # 发起请求 - response: CreateFileResponse = client.im.v1.file.create(request) + # 发起请求 + response: CreateFileResponse = client.im.v1.file.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.file.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.file.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateFileRequest = CreateFileRequest.builder() \ - .request_body(CreateFileRequestBody.builder() - .file_type("mp4") - .file_name("测试视频.mp4") - .duration(3000) - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateFileRequest = CreateFileRequest.builder() \ + .request_body(CreateFileRequestBody.builder() + .file_type("mp4") + .file_name("测试视频.mp4") + .duration(3000) + .file(file) + .build()) \ + .build() - # 发起请求 - response: CreateFileResponse = await client.im.v1.file.acreate(request) + # 发起请求 + response: CreateFileResponse = await client.im.v1.file.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.file.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.file.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_image_sample.py b/samples/api/im/v1/create_image_sample.py index d10c5d44c..5dcd29ccf 100644 --- a/samples/api/im/v1/create_image_sample.py +++ b/samples/api/im/v1/create_image_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateImageRequest = CreateImageRequest.builder() \ - .request_body(CreateImageRequestBody.builder() - .image_type("message") - .image(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateImageRequest = CreateImageRequest.builder() \ + .request_body(CreateImageRequestBody.builder() + .image_type("message") + .image(file) + .build()) \ + .build() - # 发起请求 - response: CreateImageResponse = client.im.v1.image.create(request) + # 发起请求 + response: CreateImageResponse = client.im.v1.image.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: CreateImageRequest = CreateImageRequest.builder() \ - .request_body(CreateImageRequestBody.builder() - .image_type("message") - .image(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: CreateImageRequest = CreateImageRequest.builder() \ + .request_body(CreateImageRequestBody.builder() + .image_type("message") + .image(file) + .build()) \ + .build() - # 发起请求 - response: CreateImageResponse = await client.im.v1.image.acreate(request) + # 发起请求 + response: CreateImageResponse = await client.im.v1.image.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_message_reaction_sample.py b/samples/api/im/v1/create_message_reaction_sample.py index 0699933b2..d637bae5a 100644 --- a/samples/api/im/v1/create_message_reaction_sample.py +++ b/samples/api/im/v1/create_message_reaction_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageReactionRequest = CreateMessageReactionRequest.builder() \ - .message_id("om_a8f2294b************a1a38afaac9d") \ - .request_body(CreateMessageReactionRequestBody.builder() - .reaction_type(Emoji.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageReactionRequest = CreateMessageReactionRequest.builder() \ + .message_id("om_a8f2294b************a1a38afaac9d") \ + .request_body(CreateMessageReactionRequestBody.builder() + .reaction_type(Emoji.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateMessageReactionResponse = client.im.v1.message_reaction.create(request) + # 发起请求 + response: CreateMessageReactionResponse = client.im.v1.message_reaction.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageReactionRequest = CreateMessageReactionRequest.builder() \ - .message_id("om_a8f2294b************a1a38afaac9d") \ - .request_body(CreateMessageReactionRequestBody.builder() - .reaction_type(Emoji.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageReactionRequest = CreateMessageReactionRequest.builder() \ + .message_id("om_a8f2294b************a1a38afaac9d") \ + .request_body(CreateMessageReactionRequestBody.builder() + .reaction_type(Emoji.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateMessageReactionResponse = await client.im.v1.message_reaction.acreate(request) + # 发起请求 + response: CreateMessageReactionResponse = await client.im.v1.message_reaction.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_message_sample.py b/samples/api/im/v1/create_message_sample.py index 6f1a5e078..57747b87f 100644 --- a/samples/api/im/v1/create_message_sample.py +++ b/samples/api/im/v1/create_message_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .receive_id_type("open_id") \ - .request_body(CreateMessageRequestBody.builder() - .receive_id("ou_7d8a6e6df7621556ce0d21922b676706ccs") - .msg_type("text") - .content("") - .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .receive_id_type("open_id") \ + .request_body(CreateMessageRequestBody.builder() + .receive_id("ou_7d8a6e6df7621556ce0d21922b676706ccs") + .msg_type("text") + .content("") + .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = client.im.v1.message.create(request) + # 发起请求 + response: CreateMessageResponse = client.im.v1.message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .receive_id_type("open_id") \ - .request_body(CreateMessageRequestBody.builder() - .receive_id("ou_7d8a6e6df7621556ce0d21922b676706ccs") - .msg_type("text") - .content("") - .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .receive_id_type("open_id") \ + .request_body(CreateMessageRequestBody.builder() + .receive_id("ou_7d8a6e6df7621556ce0d21922b676706ccs") + .msg_type("text") + .content("") + .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = await client.im.v1.message.acreate(request) + # 发起请求 + response: CreateMessageResponse = await client.im.v1.message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/create_pin_sample.py b/samples/api/im/v1/create_pin_sample.py index 0644f7737..cc6e15b9b 100644 --- a/samples/api/im/v1/create_pin_sample.py +++ b/samples/api/im/v1/create_pin_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePinRequest = CreatePinRequest.builder() \ - .request_body(CreatePinRequestBody.builder() - .message_id("om_dc13264520392913993dd051dba21dcf") - .build()) \ - .build() + # 构造请求对象 + request: CreatePinRequest = CreatePinRequest.builder() \ + .request_body(CreatePinRequestBody.builder() + .message_id("om_dc13264520392913993dd051dba21dcf") + .build()) \ + .build() - # 发起请求 - response: CreatePinResponse = client.im.v1.pin.create(request) + # 发起请求 + response: CreatePinResponse = client.im.v1.pin.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePinRequest = CreatePinRequest.builder() \ - .request_body(CreatePinRequestBody.builder() - .message_id("om_dc13264520392913993dd051dba21dcf") - .build()) \ - .build() + # 构造请求对象 + request: CreatePinRequest = CreatePinRequest.builder() \ + .request_body(CreatePinRequestBody.builder() + .message_id("om_dc13264520392913993dd051dba21dcf") + .build()) \ + .build() - # 发起请求 - response: CreatePinResponse = await client.im.v1.pin.acreate(request) + # 发起请求 + response: CreatePinResponse = await client.im.v1.pin.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_batch_message_sample.py b/samples/api/im/v1/delete_batch_message_sample.py index 12a190dce..703883a9e 100644 --- a/samples/api/im/v1/delete_batch_message_sample.py +++ b/samples/api/im/v1/delete_batch_message_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteBatchMessageRequest = DeleteBatchMessageRequest.builder() \ - .batch_message_id("bm-dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeleteBatchMessageRequest = DeleteBatchMessageRequest.builder() \ + .batch_message_id("bm-dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeleteBatchMessageResponse = client.im.v1.batch_message.delete(request) + # 发起请求 + response: DeleteBatchMessageResponse = client.im.v1.batch_message.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteBatchMessageRequest = DeleteBatchMessageRequest.builder() \ - .batch_message_id("bm-dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeleteBatchMessageRequest = DeleteBatchMessageRequest.builder() \ + .batch_message_id("bm-dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeleteBatchMessageResponse = await client.im.v1.batch_message.adelete(request) + # 发起请求 + response: DeleteBatchMessageResponse = await client.im.v1.batch_message.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_chat_members_sample.py b/samples/api/im/v1/delete_chat_members_sample.py index 1270af0cd..7be3b0261 100644 --- a/samples/api/im/v1/delete_chat_members_sample.py +++ b/samples/api/im/v1/delete_chat_members_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatMembersRequest = DeleteChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(DeleteChatMembersRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteChatMembersRequest = DeleteChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(DeleteChatMembersRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: DeleteChatMembersResponse = client.im.v1.chat_members.delete(request) + # 发起请求 + response: DeleteChatMembersResponse = client.im.v1.chat_members.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatMembersRequest = DeleteChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(DeleteChatMembersRequestBody.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteChatMembersRequest = DeleteChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(DeleteChatMembersRequestBody.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: DeleteChatMembersResponse = await client.im.v1.chat_members.adelete(request) + # 发起请求 + response: DeleteChatMembersResponse = await client.im.v1.chat_members.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_chat_menu_tree_sample.py b/samples/api/im/v1/delete_chat_menu_tree_sample.py index afd19f016..24ac517bd 100644 --- a/samples/api/im/v1/delete_chat_menu_tree_sample.py +++ b/samples/api/im/v1/delete_chat_menu_tree_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatMenuTreeRequest = DeleteChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(DeleteChatMenuTreeRequestBody.builder() - .chat_menu_top_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteChatMenuTreeRequest = DeleteChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(DeleteChatMenuTreeRequestBody.builder() + .chat_menu_top_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteChatMenuTreeResponse = client.im.v1.chat_menu_tree.delete(request) + # 发起请求 + response: DeleteChatMenuTreeResponse = client.im.v1.chat_menu_tree.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatMenuTreeRequest = DeleteChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(DeleteChatMenuTreeRequestBody.builder() - .chat_menu_top_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteChatMenuTreeRequest = DeleteChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(DeleteChatMenuTreeRequestBody.builder() + .chat_menu_top_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteChatMenuTreeResponse = await client.im.v1.chat_menu_tree.adelete(request) + # 发起请求 + response: DeleteChatMenuTreeResponse = await client.im.v1.chat_menu_tree.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_chat_sample.py b/samples/api/im/v1/delete_chat_sample.py index 239509f8d..264700dc5 100644 --- a/samples/api/im/v1/delete_chat_sample.py +++ b/samples/api/im/v1/delete_chat_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatRequest = DeleteChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: DeleteChatRequest = DeleteChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: DeleteChatResponse = client.im.v1.chat.delete(request) + # 发起请求 + response: DeleteChatResponse = client.im.v1.chat.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteChatRequest = DeleteChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: DeleteChatRequest = DeleteChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: DeleteChatResponse = await client.im.v1.chat.adelete(request) + # 发起请求 + response: DeleteChatResponse = await client.im.v1.chat.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_managers_chat_managers_sample.py b/samples/api/im/v1/delete_managers_chat_managers_sample.py index 77612ca9d..381b8c9e2 100644 --- a/samples/api/im/v1/delete_managers_chat_managers_sample.py +++ b/samples/api/im/v1/delete_managers_chat_managers_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteManagersChatManagersRequest = DeleteManagersChatManagersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(DeleteManagersChatManagersRequestBody.builder() - .manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteManagersChatManagersRequest = DeleteManagersChatManagersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(DeleteManagersChatManagersRequestBody.builder() + .manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteManagersChatManagersResponse = client.im.v1.chat_managers.delete_managers(request) + # 发起请求 + response: DeleteManagersChatManagersResponse = client.im.v1.chat_managers.delete_managers(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_managers.delete_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_managers.delete_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteManagersChatManagersRequest = DeleteManagersChatManagersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .request_body(DeleteManagersChatManagersRequestBody.builder() - .manager_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteManagersChatManagersRequest = DeleteManagersChatManagersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .request_body(DeleteManagersChatManagersRequestBody.builder() + .manager_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteManagersChatManagersResponse = await client.im.v1.chat_managers.adelete_managers(request) + # 发起请求 + response: DeleteManagersChatManagersResponse = await client.im.v1.chat_managers.adelete_managers(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_managers.adelete_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_managers.adelete_managers failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_message_reaction_sample.py b/samples/api/im/v1/delete_message_reaction_sample.py index b15cef160..26bfcf2e3 100644 --- a/samples/api/im/v1/delete_message_reaction_sample.py +++ b/samples/api/im/v1/delete_message_reaction_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMessageReactionRequest = DeleteMessageReactionRequest.builder() \ - .message_id("om_8964d1b4*********2b31383276113") \ - .reaction_id("ZCaCIjUBVVWSrm5L-3ZTw*************sNa8dHVplEzzSfJVUVLMLcS_") \ - .build() + # 构造请求对象 + request: DeleteMessageReactionRequest = DeleteMessageReactionRequest.builder() \ + .message_id("om_8964d1b4*********2b31383276113") \ + .reaction_id("ZCaCIjUBVVWSrm5L-3ZTw*************sNa8dHVplEzzSfJVUVLMLcS_") \ + .build() - # 发起请求 - response: DeleteMessageReactionResponse = client.im.v1.message_reaction.delete(request) + # 发起请求 + response: DeleteMessageReactionResponse = client.im.v1.message_reaction.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMessageReactionRequest = DeleteMessageReactionRequest.builder() \ - .message_id("om_8964d1b4*********2b31383276113") \ - .reaction_id("ZCaCIjUBVVWSrm5L-3ZTw*************sNa8dHVplEzzSfJVUVLMLcS_") \ - .build() + # 构造请求对象 + request: DeleteMessageReactionRequest = DeleteMessageReactionRequest.builder() \ + .message_id("om_8964d1b4*********2b31383276113") \ + .reaction_id("ZCaCIjUBVVWSrm5L-3ZTw*************sNa8dHVplEzzSfJVUVLMLcS_") \ + .build() - # 发起请求 - response: DeleteMessageReactionResponse = await client.im.v1.message_reaction.adelete(request) + # 发起请求 + response: DeleteMessageReactionResponse = await client.im.v1.message_reaction.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_message_sample.py b/samples/api/im/v1/delete_message_sample.py index d88c15a77..466768549 100644 --- a/samples/api/im/v1/delete_message_sample.py +++ b/samples/api/im/v1/delete_message_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMessageRequest = DeleteMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeleteMessageRequest = DeleteMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeleteMessageResponse = client.im.v1.message.delete(request) + # 发起请求 + response: DeleteMessageResponse = client.im.v1.message.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMessageRequest = DeleteMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeleteMessageRequest = DeleteMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeleteMessageResponse = await client.im.v1.message.adelete(request) + # 发起请求 + response: DeleteMessageResponse = await client.im.v1.message.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_pin_sample.py b/samples/api/im/v1/delete_pin_sample.py index a1e99e2cf..7673d646b 100644 --- a/samples/api/im/v1/delete_pin_sample.py +++ b/samples/api/im/v1/delete_pin_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePinRequest = DeletePinRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeletePinRequest = DeletePinRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeletePinResponse = client.im.v1.pin.delete(request) + # 发起请求 + response: DeletePinResponse = client.im.v1.pin.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePinRequest = DeletePinRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: DeletePinRequest = DeletePinRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: DeletePinResponse = await client.im.v1.pin.adelete(request) + # 发起请求 + response: DeletePinResponse = await client.im.v1.pin.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_tabs_chat_tab_sample.py b/samples/api/im/v1/delete_tabs_chat_tab_sample.py index 95d291291..6f85b131d 100644 --- a/samples/api/im/v1/delete_tabs_chat_tab_sample.py +++ b/samples/api/im/v1/delete_tabs_chat_tab_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTabsChatTabRequest = DeleteTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(DeleteTabsChatTabRequestBody.builder() - .tab_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteTabsChatTabRequest = DeleteTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(DeleteTabsChatTabRequestBody.builder() + .tab_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteTabsChatTabResponse = client.im.v1.chat_tab.delete_tabs(request) + # 发起请求 + response: DeleteTabsChatTabResponse = client.im.v1.chat_tab.delete_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.delete_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.delete_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTabsChatTabRequest = DeleteTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(DeleteTabsChatTabRequestBody.builder() - .tab_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteTabsChatTabRequest = DeleteTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(DeleteTabsChatTabRequestBody.builder() + .tab_ids([]) + .build()) \ + .build() - # 发起请求 - response: DeleteTabsChatTabResponse = await client.im.v1.chat_tab.adelete_tabs(request) + # 发起请求 + response: DeleteTabsChatTabResponse = await client.im.v1.chat_tab.adelete_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.adelete_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.adelete_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/delete_top_notice_chat_top_notice_sample.py b/samples/api/im/v1/delete_top_notice_chat_top_notice_sample.py index c854cc40f..670f74754 100644 --- a/samples/api/im/v1/delete_top_notice_chat_top_notice_sample.py +++ b/samples/api/im/v1/delete_top_notice_chat_top_notice_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTopNoticeChatTopNoticeRequest = DeleteTopNoticeChatTopNoticeRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .build() + # 构造请求对象 + request: DeleteTopNoticeChatTopNoticeRequest = DeleteTopNoticeChatTopNoticeRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .build() - # 发起请求 - response: DeleteTopNoticeChatTopNoticeResponse = client.im.v1.chat_top_notice.delete_top_notice(request) + # 发起请求 + response: DeleteTopNoticeChatTopNoticeResponse = client.im.v1.chat_top_notice.delete_top_notice(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_top_notice.delete_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_top_notice.delete_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTopNoticeChatTopNoticeRequest = DeleteTopNoticeChatTopNoticeRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .build() + # 构造请求对象 + request: DeleteTopNoticeChatTopNoticeRequest = DeleteTopNoticeChatTopNoticeRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .build() - # 发起请求 - response: DeleteTopNoticeChatTopNoticeResponse = await client.im.v1.chat_top_notice.adelete_top_notice(request) + # 发起请求 + response: DeleteTopNoticeChatTopNoticeResponse = await client.im.v1.chat_top_notice.adelete_top_notice(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_top_notice.adelete_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_top_notice.adelete_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/forward_message_sample.py b/samples/api/im/v1/forward_message_sample.py index ab09f77a2..b1f4eb3b8 100644 --- a/samples/api/im/v1/forward_message_sample.py +++ b/samples/api/im/v1/forward_message_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ForwardMessageRequest = ForwardMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(ForwardMessageRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .build()) \ - .build() + # 构造请求对象 + request: ForwardMessageRequest = ForwardMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(ForwardMessageRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .build()) \ + .build() - # 发起请求 - response: ForwardMessageResponse = client.im.v1.message.forward(request) + # 发起请求 + response: ForwardMessageResponse = client.im.v1.message.forward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ForwardMessageRequest = ForwardMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(ForwardMessageRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .build()) \ - .build() + # 构造请求对象 + request: ForwardMessageRequest = ForwardMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(ForwardMessageRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .build()) \ + .build() - # 发起请求 - response: ForwardMessageResponse = await client.im.v1.message.aforward(request) + # 发起请求 + response: ForwardMessageResponse = await client.im.v1.message.aforward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aforward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aforward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/forward_thread_sample.py b/samples/api/im/v1/forward_thread_sample.py index e6b8eb1c5..69397b6cd 100644 --- a/samples/api/im/v1/forward_thread_sample.py +++ b/samples/api/im/v1/forward_thread_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ForwardThreadRequest = ForwardThreadRequest.builder() \ - .thread_id("ot_dc13264520392913993dd051dba21dcf") \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(ForwardThreadRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .build()) \ - .build() + # 构造请求对象 + request: ForwardThreadRequest = ForwardThreadRequest.builder() \ + .thread_id("ot_dc13264520392913993dd051dba21dcf") \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(ForwardThreadRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .build()) \ + .build() - # 发起请求 - response: ForwardThreadResponse = client.im.v1.thread.forward(request) + # 发起请求 + response: ForwardThreadResponse = client.im.v1.thread.forward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.thread.forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.thread.forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ForwardThreadRequest = ForwardThreadRequest.builder() \ - .thread_id("ot_dc13264520392913993dd051dba21dcf") \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(ForwardThreadRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .build()) \ - .build() + # 构造请求对象 + request: ForwardThreadRequest = ForwardThreadRequest.builder() \ + .thread_id("ot_dc13264520392913993dd051dba21dcf") \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(ForwardThreadRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .build()) \ + .build() - # 发起请求 - response: ForwardThreadResponse = await client.im.v1.thread.aforward(request) + # 发起请求 + response: ForwardThreadResponse = await client.im.v1.thread.aforward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.thread.aforward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.thread.aforward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_chat_announcement_sample.py b/samples/api/im/v1/get_chat_announcement_sample.py index 0008295ff..a998182f2 100644 --- a/samples/api/im/v1/get_chat_announcement_sample.py +++ b/samples/api/im/v1/get_chat_announcement_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatAnnouncementRequest = GetChatAnnouncementRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetChatAnnouncementRequest = GetChatAnnouncementRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetChatAnnouncementResponse = client.im.v1.chat_announcement.get(request) + # 发起请求 + response: GetChatAnnouncementResponse = client.im.v1.chat_announcement.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_announcement.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_announcement.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatAnnouncementRequest = GetChatAnnouncementRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetChatAnnouncementRequest = GetChatAnnouncementRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetChatAnnouncementResponse = await client.im.v1.chat_announcement.aget(request) + # 发起请求 + response: GetChatAnnouncementResponse = await client.im.v1.chat_announcement.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_announcement.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_announcement.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_chat_members_sample.py b/samples/api/im/v1/get_chat_members_sample.py index 6bbc7d718..f911b7025 100644 --- a/samples/api/im/v1/get_chat_members_sample.py +++ b/samples/api/im/v1/get_chat_members_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatMembersRequest = GetChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .page_size(10) \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .build() + # 构造请求对象 + request: GetChatMembersRequest = GetChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .page_size(10) \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .build() - # 发起请求 - response: GetChatMembersResponse = client.im.v1.chat_members.get(request) + # 发起请求 + response: GetChatMembersResponse = client.im.v1.chat_members.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatMembersRequest = GetChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .member_id_type("open_id") \ - .page_size(10) \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .build() + # 构造请求对象 + request: GetChatMembersRequest = GetChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .member_id_type("open_id") \ + .page_size(10) \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .build() - # 发起请求 - response: GetChatMembersResponse = await client.im.v1.chat_members.aget(request) + # 发起请求 + response: GetChatMembersResponse = await client.im.v1.chat_members.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_chat_menu_tree_sample.py b/samples/api/im/v1/get_chat_menu_tree_sample.py index 763570139..7d4549175 100644 --- a/samples/api/im/v1/get_chat_menu_tree_sample.py +++ b/samples/api/im/v1/get_chat_menu_tree_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatMenuTreeRequest = GetChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: GetChatMenuTreeRequest = GetChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: GetChatMenuTreeResponse = client.im.v1.chat_menu_tree.get(request) + # 发起请求 + response: GetChatMenuTreeResponse = client.im.v1.chat_menu_tree.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatMenuTreeRequest = GetChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: GetChatMenuTreeRequest = GetChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: GetChatMenuTreeResponse = await client.im.v1.chat_menu_tree.aget(request) + # 发起请求 + response: GetChatMenuTreeResponse = await client.im.v1.chat_menu_tree.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_chat_moderation_sample.py b/samples/api/im/v1/get_chat_moderation_sample.py index dbb4214eb..4fcd5e800 100644 --- a/samples/api/im/v1/get_chat_moderation_sample.py +++ b/samples/api/im/v1/get_chat_moderation_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatModerationRequest = GetChatModerationRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .page_size(10) \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .build() + # 构造请求对象 + request: GetChatModerationRequest = GetChatModerationRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .page_size(10) \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .build() - # 发起请求 - response: GetChatModerationResponse = client.im.v1.chat_moderation.get(request) + # 发起请求 + response: GetChatModerationResponse = client.im.v1.chat_moderation.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_moderation.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_moderation.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatModerationRequest = GetChatModerationRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .page_size(10) \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .build() + # 构造请求对象 + request: GetChatModerationRequest = GetChatModerationRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .page_size(10) \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .build() - # 发起请求 - response: GetChatModerationResponse = await client.im.v1.chat_moderation.aget(request) + # 发起请求 + response: GetChatModerationResponse = await client.im.v1.chat_moderation.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_moderation.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_moderation.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_chat_sample.py b/samples/api/im/v1/get_chat_sample.py index 4b88ad967..309a8be68 100644 --- a/samples/api/im/v1/get_chat_sample.py +++ b/samples/api/im/v1/get_chat_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatRequest = GetChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetChatRequest = GetChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetChatResponse = client.im.v1.chat.get(request) + # 发起请求 + response: GetChatResponse = client.im.v1.chat.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetChatRequest = GetChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetChatRequest = GetChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetChatResponse = await client.im.v1.chat.aget(request) + # 发起请求 + response: GetChatResponse = await client.im.v1.chat.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_file_sample.py b/samples/api/im/v1/get_file_sample.py index a5050eed6..9c55ec8d5 100644 --- a/samples/api/im/v1/get_file_sample.py +++ b/samples/api/im/v1/get_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileRequest = GetFileRequest.builder() \ - .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ - .build() + # 构造请求对象 + request: GetFileRequest = GetFileRequest.builder() \ + .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ + .build() - # 发起请求 - response: GetFileResponse = client.im.v1.file.get(request) + # 发起请求 + response: GetFileResponse = client.im.v1.file.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.file.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.file.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetFileRequest = GetFileRequest.builder() \ - .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ - .build() + # 构造请求对象 + request: GetFileRequest = GetFileRequest.builder() \ + .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ + .build() - # 发起请求 - response: GetFileResponse = await client.im.v1.file.aget(request) + # 发起请求 + response: GetFileResponse = await client.im.v1.file.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.file.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.file.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_image_sample.py b/samples/api/im/v1/get_image_sample.py index 130688d46..6c17f5b47 100644 --- a/samples/api/im/v1/get_image_sample.py +++ b/samples/api/im/v1/get_image_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetImageRequest = GetImageRequest.builder() \ - .image_key("img_8d5181ca-0aed-40f0-b0d1-b1452132afbg") \ - .build() + # 构造请求对象 + request: GetImageRequest = GetImageRequest.builder() \ + .image_key("img_8d5181ca-0aed-40f0-b0d1-b1452132afbg") \ + .build() - # 发起请求 - response: GetImageResponse = client.im.v1.image.get(request) + # 发起请求 + response: GetImageResponse = client.im.v1.image.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.image.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.image.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetImageRequest = GetImageRequest.builder() \ - .image_key("img_8d5181ca-0aed-40f0-b0d1-b1452132afbg") \ - .build() + # 构造请求对象 + request: GetImageRequest = GetImageRequest.builder() \ + .image_key("img_8d5181ca-0aed-40f0-b0d1-b1452132afbg") \ + .build() - # 发起请求 - response: GetImageResponse = await client.im.v1.image.aget(request) + # 发起请求 + response: GetImageResponse = await client.im.v1.image.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.image.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.image.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_message_resource_sample.py b/samples/api/im/v1/get_message_resource_sample.py index 6c9223d9c..2453a1fbf 100644 --- a/samples/api/im/v1/get_message_resource_sample.py +++ b/samples/api/im/v1/get_message_resource_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMessageResourceRequest = GetMessageResourceRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ - .type("image") \ - .build() + # 构造请求对象 + request: GetMessageResourceRequest = GetMessageResourceRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ + .type("image") \ + .build() - # 发起请求 - response: GetMessageResourceResponse = client.im.v1.message_resource.get(request) + # 发起请求 + response: GetMessageResourceResponse = client.im.v1.message_resource.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_resource.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_resource.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMessageResourceRequest = GetMessageResourceRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ - .type("image") \ - .build() + # 构造请求对象 + request: GetMessageResourceRequest = GetMessageResourceRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .file_key("file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g") \ + .type("image") \ + .build() - # 发起请求 - response: GetMessageResourceResponse = await client.im.v1.message_resource.aget(request) + # 发起请求 + response: GetMessageResourceResponse = await client.im.v1.message_resource.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_resource.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_resource.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_message_sample.py b/samples/api/im/v1/get_message_sample.py index f7188576b..5caa02c05 100644 --- a/samples/api/im/v1/get_message_sample.py +++ b/samples/api/im/v1/get_message_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMessageRequest = GetMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetMessageRequest = GetMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetMessageResponse = client.im.v1.message.get(request) + # 发起请求 + response: GetMessageResponse = client.im.v1.message.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMessageRequest = GetMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetMessageRequest = GetMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetMessageResponse = await client.im.v1.message.aget(request) + # 发起请求 + response: GetMessageResponse = await client.im.v1.message.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/get_progress_batch_message_sample.py b/samples/api/im/v1/get_progress_batch_message_sample.py index 98897ef81..890b03496 100644 --- a/samples/api/im/v1/get_progress_batch_message_sample.py +++ b/samples/api/im/v1/get_progress_batch_message_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProgressBatchMessageRequest = GetProgressBatchMessageRequest.builder() \ - .batch_message_id("bm-0b3d5d1b2df7c6d5dbd1abe2c91e2217") \ - .build() + # 构造请求对象 + request: GetProgressBatchMessageRequest = GetProgressBatchMessageRequest.builder() \ + .batch_message_id("bm-0b3d5d1b2df7c6d5dbd1abe2c91e2217") \ + .build() - # 发起请求 - response: GetProgressBatchMessageResponse = client.im.v1.batch_message.get_progress(request) + # 发起请求 + response: GetProgressBatchMessageResponse = client.im.v1.batch_message.get_progress(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.get_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.get_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProgressBatchMessageRequest = GetProgressBatchMessageRequest.builder() \ - .batch_message_id("bm-0b3d5d1b2df7c6d5dbd1abe2c91e2217") \ - .build() + # 构造请求对象 + request: GetProgressBatchMessageRequest = GetProgressBatchMessageRequest.builder() \ + .batch_message_id("bm-0b3d5d1b2df7c6d5dbd1abe2c91e2217") \ + .build() - # 发起请求 - response: GetProgressBatchMessageResponse = await client.im.v1.batch_message.aget_progress(request) + # 发起请求 + response: GetProgressBatchMessageResponse = await client.im.v1.batch_message.aget_progress(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.aget_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.aget_progress failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/is_in_chat_chat_members_sample.py b/samples/api/im/v1/is_in_chat_chat_members_sample.py index 3162fddef..6e0f8b4d2 100644 --- a/samples/api/im/v1/is_in_chat_chat_members_sample.py +++ b/samples/api/im/v1/is_in_chat_chat_members_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: IsInChatChatMembersRequest = IsInChatChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: IsInChatChatMembersRequest = IsInChatChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: IsInChatChatMembersResponse = client.im.v1.chat_members.is_in_chat(request) + # 发起请求 + response: IsInChatChatMembersResponse = client.im.v1.chat_members.is_in_chat(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.is_in_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.is_in_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: IsInChatChatMembersRequest = IsInChatChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: IsInChatChatMembersRequest = IsInChatChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: IsInChatChatMembersResponse = await client.im.v1.chat_members.ais_in_chat(request) + # 发起请求 + response: IsInChatChatMembersResponse = await client.im.v1.chat_members.ais_in_chat(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.ais_in_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.ais_in_chat failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/link_chat_sample.py b/samples/api/im/v1/link_chat_sample.py index 5650fd3f9..b61e2a3c1 100644 --- a/samples/api/im/v1/link_chat_sample.py +++ b/samples/api/im/v1/link_chat_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LinkChatRequest = LinkChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(LinkChatRequestBody.builder() - .validity_period("week") - .build()) \ - .build() + # 构造请求对象 + request: LinkChatRequest = LinkChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(LinkChatRequestBody.builder() + .validity_period("week") + .build()) \ + .build() - # 发起请求 - response: LinkChatResponse = client.im.v1.chat.link(request) + # 发起请求 + response: LinkChatResponse = client.im.v1.chat.link(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.link failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.link failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: LinkChatRequest = LinkChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(LinkChatRequestBody.builder() - .validity_period("week") - .build()) \ - .build() + # 构造请求对象 + request: LinkChatRequest = LinkChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(LinkChatRequestBody.builder() + .validity_period("week") + .build()) \ + .build() - # 发起请求 - response: LinkChatResponse = await client.im.v1.chat.alink(request) + # 发起请求 + response: LinkChatResponse = await client.im.v1.chat.alink(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.alink failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.alink failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/list_chat_sample.py b/samples/api/im/v1/list_chat_sample.py index db8759c44..3a7146ba7 100644 --- a/samples/api/im/v1/list_chat_sample.py +++ b/samples/api/im/v1/list_chat_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListChatRequest = ListChatRequest.builder() \ - .user_id_type("user_id") \ - .sort_type("ByCreateTimeAsc") \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListChatRequest = ListChatRequest.builder() \ + .user_id_type("user_id") \ + .sort_type("ByCreateTimeAsc") \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListChatResponse = client.im.v1.chat.list(request) + # 发起请求 + response: ListChatResponse = client.im.v1.chat.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListChatRequest = ListChatRequest.builder() \ - .user_id_type("user_id") \ - .sort_type("ByCreateTimeAsc") \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListChatRequest = ListChatRequest.builder() \ + .user_id_type("user_id") \ + .sort_type("ByCreateTimeAsc") \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListChatResponse = await client.im.v1.chat.alist(request) + # 发起请求 + response: ListChatResponse = await client.im.v1.chat.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/list_message_reaction_sample.py b/samples/api/im/v1/list_message_reaction_sample.py index 7ceddc93a..eb27b98e6 100644 --- a/samples/api/im/v1/list_message_reaction_sample.py +++ b/samples/api/im/v1/list_message_reaction_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMessageReactionRequest = ListMessageReactionRequest.builder() \ - .message_id("om_8964d1b4*********2b31383276113") \ - .reaction_type("LAUGH") \ - .page_token("YhljsPiGfUgnVAg9urvRFd-BvSqRL20wMZNAWfa9xXkud6UKCybPuUgQ1vM26dj6") \ - .page_size(10) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListMessageReactionRequest = ListMessageReactionRequest.builder() \ + .message_id("om_8964d1b4*********2b31383276113") \ + .reaction_type("LAUGH") \ + .page_token("YhljsPiGfUgnVAg9urvRFd-BvSqRL20wMZNAWfa9xXkud6UKCybPuUgQ1vM26dj6") \ + .page_size(10) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListMessageReactionResponse = client.im.v1.message_reaction.list(request) + # 发起请求 + response: ListMessageReactionResponse = client.im.v1.message_reaction.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMessageReactionRequest = ListMessageReactionRequest.builder() \ - .message_id("om_8964d1b4*********2b31383276113") \ - .reaction_type("LAUGH") \ - .page_token("YhljsPiGfUgnVAg9urvRFd-BvSqRL20wMZNAWfa9xXkud6UKCybPuUgQ1vM26dj6") \ - .page_size(10) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListMessageReactionRequest = ListMessageReactionRequest.builder() \ + .message_id("om_8964d1b4*********2b31383276113") \ + .reaction_type("LAUGH") \ + .page_token("YhljsPiGfUgnVAg9urvRFd-BvSqRL20wMZNAWfa9xXkud6UKCybPuUgQ1vM26dj6") \ + .page_size(10) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListMessageReactionResponse = await client.im.v1.message_reaction.alist(request) + # 发起请求 + response: ListMessageReactionResponse = await client.im.v1.message_reaction.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message_reaction.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message_reaction.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/list_message_sample.py b/samples/api/im/v1/list_message_sample.py index 05d58695b..49f9190d6 100644 --- a/samples/api/im/v1/list_message_sample.py +++ b/samples/api/im/v1/list_message_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMessageRequest = ListMessageRequest.builder() \ - .container_id_type("chat") \ - .container_id("oc_234jsi43d3ssi993d43545f") \ - .start_time("1609296809") \ - .end_time("1608594809") \ - .sort_type("ByCreateTimeAsc") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListMessageRequest = ListMessageRequest.builder() \ + .container_id_type("chat") \ + .container_id("oc_234jsi43d3ssi993d43545f") \ + .start_time("1609296809") \ + .end_time("1608594809") \ + .sort_type("ByCreateTimeAsc") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListMessageResponse = client.im.v1.message.list(request) + # 发起请求 + response: ListMessageResponse = client.im.v1.message.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMessageRequest = ListMessageRequest.builder() \ - .container_id_type("chat") \ - .container_id("oc_234jsi43d3ssi993d43545f") \ - .start_time("1609296809") \ - .end_time("1608594809") \ - .sort_type("ByCreateTimeAsc") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListMessageRequest = ListMessageRequest.builder() \ + .container_id_type("chat") \ + .container_id("oc_234jsi43d3ssi993d43545f") \ + .start_time("1609296809") \ + .end_time("1608594809") \ + .sort_type("ByCreateTimeAsc") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListMessageResponse = await client.im.v1.message.alist(request) + # 发起请求 + response: ListMessageResponse = await client.im.v1.message.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/list_pin_sample.py b/samples/api/im/v1/list_pin_sample.py index 3f15303b6..ac07ca401 100644 --- a/samples/api/im/v1/list_pin_sample.py +++ b/samples/api/im/v1/list_pin_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPinRequest = ListPinRequest.builder() \ - .chat_id("oc_234jsi43d3ssi993d43545f") \ - .start_time("1658632251800") \ - .end_time("1658731646425") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListPinRequest = ListPinRequest.builder() \ + .chat_id("oc_234jsi43d3ssi993d43545f") \ + .start_time("1658632251800") \ + .end_time("1658731646425") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListPinResponse = client.im.v1.pin.list(request) + # 发起请求 + response: ListPinResponse = client.im.v1.pin.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPinRequest = ListPinRequest.builder() \ - .chat_id("oc_234jsi43d3ssi993d43545f") \ - .start_time("1658632251800") \ - .end_time("1658731646425") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListPinRequest = ListPinRequest.builder() \ + .chat_id("oc_234jsi43d3ssi993d43545f") \ + .start_time("1658632251800") \ + .end_time("1658731646425") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListPinResponse = await client.im.v1.pin.alist(request) + # 发起请求 + response: ListPinResponse = await client.im.v1.pin.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.pin.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.pin.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/list_tabs_chat_tab_sample.py b/samples/api/im/v1/list_tabs_chat_tab_sample.py index a9046059c..253bfcc67 100644 --- a/samples/api/im/v1/list_tabs_chat_tab_sample.py +++ b/samples/api/im/v1/list_tabs_chat_tab_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTabsChatTabRequest = ListTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: ListTabsChatTabRequest = ListTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: ListTabsChatTabResponse = client.im.v1.chat_tab.list_tabs(request) + # 发起请求 + response: ListTabsChatTabResponse = client.im.v1.chat_tab.list_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.list_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.list_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTabsChatTabRequest = ListTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: ListTabsChatTabRequest = ListTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: ListTabsChatTabResponse = await client.im.v1.chat_tab.alist_tabs(request) + # 发起请求 + response: ListTabsChatTabResponse = await client.im.v1.chat_tab.alist_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.alist_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.alist_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/me_join_chat_members_sample.py b/samples/api/im/v1/me_join_chat_members_sample.py index 39a24f8bf..52327d2d8 100644 --- a/samples/api/im/v1/me_join_chat_members_sample.py +++ b/samples/api/im/v1/me_join_chat_members_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MeJoinChatMembersRequest = MeJoinChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: MeJoinChatMembersRequest = MeJoinChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: MeJoinChatMembersResponse = client.im.v1.chat_members.me_join(request) + # 发起请求 + response: MeJoinChatMembersResponse = client.im.v1.chat_members.me_join(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.me_join failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.me_join failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MeJoinChatMembersRequest = MeJoinChatMembersRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .build() + # 构造请求对象 + request: MeJoinChatMembersRequest = MeJoinChatMembersRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .build() - # 发起请求 - response: MeJoinChatMembersResponse = await client.im.v1.chat_members.ame_join(request) + # 发起请求 + response: MeJoinChatMembersResponse = await client.im.v1.chat_members.ame_join(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_members.ame_join failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_members.ame_join failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/merge_forward_message_sample.py b/samples/api/im/v1/merge_forward_message_sample.py index 9ab1cff5e..637ee7cc6 100644 --- a/samples/api/im/v1/merge_forward_message_sample.py +++ b/samples/api/im/v1/merge_forward_message_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MergeForwardMessageRequest = MergeForwardMessageRequest.builder() \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(MergeForwardMessageRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .message_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: MergeForwardMessageRequest = MergeForwardMessageRequest.builder() \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(MergeForwardMessageRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .message_id_list([]) + .build()) \ + .build() - # 发起请求 - response: MergeForwardMessageResponse = client.im.v1.message.merge_forward(request) + # 发起请求 + response: MergeForwardMessageResponse = client.im.v1.message.merge_forward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.merge_forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.merge_forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MergeForwardMessageRequest = MergeForwardMessageRequest.builder() \ - .receive_id_type("open_id") \ - .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ - .request_body(MergeForwardMessageRequestBody.builder() - .receive_id("oc_a0553eda9014c201e6969b478895c230") - .message_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: MergeForwardMessageRequest = MergeForwardMessageRequest.builder() \ + .receive_id_type("open_id") \ + .uuid("b13g2t38-1jd2-458b-8djf-dtbca5104204") \ + .request_body(MergeForwardMessageRequestBody.builder() + .receive_id("oc_a0553eda9014c201e6969b478895c230") + .message_id_list([]) + .build()) \ + .build() - # 发起请求 - response: MergeForwardMessageResponse = await client.im.v1.message.amerge_forward(request) + # 发起请求 + response: MergeForwardMessageResponse = await client.im.v1.message.amerge_forward(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.amerge_forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.amerge_forward failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/patch_chat_announcement_sample.py b/samples/api/im/v1/patch_chat_announcement_sample.py index 062284afa..1de950273 100644 --- a/samples/api/im/v1/patch_chat_announcement_sample.py +++ b/samples/api/im/v1/patch_chat_announcement_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchChatAnnouncementRequest = PatchChatAnnouncementRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .request_body(PatchChatAnnouncementRequestBody.builder() - .revision("12") - .requests([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchChatAnnouncementRequest = PatchChatAnnouncementRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .request_body(PatchChatAnnouncementRequestBody.builder() + .revision("12") + .requests([]) + .build()) \ + .build() - # 发起请求 - response: PatchChatAnnouncementResponse = client.im.v1.chat_announcement.patch(request) + # 发起请求 + response: PatchChatAnnouncementResponse = client.im.v1.chat_announcement.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_announcement.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_announcement.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchChatAnnouncementRequest = PatchChatAnnouncementRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .request_body(PatchChatAnnouncementRequestBody.builder() - .revision("12") - .requests([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchChatAnnouncementRequest = PatchChatAnnouncementRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .request_body(PatchChatAnnouncementRequestBody.builder() + .revision("12") + .requests([]) + .build()) \ + .build() - # 发起请求 - response: PatchChatAnnouncementResponse = await client.im.v1.chat_announcement.apatch(request) + # 发起请求 + response: PatchChatAnnouncementResponse = await client.im.v1.chat_announcement.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_announcement.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_announcement.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/patch_chat_menu_item_sample.py b/samples/api/im/v1/patch_chat_menu_item_sample.py index 74eeec277..2c0604bf2 100644 --- a/samples/api/im/v1/patch_chat_menu_item_sample.py +++ b/samples/api/im/v1/patch_chat_menu_item_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchChatMenuItemRequest = PatchChatMenuItemRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .menu_item_id("7156553273518882844") \ - .request_body(PatchChatMenuItemRequestBody.builder() - .update_fields([]) - .chat_menu_item(ChatMenuItem.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchChatMenuItemRequest = PatchChatMenuItemRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .menu_item_id("7156553273518882844") \ + .request_body(PatchChatMenuItemRequestBody.builder() + .update_fields([]) + .chat_menu_item(ChatMenuItem.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchChatMenuItemResponse = client.im.v1.chat_menu_item.patch(request) + # 发起请求 + response: PatchChatMenuItemResponse = client.im.v1.chat_menu_item.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_item.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_item.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchChatMenuItemRequest = PatchChatMenuItemRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .menu_item_id("7156553273518882844") \ - .request_body(PatchChatMenuItemRequestBody.builder() - .update_fields([]) - .chat_menu_item(ChatMenuItem.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchChatMenuItemRequest = PatchChatMenuItemRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .menu_item_id("7156553273518882844") \ + .request_body(PatchChatMenuItemRequestBody.builder() + .update_fields([]) + .chat_menu_item(ChatMenuItem.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchChatMenuItemResponse = await client.im.v1.chat_menu_item.apatch(request) + # 发起请求 + response: PatchChatMenuItemResponse = await client.im.v1.chat_menu_item.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_item.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_item.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/patch_message_sample.py b/samples/api/im/v1/patch_message_sample.py index 9ec46b2f4..c6c0aa582 100644 --- a/samples/api/im/v1/patch_message_sample.py +++ b/samples/api/im/v1/patch_message_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchMessageRequest = PatchMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(PatchMessageRequestBody.builder() - .content("参考链接") - .build()) \ - .build() + # 构造请求对象 + request: PatchMessageRequest = PatchMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(PatchMessageRequestBody.builder() + .content("参考链接") + .build()) \ + .build() - # 发起请求 - response: PatchMessageResponse = client.im.v1.message.patch(request) + # 发起请求 + response: PatchMessageResponse = client.im.v1.message.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchMessageRequest = PatchMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(PatchMessageRequestBody.builder() - .content("参考链接") - .build()) \ - .build() + # 构造请求对象 + request: PatchMessageRequest = PatchMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(PatchMessageRequestBody.builder() + .content("参考链接") + .build()) \ + .build() - # 发起请求 - response: PatchMessageResponse = await client.im.v1.message.apatch(request) + # 发起请求 + response: PatchMessageResponse = await client.im.v1.message.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/push_follow_up_message_sample.py b/samples/api/im/v1/push_follow_up_message_sample.py index a228d7119..e4c0225ae 100644 --- a/samples/api/im/v1/push_follow_up_message_sample.py +++ b/samples/api/im/v1/push_follow_up_message_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PushFollowUpMessageRequest = PushFollowUpMessageRequest.builder() \ - .message_id("om_3210a18894e206715a4359115f4cf2f5") \ - .request_body(PushFollowUpMessageRequestBody.builder() - .follow_ups([]) - .build()) \ - .build() + # 构造请求对象 + request: PushFollowUpMessageRequest = PushFollowUpMessageRequest.builder() \ + .message_id("om_3210a18894e206715a4359115f4cf2f5") \ + .request_body(PushFollowUpMessageRequestBody.builder() + .follow_ups([]) + .build()) \ + .build() - # 发起请求 - response: PushFollowUpMessageResponse = client.im.v1.message.push_follow_up(request) + # 发起请求 + response: PushFollowUpMessageResponse = client.im.v1.message.push_follow_up(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.push_follow_up failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.push_follow_up failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PushFollowUpMessageRequest = PushFollowUpMessageRequest.builder() \ - .message_id("om_3210a18894e206715a4359115f4cf2f5") \ - .request_body(PushFollowUpMessageRequestBody.builder() - .follow_ups([]) - .build()) \ - .build() + # 构造请求对象 + request: PushFollowUpMessageRequest = PushFollowUpMessageRequest.builder() \ + .message_id("om_3210a18894e206715a4359115f4cf2f5") \ + .request_body(PushFollowUpMessageRequestBody.builder() + .follow_ups([]) + .build()) \ + .build() - # 发起请求 - response: PushFollowUpMessageResponse = await client.im.v1.message.apush_follow_up(request) + # 发起请求 + response: PushFollowUpMessageResponse = await client.im.v1.message.apush_follow_up(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.apush_follow_up failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.apush_follow_up failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/put_top_notice_chat_top_notice_sample.py b/samples/api/im/v1/put_top_notice_chat_top_notice_sample.py index 0eae3a006..bc646df48 100644 --- a/samples/api/im/v1/put_top_notice_chat_top_notice_sample.py +++ b/samples/api/im/v1/put_top_notice_chat_top_notice_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PutTopNoticeChatTopNoticeRequest = PutTopNoticeChatTopNoticeRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .request_body(PutTopNoticeChatTopNoticeRequestBody.builder() - .chat_top_notice([]) - .build()) \ - .build() + # 构造请求对象 + request: PutTopNoticeChatTopNoticeRequest = PutTopNoticeChatTopNoticeRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .request_body(PutTopNoticeChatTopNoticeRequestBody.builder() + .chat_top_notice([]) + .build()) \ + .build() - # 发起请求 - response: PutTopNoticeChatTopNoticeResponse = client.im.v1.chat_top_notice.put_top_notice(request) + # 发起请求 + response: PutTopNoticeChatTopNoticeResponse = client.im.v1.chat_top_notice.put_top_notice(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_top_notice.put_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_top_notice.put_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PutTopNoticeChatTopNoticeRequest = PutTopNoticeChatTopNoticeRequest.builder() \ - .chat_id("oc_5ad11d72b830411d72b836c20") \ - .request_body(PutTopNoticeChatTopNoticeRequestBody.builder() - .chat_top_notice([]) - .build()) \ - .build() + # 构造请求对象 + request: PutTopNoticeChatTopNoticeRequest = PutTopNoticeChatTopNoticeRequest.builder() \ + .chat_id("oc_5ad11d72b830411d72b836c20") \ + .request_body(PutTopNoticeChatTopNoticeRequestBody.builder() + .chat_top_notice([]) + .build()) \ + .build() - # 发起请求 - response: PutTopNoticeChatTopNoticeResponse = await client.im.v1.chat_top_notice.aput_top_notice(request) + # 发起请求 + response: PutTopNoticeChatTopNoticeResponse = await client.im.v1.chat_top_notice.aput_top_notice(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_top_notice.aput_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_top_notice.aput_top_notice failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/read_user_batch_message_sample.py b/samples/api/im/v1/read_user_batch_message_sample.py index 2a1a41e3c..752dd9827 100644 --- a/samples/api/im/v1/read_user_batch_message_sample.py +++ b/samples/api/im/v1/read_user_batch_message_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReadUserBatchMessageRequest = ReadUserBatchMessageRequest.builder() \ - .batch_message_id("bm_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: ReadUserBatchMessageRequest = ReadUserBatchMessageRequest.builder() \ + .batch_message_id("bm_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: ReadUserBatchMessageResponse = client.im.v1.batch_message.read_user(request) + # 发起请求 + response: ReadUserBatchMessageResponse = client.im.v1.batch_message.read_user(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.read_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.read_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReadUserBatchMessageRequest = ReadUserBatchMessageRequest.builder() \ - .batch_message_id("bm_dc13264520392913993dd051dba21dcf") \ - .build() + # 构造请求对象 + request: ReadUserBatchMessageRequest = ReadUserBatchMessageRequest.builder() \ + .batch_message_id("bm_dc13264520392913993dd051dba21dcf") \ + .build() - # 发起请求 - response: ReadUserBatchMessageResponse = await client.im.v1.batch_message.aread_user(request) + # 发起请求 + response: ReadUserBatchMessageResponse = await client.im.v1.batch_message.aread_user(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.batch_message.aread_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.batch_message.aread_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/read_users_message_sample.py b/samples/api/im/v1/read_users_message_sample.py index 54d35ac52..23defb4eb 100644 --- a/samples/api/im/v1/read_users_message_sample.py +++ b/samples/api/im/v1/read_users_message_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReadUsersMessageRequest = ReadUsersMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ReadUsersMessageRequest = ReadUsersMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ReadUsersMessageResponse = client.im.v1.message.read_users(request) + # 发起请求 + response: ReadUsersMessageResponse = client.im.v1.message.read_users(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.read_users failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.read_users failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReadUsersMessageRequest = ReadUsersMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ReadUsersMessageRequest = ReadUsersMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ReadUsersMessageResponse = await client.im.v1.message.aread_users(request) + # 发起请求 + response: ReadUsersMessageResponse = await client.im.v1.message.aread_users(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aread_users failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aread_users failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/reply_message_sample.py b/samples/api/im/v1/reply_message_sample.py index b0a1dba7f..ad5b81b63 100644 --- a/samples/api/im/v1/reply_message_sample.py +++ b/samples/api/im/v1/reply_message_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplyMessageRequest = ReplyMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(ReplyMessageRequestBody.builder() - .content("") - .msg_type("text") - .reply_in_thread(False) - .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") - .build()) \ - .build() + # 构造请求对象 + request: ReplyMessageRequest = ReplyMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(ReplyMessageRequestBody.builder() + .content("") + .msg_type("text") + .reply_in_thread(False) + .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") + .build()) \ + .build() - # 发起请求 - response: ReplyMessageResponse = client.im.v1.message.reply(request) + # 发起请求 + response: ReplyMessageResponse = client.im.v1.message.reply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.reply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.reply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplyMessageRequest = ReplyMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(ReplyMessageRequestBody.builder() - .content("") - .msg_type("text") - .reply_in_thread(False) - .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") - .build()) \ - .build() + # 构造请求对象 + request: ReplyMessageRequest = ReplyMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(ReplyMessageRequestBody.builder() + .content("") + .msg_type("text") + .reply_in_thread(False) + .uuid("a0d69e20-1dd1-458b-k525-dfeca4015204") + .build()) \ + .build() - # 发起请求 - response: ReplyMessageResponse = await client.im.v1.message.areply(request) + # 发起请求 + response: ReplyMessageResponse = await client.im.v1.message.areply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.areply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.areply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/search_chat_sample.py b/samples/api/im/v1/search_chat_sample.py index 672c5780a..ab952e7e7 100644 --- a/samples/api/im/v1/search_chat_sample.py +++ b/samples/api/im/v1/search_chat_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchChatRequest = SearchChatRequest.builder() \ - .user_id_type("user_id") \ - .query("abc") \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: SearchChatRequest = SearchChatRequest.builder() \ + .user_id_type("user_id") \ + .query("abc") \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .page_size(20) \ + .build() - # 发起请求 - response: SearchChatResponse = client.im.v1.chat.search(request) + # 发起请求 + response: SearchChatResponse = client.im.v1.chat.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchChatRequest = SearchChatRequest.builder() \ - .user_id_type("user_id") \ - .query("abc") \ - .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: SearchChatRequest = SearchChatRequest.builder() \ + .user_id_type("user_id") \ + .query("abc") \ + .page_token("dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==") \ + .page_size(20) \ + .build() - # 发起请求 - response: SearchChatResponse = await client.im.v1.chat.asearch(request) + # 发起请求 + response: SearchChatResponse = await client.im.v1.chat.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/sort_chat_menu_tree_sample.py b/samples/api/im/v1/sort_chat_menu_tree_sample.py index 72e16049f..79fc2aba8 100644 --- a/samples/api/im/v1/sort_chat_menu_tree_sample.py +++ b/samples/api/im/v1/sort_chat_menu_tree_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SortChatMenuTreeRequest = SortChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(SortChatMenuTreeRequestBody.builder() - .chat_menu_top_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SortChatMenuTreeRequest = SortChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(SortChatMenuTreeRequestBody.builder() + .chat_menu_top_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: SortChatMenuTreeResponse = client.im.v1.chat_menu_tree.sort(request) + # 发起请求 + response: SortChatMenuTreeResponse = client.im.v1.chat_menu_tree.sort(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.sort failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.sort failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SortChatMenuTreeRequest = SortChatMenuTreeRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(SortChatMenuTreeRequestBody.builder() - .chat_menu_top_level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SortChatMenuTreeRequest = SortChatMenuTreeRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(SortChatMenuTreeRequestBody.builder() + .chat_menu_top_level_ids([]) + .build()) \ + .build() - # 发起请求 - response: SortChatMenuTreeResponse = await client.im.v1.chat_menu_tree.asort(request) + # 发起请求 + response: SortChatMenuTreeResponse = await client.im.v1.chat_menu_tree.asort(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_menu_tree.asort failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_menu_tree.asort failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/sort_tabs_chat_tab_sample.py b/samples/api/im/v1/sort_tabs_chat_tab_sample.py index dd48a5a20..a0c7ad2c0 100644 --- a/samples/api/im/v1/sort_tabs_chat_tab_sample.py +++ b/samples/api/im/v1/sort_tabs_chat_tab_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SortTabsChatTabRequest = SortTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(SortTabsChatTabRequestBody.builder() - .tab_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SortTabsChatTabRequest = SortTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(SortTabsChatTabRequestBody.builder() + .tab_ids([]) + .build()) \ + .build() - # 发起请求 - response: SortTabsChatTabResponse = client.im.v1.chat_tab.sort_tabs(request) + # 发起请求 + response: SortTabsChatTabResponse = client.im.v1.chat_tab.sort_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.sort_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.sort_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SortTabsChatTabRequest = SortTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(SortTabsChatTabRequestBody.builder() - .tab_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: SortTabsChatTabRequest = SortTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(SortTabsChatTabRequestBody.builder() + .tab_ids([]) + .build()) \ + .build() - # 发起请求 - response: SortTabsChatTabResponse = await client.im.v1.chat_tab.asort_tabs(request) + # 发起请求 + response: SortTabsChatTabResponse = await client.im.v1.chat_tab.asort_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.asort_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.asort_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/update_chat_moderation_sample.py b/samples/api/im/v1/update_chat_moderation_sample.py index f2aafccf6..e13da9aeb 100644 --- a/samples/api/im/v1/update_chat_moderation_sample.py +++ b/samples/api/im/v1/update_chat_moderation_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatModerationRequest = UpdateChatModerationRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .request_body(UpdateChatModerationRequestBody.builder() - .moderation_setting("moderator_list") - .moderator_added_list([]) - .moderator_removed_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatModerationRequest = UpdateChatModerationRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .request_body(UpdateChatModerationRequestBody.builder() + .moderation_setting("moderator_list") + .moderator_added_list([]) + .moderator_removed_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateChatModerationResponse = client.im.v1.chat_moderation.update(request) + # 发起请求 + response: UpdateChatModerationResponse = client.im.v1.chat_moderation.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_moderation.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_moderation.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatModerationRequest = UpdateChatModerationRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .request_body(UpdateChatModerationRequestBody.builder() - .moderation_setting("moderator_list") - .moderator_added_list([]) - .moderator_removed_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatModerationRequest = UpdateChatModerationRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .request_body(UpdateChatModerationRequestBody.builder() + .moderation_setting("moderator_list") + .moderator_added_list([]) + .moderator_removed_list([]) + .build()) \ + .build() - # 发起请求 - response: UpdateChatModerationResponse = await client.im.v1.chat_moderation.aupdate(request) + # 发起请求 + response: UpdateChatModerationResponse = await client.im.v1.chat_moderation.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_moderation.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_moderation.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/update_chat_sample.py b/samples/api/im/v1/update_chat_sample.py index 7755b2523..8b270e4a2 100644 --- a/samples/api/im/v1/update_chat_sample.py +++ b/samples/api/im/v1/update_chat_sample.py @@ -5,100 +5,100 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatRequest = UpdateChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .request_body(UpdateChatRequestBody.builder() - .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") - .name("群聊") - .description("测试群描述") - .i18n_names(I18nNames.builder().build()) - .add_member_permission("all_members") - .share_card_permission("allowed") - .at_all_permission("all_members") - .edit_permission("all_members") - .owner_id("4d7a3c6g") - .join_message_visibility("only_owner") - .leave_message_visibility("only_owner") - .membership_approval("no_approval_required") - .restricted_mode_setting(RestrictedModeSetting.builder().build()) - .chat_type("private") - .group_message_type("chat") - .urgent_setting("all_members") - .video_conference_setting("all_members") - .hide_member_count_setting("all_members") - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatRequest = UpdateChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .request_body(UpdateChatRequestBody.builder() + .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") + .name("群聊") + .description("测试群描述") + .i18n_names(I18nNames.builder().build()) + .add_member_permission("all_members") + .share_card_permission("allowed") + .at_all_permission("all_members") + .edit_permission("all_members") + .owner_id("4d7a3c6g") + .join_message_visibility("only_owner") + .leave_message_visibility("only_owner") + .membership_approval("no_approval_required") + .restricted_mode_setting(RestrictedModeSetting.builder().build()) + .chat_type("private") + .group_message_type("chat") + .urgent_setting("all_members") + .video_conference_setting("all_members") + .hide_member_count_setting("all_members") + .build()) \ + .build() - # 发起请求 - response: UpdateChatResponse = client.im.v1.chat.update(request) + # 发起请求 + response: UpdateChatResponse = client.im.v1.chat.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatRequest = UpdateChatRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .user_id_type("user_id") \ - .request_body(UpdateChatRequestBody.builder() - .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") - .name("群聊") - .description("测试群描述") - .i18n_names(I18nNames.builder().build()) - .add_member_permission("all_members") - .share_card_permission("allowed") - .at_all_permission("all_members") - .edit_permission("all_members") - .owner_id("4d7a3c6g") - .join_message_visibility("only_owner") - .leave_message_visibility("only_owner") - .membership_approval("no_approval_required") - .restricted_mode_setting(RestrictedModeSetting.builder().build()) - .chat_type("private") - .group_message_type("chat") - .urgent_setting("all_members") - .video_conference_setting("all_members") - .hide_member_count_setting("all_members") - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatRequest = UpdateChatRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .user_id_type("user_id") \ + .request_body(UpdateChatRequestBody.builder() + .avatar("default-avatar_44ae0ca3-e140-494b-956f-78091e348435") + .name("群聊") + .description("测试群描述") + .i18n_names(I18nNames.builder().build()) + .add_member_permission("all_members") + .share_card_permission("allowed") + .at_all_permission("all_members") + .edit_permission("all_members") + .owner_id("4d7a3c6g") + .join_message_visibility("only_owner") + .leave_message_visibility("only_owner") + .membership_approval("no_approval_required") + .restricted_mode_setting(RestrictedModeSetting.builder().build()) + .chat_type("private") + .group_message_type("chat") + .urgent_setting("all_members") + .video_conference_setting("all_members") + .hide_member_count_setting("all_members") + .build()) \ + .build() - # 发起请求 - response: UpdateChatResponse = await client.im.v1.chat.aupdate(request) + # 发起请求 + response: UpdateChatResponse = await client.im.v1.chat.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/update_message_sample.py b/samples/api/im/v1/update_message_sample.py index 36369e3f8..a4253234b 100644 --- a/samples/api/im/v1/update_message_sample.py +++ b/samples/api/im/v1/update_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateMessageRequest = UpdateMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(UpdateMessageRequestBody.builder() - .msg_type("text") - .content("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateMessageRequest = UpdateMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(UpdateMessageRequestBody.builder() + .msg_type("text") + .content("") + .build()) \ + .build() - # 发起请求 - response: UpdateMessageResponse = client.im.v1.message.update(request) + # 发起请求 + response: UpdateMessageResponse = client.im.v1.message.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateMessageRequest = UpdateMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .request_body(UpdateMessageRequestBody.builder() - .msg_type("text") - .content("") - .build()) \ - .build() + # 构造请求对象 + request: UpdateMessageRequest = UpdateMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .request_body(UpdateMessageRequestBody.builder() + .msg_type("text") + .content("") + .build()) \ + .build() - # 发起请求 - response: UpdateMessageResponse = await client.im.v1.message.aupdate(request) + # 发起请求 + response: UpdateMessageResponse = await client.im.v1.message.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/update_tabs_chat_tab_sample.py b/samples/api/im/v1/update_tabs_chat_tab_sample.py index a0d8069b2..3aabf0e92 100644 --- a/samples/api/im/v1/update_tabs_chat_tab_sample.py +++ b/samples/api/im/v1/update_tabs_chat_tab_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTabsChatTabRequest = UpdateTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(UpdateTabsChatTabRequestBody.builder() - .chat_tabs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateTabsChatTabRequest = UpdateTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(UpdateTabsChatTabRequestBody.builder() + .chat_tabs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateTabsChatTabResponse = client.im.v1.chat_tab.update_tabs(request) + # 发起请求 + response: UpdateTabsChatTabResponse = client.im.v1.chat_tab.update_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.update_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.update_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTabsChatTabRequest = UpdateTabsChatTabRequest.builder() \ - .chat_id("oc_a0553eda9014c201e6969b478895c230") \ - .request_body(UpdateTabsChatTabRequestBody.builder() - .chat_tabs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateTabsChatTabRequest = UpdateTabsChatTabRequest.builder() \ + .chat_id("oc_a0553eda9014c201e6969b478895c230") \ + .request_body(UpdateTabsChatTabRequestBody.builder() + .chat_tabs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateTabsChatTabResponse = await client.im.v1.chat_tab.aupdate_tabs(request) + # 发起请求 + response: UpdateTabsChatTabResponse = await client.im.v1.chat_tab.aupdate_tabs(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.chat_tab.aupdate_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.chat_tab.aupdate_tabs failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/urgent_app_message_sample.py b/samples/api/im/v1/urgent_app_message_sample.py index 267e7c08e..143589af7 100644 --- a/samples/api/im/v1/urgent_app_message_sample.py +++ b/samples/api/im/v1/urgent_app_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentAppMessageRequest = UrgentAppMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentAppMessageRequest = UrgentAppMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentAppMessageResponse = client.im.v1.message.urgent_app(request) + # 发起请求 + response: UrgentAppMessageResponse = client.im.v1.message.urgent_app(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.urgent_app failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.urgent_app failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentAppMessageRequest = UrgentAppMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentAppMessageRequest = UrgentAppMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentAppMessageResponse = await client.im.v1.message.aurgent_app(request) + # 发起请求 + response: UrgentAppMessageResponse = await client.im.v1.message.aurgent_app(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aurgent_app failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aurgent_app failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/urgent_phone_message_sample.py b/samples/api/im/v1/urgent_phone_message_sample.py index 2d06e24d7..3214c9ec0 100644 --- a/samples/api/im/v1/urgent_phone_message_sample.py +++ b/samples/api/im/v1/urgent_phone_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentPhoneMessageRequest = UrgentPhoneMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("open_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentPhoneMessageRequest = UrgentPhoneMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("open_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentPhoneMessageResponse = client.im.v1.message.urgent_phone(request) + # 发起请求 + response: UrgentPhoneMessageResponse = client.im.v1.message.urgent_phone(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.urgent_phone failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.urgent_phone failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentPhoneMessageRequest = UrgentPhoneMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("open_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentPhoneMessageRequest = UrgentPhoneMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("open_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentPhoneMessageResponse = await client.im.v1.message.aurgent_phone(request) + # 发起请求 + response: UrgentPhoneMessageResponse = await client.im.v1.message.aurgent_phone(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aurgent_phone failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aurgent_phone failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v1/urgent_sms_message_sample.py b/samples/api/im/v1/urgent_sms_message_sample.py index 5c5e0d9c5..e7da744e8 100644 --- a/samples/api/im/v1/urgent_sms_message_sample.py +++ b/samples/api/im/v1/urgent_sms_message_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentSmsMessageRequest = UrgentSmsMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentSmsMessageRequest = UrgentSmsMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentSmsMessageResponse = client.im.v1.message.urgent_sms(request) + # 发起请求 + response: UrgentSmsMessageResponse = client.im.v1.message.urgent_sms(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.urgent_sms failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.urgent_sms failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UrgentSmsMessageRequest = UrgentSmsMessageRequest.builder() \ - .message_id("om_dc13264520392913993dd051dba21dcf") \ - .user_id_type("user_id") \ - .request_body(UrgentReceivers.builder() - .user_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: UrgentSmsMessageRequest = UrgentSmsMessageRequest.builder() \ + .message_id("om_dc13264520392913993dd051dba21dcf") \ + .user_id_type("user_id") \ + .request_body(UrgentReceivers.builder() + .user_id_list([]) + .build()) \ + .build() - # 发起请求 - response: UrgentSmsMessageResponse = await client.im.v1.message.aurgent_sms(request) + # 发起请求 + response: UrgentSmsMessageResponse = await client.im.v1.message.aurgent_sms(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v1.message.aurgent_sms failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v1.message.aurgent_sms failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/batch_update_url_preview_sample.py b/samples/api/im/v2/batch_update_url_preview_sample.py index bd416194a..f4df35f1c 100644 --- a/samples/api/im/v2/batch_update_url_preview_sample.py +++ b/samples/api/im/v2/batch_update_url_preview_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateUrlPreviewRequest = BatchUpdateUrlPreviewRequest.builder() \ - .request_body(BatchUpdateUrlPreviewRequestBody.builder() - .preview_tokens([]) - .open_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateUrlPreviewRequest = BatchUpdateUrlPreviewRequest.builder() \ + .request_body(BatchUpdateUrlPreviewRequestBody.builder() + .preview_tokens([]) + .open_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateUrlPreviewResponse = client.im.v2.url_preview.batch_update(request) + # 发起请求 + response: BatchUpdateUrlPreviewResponse = client.im.v2.url_preview.batch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.url_preview.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.url_preview.batch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchUpdateUrlPreviewRequest = BatchUpdateUrlPreviewRequest.builder() \ - .request_body(BatchUpdateUrlPreviewRequestBody.builder() - .preview_tokens([]) - .open_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchUpdateUrlPreviewRequest = BatchUpdateUrlPreviewRequest.builder() \ + .request_body(BatchUpdateUrlPreviewRequestBody.builder() + .preview_tokens([]) + .open_ids([]) + .build()) \ + .build() - # 发起请求 - response: BatchUpdateUrlPreviewResponse = await client.im.v2.url_preview.abatch_update(request) + # 发起请求 + response: BatchUpdateUrlPreviewResponse = await client.im.v2.url_preview.abatch_update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.url_preview.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.url_preview.abatch_update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/create_app_feed_card_sample.py b/samples/api/im/v2/create_app_feed_card_sample.py index b895ab13c..7b8138777 100644 --- a/samples/api/im/v2/create_app_feed_card_sample.py +++ b/samples/api/im/v2/create_app_feed_card_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppFeedCardRequest = CreateAppFeedCardRequest.builder() \ - .user_id_type("open_id") \ - .request_body(CreateAppFeedCardRequestBody.builder() - .app_feed_card(OpenAppFeedCard.builder().build()) - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppFeedCardRequest = CreateAppFeedCardRequest.builder() \ + .user_id_type("open_id") \ + .request_body(CreateAppFeedCardRequestBody.builder() + .app_feed_card(OpenAppFeedCard.builder().build()) + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateAppFeedCardResponse = client.im.v2.app_feed_card.create(request) + # 发起请求 + response: CreateAppFeedCardResponse = client.im.v2.app_feed_card.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppFeedCardRequest = CreateAppFeedCardRequest.builder() \ - .user_id_type("open_id") \ - .request_body(CreateAppFeedCardRequestBody.builder() - .app_feed_card(OpenAppFeedCard.builder().build()) - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateAppFeedCardRequest = CreateAppFeedCardRequest.builder() \ + .user_id_type("open_id") \ + .request_body(CreateAppFeedCardRequestBody.builder() + .app_feed_card(OpenAppFeedCard.builder().build()) + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateAppFeedCardResponse = await client.im.v2.app_feed_card.acreate(request) + # 发起请求 + response: CreateAppFeedCardResponse = await client.im.v2.app_feed_card.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/create_biz_entity_tag_relation_sample.py b/samples/api/im/v2/create_biz_entity_tag_relation_sample.py index 066cd6d97..608160751 100644 --- a/samples/api/im/v2/create_biz_entity_tag_relation_sample.py +++ b/samples/api/im/v2/create_biz_entity_tag_relation_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBizEntityTagRelationRequest = CreateBizEntityTagRelationRequest.builder() \ - .request_body(CreateBizEntityTagRelationRequestBody.builder() - .tag_biz_type("chat") - .biz_entity_id("71616xxxx") - .tag_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateBizEntityTagRelationRequest = CreateBizEntityTagRelationRequest.builder() \ + .request_body(CreateBizEntityTagRelationRequestBody.builder() + .tag_biz_type("chat") + .biz_entity_id("71616xxxx") + .tag_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.create(request) + # 发起请求 + response: CreateBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateBizEntityTagRelationRequest = CreateBizEntityTagRelationRequest.builder() \ - .request_body(CreateBizEntityTagRelationRequestBody.builder() - .tag_biz_type("chat") - .biz_entity_id("71616xxxx") - .tag_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateBizEntityTagRelationRequest = CreateBizEntityTagRelationRequest.builder() \ + .request_body(CreateBizEntityTagRelationRequestBody.builder() + .tag_biz_type("chat") + .biz_entity_id("71616xxxx") + .tag_ids([]) + .build()) \ + .build() - # 发起请求 - response: CreateBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.acreate(request) + # 发起请求 + response: CreateBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/create_tag_sample.py b/samples/api/im/v2/create_tag_sample.py index da3f4c8c3..619bff4a1 100644 --- a/samples/api/im/v2/create_tag_sample.py +++ b/samples/api/im/v2/create_tag_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTagRequest = CreateTagRequest.builder() \ - .request_body(CreateTagRequestBody.builder() - .create_tag(CreateTag.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTagRequest = CreateTagRequest.builder() \ + .request_body(CreateTagRequestBody.builder() + .create_tag(CreateTag.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTagResponse = client.im.v2.tag.create(request) + # 发起请求 + response: CreateTagResponse = client.im.v2.tag.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.tag.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.tag.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTagRequest = CreateTagRequest.builder() \ - .request_body(CreateTagRequestBody.builder() - .create_tag(CreateTag.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTagRequest = CreateTagRequest.builder() \ + .request_body(CreateTagRequestBody.builder() + .create_tag(CreateTag.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTagResponse = await client.im.v2.tag.acreate(request) + # 发起请求 + response: CreateTagResponse = await client.im.v2.tag.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.tag.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.tag.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/delete_app_feed_card_batch_sample.py b/samples/api/im/v2/delete_app_feed_card_batch_sample.py index 7d02dc380..5d47cf186 100644 --- a/samples/api/im/v2/delete_app_feed_card_batch_sample.py +++ b/samples/api/im/v2/delete_app_feed_card_batch_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppFeedCardBatchRequest = DeleteAppFeedCardBatchRequest.builder() \ - .user_id_type("open_id") \ - .request_body(DeleteAppFeedCardBatchRequestBody.builder() - .feed_cards([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteAppFeedCardBatchRequest = DeleteAppFeedCardBatchRequest.builder() \ + .user_id_type("open_id") \ + .request_body(DeleteAppFeedCardBatchRequestBody.builder() + .feed_cards([]) + .build()) \ + .build() - # 发起请求 - response: DeleteAppFeedCardBatchResponse = client.im.v2.app_feed_card_batch.delete(request) + # 发起请求 + response: DeleteAppFeedCardBatchResponse = client.im.v2.app_feed_card_batch.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card_batch.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card_batch.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAppFeedCardBatchRequest = DeleteAppFeedCardBatchRequest.builder() \ - .user_id_type("open_id") \ - .request_body(DeleteAppFeedCardBatchRequestBody.builder() - .feed_cards([]) - .build()) \ - .build() + # 构造请求对象 + request: DeleteAppFeedCardBatchRequest = DeleteAppFeedCardBatchRequest.builder() \ + .user_id_type("open_id") \ + .request_body(DeleteAppFeedCardBatchRequestBody.builder() + .feed_cards([]) + .build()) \ + .build() - # 发起请求 - response: DeleteAppFeedCardBatchResponse = await client.im.v2.app_feed_card_batch.adelete(request) + # 发起请求 + response: DeleteAppFeedCardBatchResponse = await client.im.v2.app_feed_card_batch.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card_batch.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card_batch.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/get_biz_entity_tag_relation_sample.py b/samples/api/im/v2/get_biz_entity_tag_relation_sample.py index 30fd62b74..0a7f99b21 100644 --- a/samples/api/im/v2/get_biz_entity_tag_relation_sample.py +++ b/samples/api/im/v2/get_biz_entity_tag_relation_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBizEntityTagRelationRequest = GetBizEntityTagRelationRequest.builder() \ - .tag_biz_type("chat") \ - .biz_entity_id("71616xxxx") \ - .build() + # 构造请求对象 + request: GetBizEntityTagRelationRequest = GetBizEntityTagRelationRequest.builder() \ + .tag_biz_type("chat") \ + .biz_entity_id("71616xxxx") \ + .build() - # 发起请求 - response: GetBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.get(request) + # 发起请求 + response: GetBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetBizEntityTagRelationRequest = GetBizEntityTagRelationRequest.builder() \ - .tag_biz_type("chat") \ - .biz_entity_id("71616xxxx") \ - .build() + # 构造请求对象 + request: GetBizEntityTagRelationRequest = GetBizEntityTagRelationRequest.builder() \ + .tag_biz_type("chat") \ + .biz_entity_id("71616xxxx") \ + .build() - # 发起请求 - response: GetBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.aget(request) + # 发起请求 + response: GetBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/patch_feed_card_sample.py b/samples/api/im/v2/patch_feed_card_sample.py index 59346eb40..80e8f9c59 100644 --- a/samples/api/im/v2/patch_feed_card_sample.py +++ b/samples/api/im/v2/patch_feed_card_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFeedCardRequest = PatchFeedCardRequest.builder() \ - .feed_card_id("oc_679eaeb583654bff73fefcc6e6371370") \ - .user_id_type("open_id") \ - .request_body(PatchFeedCardRequestBody.builder() - .time_sensitive(True) - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchFeedCardRequest = PatchFeedCardRequest.builder() \ + .feed_card_id("oc_679eaeb583654bff73fefcc6e6371370") \ + .user_id_type("open_id") \ + .request_body(PatchFeedCardRequestBody.builder() + .time_sensitive(True) + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: PatchFeedCardResponse = client.im.v2.feed_card.patch(request) + # 发起请求 + response: PatchFeedCardResponse = client.im.v2.feed_card.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.feed_card.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.feed_card.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchFeedCardRequest = PatchFeedCardRequest.builder() \ - .feed_card_id("oc_679eaeb583654bff73fefcc6e6371370") \ - .user_id_type("open_id") \ - .request_body(PatchFeedCardRequestBody.builder() - .time_sensitive(True) - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchFeedCardRequest = PatchFeedCardRequest.builder() \ + .feed_card_id("oc_679eaeb583654bff73fefcc6e6371370") \ + .user_id_type("open_id") \ + .request_body(PatchFeedCardRequestBody.builder() + .time_sensitive(True) + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: PatchFeedCardResponse = await client.im.v2.feed_card.apatch(request) + # 发起请求 + response: PatchFeedCardResponse = await client.im.v2.feed_card.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.feed_card.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.feed_card.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/patch_tag_sample.py b/samples/api/im/v2/patch_tag_sample.py index 6e50ea57d..f85cb2933 100644 --- a/samples/api/im/v2/patch_tag_sample.py +++ b/samples/api/im/v2/patch_tag_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTagRequest = PatchTagRequest.builder() \ - .tag_id("716168xxxxx") \ - .request_body(PatchTagRequestBody.builder() - .patch_tag(PatchTag.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchTagRequest = PatchTagRequest.builder() \ + .tag_id("716168xxxxx") \ + .request_body(PatchTagRequestBody.builder() + .patch_tag(PatchTag.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchTagResponse = client.im.v2.tag.patch(request) + # 发起请求 + response: PatchTagResponse = client.im.v2.tag.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.tag.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.tag.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTagRequest = PatchTagRequest.builder() \ - .tag_id("716168xxxxx") \ - .request_body(PatchTagRequestBody.builder() - .patch_tag(PatchTag.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchTagRequest = PatchTagRequest.builder() \ + .tag_id("716168xxxxx") \ + .request_body(PatchTagRequestBody.builder() + .patch_tag(PatchTag.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchTagResponse = await client.im.v2.tag.apatch(request) + # 发起请求 + response: PatchTagResponse = await client.im.v2.tag.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.tag.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.tag.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/update_app_feed_card_batch_sample.py b/samples/api/im/v2/update_app_feed_card_batch_sample.py index f3172271c..d7c8aa69b 100644 --- a/samples/api/im/v2/update_app_feed_card_batch_sample.py +++ b/samples/api/im/v2/update_app_feed_card_batch_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppFeedCardBatchRequest = UpdateAppFeedCardBatchRequest.builder() \ - .user_id_type("open_id") \ - .request_body(UpdateAppFeedCardBatchRequestBody.builder() - .feed_cards([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppFeedCardBatchRequest = UpdateAppFeedCardBatchRequest.builder() \ + .user_id_type("open_id") \ + .request_body(UpdateAppFeedCardBatchRequestBody.builder() + .feed_cards([]) + .build()) \ + .build() - # 发起请求 - response: UpdateAppFeedCardBatchResponse = client.im.v2.app_feed_card_batch.update(request) + # 发起请求 + response: UpdateAppFeedCardBatchResponse = client.im.v2.app_feed_card_batch.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card_batch.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card_batch.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateAppFeedCardBatchRequest = UpdateAppFeedCardBatchRequest.builder() \ - .user_id_type("open_id") \ - .request_body(UpdateAppFeedCardBatchRequestBody.builder() - .feed_cards([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateAppFeedCardBatchRequest = UpdateAppFeedCardBatchRequest.builder() \ + .user_id_type("open_id") \ + .request_body(UpdateAppFeedCardBatchRequestBody.builder() + .feed_cards([]) + .build()) \ + .build() - # 发起请求 - response: UpdateAppFeedCardBatchResponse = await client.im.v2.app_feed_card_batch.aupdate(request) + # 发起请求 + response: UpdateAppFeedCardBatchResponse = await client.im.v2.app_feed_card_batch.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.app_feed_card_batch.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.app_feed_card_batch.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/update_biz_entity_tag_relation_sample.py b/samples/api/im/v2/update_biz_entity_tag_relation_sample.py index 222920cd1..0f0921d92 100644 --- a/samples/api/im/v2/update_biz_entity_tag_relation_sample.py +++ b/samples/api/im/v2/update_biz_entity_tag_relation_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBizEntityTagRelationRequest = UpdateBizEntityTagRelationRequest.builder() \ - .request_body(UpdateBizEntityTagRelationRequestBody.builder() - .tag_biz_type("chat") - .biz_entity_id("7161681111") - .tag_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBizEntityTagRelationRequest = UpdateBizEntityTagRelationRequest.builder() \ + .request_body(UpdateBizEntityTagRelationRequestBody.builder() + .tag_biz_type("chat") + .biz_entity_id("7161681111") + .tag_ids([]) + .build()) \ + .build() - # 发起请求 - response: UpdateBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.update(request) + # 发起请求 + response: UpdateBizEntityTagRelationResponse = client.im.v2.biz_entity_tag_relation.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateBizEntityTagRelationRequest = UpdateBizEntityTagRelationRequest.builder() \ - .request_body(UpdateBizEntityTagRelationRequestBody.builder() - .tag_biz_type("chat") - .biz_entity_id("7161681111") - .tag_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateBizEntityTagRelationRequest = UpdateBizEntityTagRelationRequest.builder() \ + .request_body(UpdateBizEntityTagRelationRequestBody.builder() + .tag_biz_type("chat") + .biz_entity_id("7161681111") + .tag_ids([]) + .build()) \ + .build() - # 发起请求 - response: UpdateBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.aupdate(request) + # 发起请求 + response: UpdateBizEntityTagRelationResponse = await client.im.v2.biz_entity_tag_relation.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.biz_entity_tag_relation.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.biz_entity_tag_relation.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/im/v2/update_chat_button_sample.py b/samples/api/im/v2/update_chat_button_sample.py index ca69a793f..ca6b44f7c 100644 --- a/samples/api/im/v2/update_chat_button_sample.py +++ b/samples/api/im/v2/update_chat_button_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatButtonRequest = UpdateChatButtonRequest.builder() \ - .user_id_type("open_id") \ - .request_body(UpdateChatButtonRequestBody.builder() - .user_ids([]) - .chat_id("oc_a0553eda9014c201e6969b478895c230") - .buttons(OpenAppFeedCardButtons.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatButtonRequest = UpdateChatButtonRequest.builder() \ + .user_id_type("open_id") \ + .request_body(UpdateChatButtonRequestBody.builder() + .user_ids([]) + .chat_id("oc_a0553eda9014c201e6969b478895c230") + .buttons(OpenAppFeedCardButtons.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateChatButtonResponse = client.im.v2.chat_button.update(request) + # 发起请求 + response: UpdateChatButtonResponse = client.im.v2.chat_button.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.chat_button.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.chat_button.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateChatButtonRequest = UpdateChatButtonRequest.builder() \ - .user_id_type("open_id") \ - .request_body(UpdateChatButtonRequestBody.builder() - .user_ids([]) - .chat_id("oc_a0553eda9014c201e6969b478895c230") - .buttons(OpenAppFeedCardButtons.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateChatButtonRequest = UpdateChatButtonRequest.builder() \ + .user_id_type("open_id") \ + .request_body(UpdateChatButtonRequestBody.builder() + .user_ids([]) + .chat_id("oc_a0553eda9014c201e6969b478895c230") + .buttons(OpenAppFeedCardButtons.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateChatButtonResponse = await client.im.v2.chat_button.aupdate(request) + # 发起请求 + response: UpdateChatButtonResponse = await client.im.v2.chat_button.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.im.v2.chat_button.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.chat_button.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/create_draft_sample.py b/samples/api/lingo/v1/create_draft_sample.py index a2ced7dc5..8bc225edf 100644 --- a/samples/api/lingo/v1/create_draft_sample.py +++ b/samples/api/lingo/v1/create_draft_sample.py @@ -5,82 +5,80 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDraftRequest = CreateDraftRequest.builder() \ - .repo_id("7202510112396640276") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateDraftRequest = CreateDraftRequest.builder() \ + .repo_id("7202510112396640276") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: CreateDraftResponse = client.lingo.v1.draft.create(request) + # 发起请求 + response: CreateDraftResponse = client.lingo.v1.draft.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.draft.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.draft.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDraftRequest = CreateDraftRequest.builder() \ - .repo_id("7202510112396640276") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateDraftRequest = CreateDraftRequest.builder() \ + .repo_id("7202510112396640276") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: CreateDraftResponse = await client.lingo.v1.draft.acreate(request) + # 发起请求 + response: CreateDraftResponse = await client.lingo.v1.draft.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.draft.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.draft.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/create_entity_sample.py b/samples/api/lingo/v1/create_entity_sample.py index dc59c90d0..6ab032f33 100644 --- a/samples/api/lingo/v1/create_entity_sample.py +++ b/samples/api/lingo/v1/create_entity_sample.py @@ -5,80 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .repo_id("7152790921053274113") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .repo_id("7152790921053274113") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = client.lingo.v1.entity.create(request) + # 发起请求 + response: CreateEntityResponse = client.lingo.v1.entity.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateEntityRequest = CreateEntityRequest.builder() \ - .repo_id("7152790921053274113") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateEntityRequest = CreateEntityRequest.builder() \ + .repo_id("7152790921053274113") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: CreateEntityResponse = await client.lingo.v1.entity.acreate(request) + # 发起请求 + response: CreateEntityResponse = await client.lingo.v1.entity.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/delete_entity_sample.py b/samples/api/lingo/v1/delete_entity_sample.py index d54073248..a3a2fad80 100644 --- a/samples/api/lingo/v1/delete_entity_sample.py +++ b/samples/api/lingo/v1/delete_entity_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEntityRequest = DeleteEntityRequest.builder() \ - .entity_id("enterprise_43742132363") \ - .provider("星云") \ - .outer_id("123aaa") \ - .build() + # 构造请求对象 + request: DeleteEntityRequest = DeleteEntityRequest.builder() \ + .entity_id("enterprise_43742132363") \ + .provider("星云") \ + .outer_id("123aaa") \ + .build() - # 发起请求 - response: DeleteEntityResponse = client.lingo.v1.entity.delete(request) + # 发起请求 + response: DeleteEntityResponse = client.lingo.v1.entity.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteEntityRequest = DeleteEntityRequest.builder() \ - .entity_id("enterprise_43742132363") \ - .provider("星云") \ - .outer_id("123aaa") \ - .build() + # 构造请求对象 + request: DeleteEntityRequest = DeleteEntityRequest.builder() \ + .entity_id("enterprise_43742132363") \ + .provider("星云") \ + .outer_id("123aaa") \ + .build() - # 发起请求 - response: DeleteEntityResponse = await client.lingo.v1.entity.adelete(request) + # 发起请求 + response: DeleteEntityResponse = await client.lingo.v1.entity.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/download_file_sample.py b/samples/api/lingo/v1/download_file_sample.py index 4eab77a05..b455493b8 100644 --- a/samples/api/lingo/v1/download_file_sample.py +++ b/samples/api/lingo/v1/download_file_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("str") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("str") \ + .build() - # 发起请求 - response: DownloadFileResponse = client.lingo.v1.file.download(request) + # 发起请求 + response: DownloadFileResponse = client.lingo.v1.file.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.file.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadFileRequest = DownloadFileRequest.builder() \ - .file_token("str") \ - .build() + # 构造请求对象 + request: DownloadFileRequest = DownloadFileRequest.builder() \ + .file_token("str") \ + .build() - # 发起请求 - response: DownloadFileResponse = await client.lingo.v1.file.adownload(request) + # 发起请求 + response: DownloadFileResponse = await client.lingo.v1.file.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.file.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/get_entity_sample.py b/samples/api/lingo/v1/get_entity_sample.py index eaaa51828..f717d5543 100644 --- a/samples/api/lingo/v1/get_entity_sample.py +++ b/samples/api/lingo/v1/get_entity_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEntityRequest = GetEntityRequest.builder() \ - .entity_id("enterprise_0") \ - .provider("星云") \ - .outer_id("123aaa") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetEntityRequest = GetEntityRequest.builder() \ + .entity_id("enterprise_0") \ + .provider("星云") \ + .outer_id("123aaa") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetEntityResponse = client.lingo.v1.entity.get(request) + # 发起请求 + response: GetEntityResponse = client.lingo.v1.entity.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetEntityRequest = GetEntityRequest.builder() \ - .entity_id("enterprise_0") \ - .provider("星云") \ - .outer_id("123aaa") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetEntityRequest = GetEntityRequest.builder() \ + .entity_id("enterprise_0") \ + .provider("星云") \ + .outer_id("123aaa") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetEntityResponse = await client.lingo.v1.entity.aget(request) + # 发起请求 + response: GetEntityResponse = await client.lingo.v1.entity.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/highlight_entity_sample.py b/samples/api/lingo/v1/highlight_entity_sample.py index 8115ab516..51ac5fb3a 100644 --- a/samples/api/lingo/v1/highlight_entity_sample.py +++ b/samples/api/lingo/v1/highlight_entity_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: HighlightEntityRequest = HighlightEntityRequest.builder() \ - .request_body(HighlightEntityRequestBody.builder() - .text("企业百科是飞书提供的一款知识管理工具") - .build()) \ - .build() + # 构造请求对象 + request: HighlightEntityRequest = HighlightEntityRequest.builder() \ + .request_body(HighlightEntityRequestBody.builder() + .text("企业百科是飞书提供的一款知识管理工具") + .build()) \ + .build() - # 发起请求 - response: HighlightEntityResponse = client.lingo.v1.entity.highlight(request) + # 发起请求 + response: HighlightEntityResponse = client.lingo.v1.entity.highlight(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.highlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.highlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: HighlightEntityRequest = HighlightEntityRequest.builder() \ - .request_body(HighlightEntityRequestBody.builder() - .text("企业百科是飞书提供的一款知识管理工具") - .build()) \ - .build() + # 构造请求对象 + request: HighlightEntityRequest = HighlightEntityRequest.builder() \ + .request_body(HighlightEntityRequestBody.builder() + .text("企业百科是飞书提供的一款知识管理工具") + .build()) \ + .build() - # 发起请求 - response: HighlightEntityResponse = await client.lingo.v1.entity.ahighlight(request) + # 发起请求 + response: HighlightEntityResponse = await client.lingo.v1.entity.ahighlight(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.ahighlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.ahighlight failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/list_classification_sample.py b/samples/api/lingo/v1/list_classification_sample.py index e7ab2511d..285e6fb5c 100644 --- a/samples/api/lingo/v1/list_classification_sample.py +++ b/samples/api/lingo/v1/list_classification_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListClassificationRequest = ListClassificationRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .repo_id("7202510112396640276") \ - .build() + # 构造请求对象 + request: ListClassificationRequest = ListClassificationRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .repo_id("7202510112396640276") \ + .build() - # 发起请求 - response: ListClassificationResponse = client.lingo.v1.classification.list(request) + # 发起请求 + response: ListClassificationResponse = client.lingo.v1.classification.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.classification.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.classification.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListClassificationRequest = ListClassificationRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .repo_id("7202510112396640276") \ - .build() + # 构造请求对象 + request: ListClassificationRequest = ListClassificationRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .repo_id("7202510112396640276") \ + .build() - # 发起请求 - response: ListClassificationResponse = await client.lingo.v1.classification.alist(request) + # 发起请求 + response: ListClassificationResponse = await client.lingo.v1.classification.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.classification.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.classification.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/list_entity_sample.py b/samples/api/lingo/v1/list_entity_sample.py index 84d1eae4a..129342f41 100644 --- a/samples/api/lingo/v1/list_entity_sample.py +++ b/samples/api/lingo/v1/list_entity_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEntityRequest = ListEntityRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .provider("星云") \ - .repo_id("7152790921053274113") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEntityRequest = ListEntityRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .provider("星云") \ + .repo_id("7152790921053274113") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEntityResponse = client.lingo.v1.entity.list(request) + # 发起请求 + response: ListEntityResponse = client.lingo.v1.entity.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListEntityRequest = ListEntityRequest.builder() \ - .page_size(20) \ - .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ - .provider("星云") \ - .repo_id("7152790921053274113") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListEntityRequest = ListEntityRequest.builder() \ + .page_size(20) \ + .page_token("408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba") \ + .provider("星云") \ + .repo_id("7152790921053274113") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListEntityResponse = await client.lingo.v1.entity.alist(request) + # 发起请求 + response: ListEntityResponse = await client.lingo.v1.entity.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/list_repo_sample.py b/samples/api/lingo/v1/list_repo_sample.py index 3f3decdd8..992853477 100644 --- a/samples/api/lingo/v1/list_repo_sample.py +++ b/samples/api/lingo/v1/list_repo_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRepoRequest = ListRepoRequest.builder() \ - .build() + # 构造请求对象 + request: ListRepoRequest = ListRepoRequest.builder() \ + .build() - # 发起请求 - response: ListRepoResponse = client.lingo.v1.repo.list(request) + # 发起请求 + response: ListRepoResponse = client.lingo.v1.repo.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.repo.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.repo.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRepoRequest = ListRepoRequest.builder() \ - .build() + # 构造请求对象 + request: ListRepoRequest = ListRepoRequest.builder() \ + .build() - # 发起请求 - response: ListRepoResponse = await client.lingo.v1.repo.alist(request) + # 发起请求 + response: ListRepoResponse = await client.lingo.v1.repo.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.repo.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.repo.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/match_entity_sample.py b/samples/api/lingo/v1/match_entity_sample.py index f9a0f9e4b..63639a876 100644 --- a/samples/api/lingo/v1/match_entity_sample.py +++ b/samples/api/lingo/v1/match_entity_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchEntityRequest = MatchEntityRequest.builder() \ - .repo_id("7202510112396640276") \ - .request_body(MatchEntityRequestBody.builder() - .word("企业百科") - .build()) \ - .build() + # 构造请求对象 + request: MatchEntityRequest = MatchEntityRequest.builder() \ + .repo_id("7202510112396640276") \ + .request_body(MatchEntityRequestBody.builder() + .word("企业百科") + .build()) \ + .build() - # 发起请求 - response: MatchEntityResponse = client.lingo.v1.entity.match(request) + # 发起请求 + response: MatchEntityResponse = client.lingo.v1.entity.match(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.match failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MatchEntityRequest = MatchEntityRequest.builder() \ - .repo_id("7202510112396640276") \ - .request_body(MatchEntityRequestBody.builder() - .word("企业百科") - .build()) \ - .build() + # 构造请求对象 + request: MatchEntityRequest = MatchEntityRequest.builder() \ + .repo_id("7202510112396640276") \ + .request_body(MatchEntityRequestBody.builder() + .word("企业百科") + .build()) \ + .build() - # 发起请求 - response: MatchEntityResponse = await client.lingo.v1.entity.amatch(request) + # 发起请求 + response: MatchEntityResponse = await client.lingo.v1.entity.amatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.amatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/search_entity_sample.py b/samples/api/lingo/v1/search_entity_sample.py index f635718e3..110fcb4e5 100644 --- a/samples/api/lingo/v1/search_entity_sample.py +++ b/samples/api/lingo/v1/search_entity_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEntityRequest = SearchEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .repo_id("7202510112396640276") \ - .user_id_type("user_id") \ - .request_body(SearchEntityRequestBody.builder() - .query("飞书词典") - .classification_filter(ClassificationFilter.builder().build()) - .sources([]) - .creators([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEntityRequest = SearchEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .repo_id("7202510112396640276") \ + .user_id_type("user_id") \ + .request_body(SearchEntityRequestBody.builder() + .query("飞书词典") + .classification_filter(ClassificationFilter.builder().build()) + .sources([]) + .creators([]) + .build()) \ + .build() - # 发起请求 - response: SearchEntityResponse = client.lingo.v1.entity.search(request) + # 发起请求 + response: SearchEntityResponse = client.lingo.v1.entity.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchEntityRequest = SearchEntityRequest.builder() \ - .page_size(20) \ - .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ - .repo_id("7202510112396640276") \ - .user_id_type("user_id") \ - .request_body(SearchEntityRequestBody.builder() - .query("飞书词典") - .classification_filter(ClassificationFilter.builder().build()) - .sources([]) - .creators([]) - .build()) \ - .build() + # 构造请求对象 + request: SearchEntityRequest = SearchEntityRequest.builder() \ + .page_size(20) \ + .page_token("b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c") \ + .repo_id("7202510112396640276") \ + .user_id_type("user_id") \ + .request_body(SearchEntityRequestBody.builder() + .query("飞书词典") + .classification_filter(ClassificationFilter.builder().build()) + .sources([]) + .creators([]) + .build()) \ + .build() - # 发起请求 - response: SearchEntityResponse = await client.lingo.v1.entity.asearch(request) + # 发起请求 + response: SearchEntityResponse = await client.lingo.v1.entity.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/update_draft_sample.py b/samples/api/lingo/v1/update_draft_sample.py index 3bcaaeb3f..303e47d6a 100644 --- a/samples/api/lingo/v1/update_draft_sample.py +++ b/samples/api/lingo/v1/update_draft_sample.py @@ -5,80 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDraftRequest = UpdateDraftRequest.builder() \ - .draft_id("7241543272228814852") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateDraftRequest = UpdateDraftRequest.builder() \ + .draft_id("7241543272228814852") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateDraftResponse = client.lingo.v1.draft.update(request) + # 发起请求 + response: UpdateDraftResponse = client.lingo.v1.draft.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.draft.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.draft.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateDraftRequest = UpdateDraftRequest.builder() \ - .draft_id("7241543272228814852") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .id("enterprise_40217521") - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateDraftRequest = UpdateDraftRequest.builder() \ + .draft_id("7241543272228814852") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .id("enterprise_40217521") + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateDraftResponse = await client.lingo.v1.draft.aupdate(request) + # 发起请求 + response: UpdateDraftResponse = await client.lingo.v1.draft.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.draft.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.draft.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/update_entity_sample.py b/samples/api/lingo/v1/update_entity_sample.py index 49192afdd..a1f390e68 100644 --- a/samples/api/lingo/v1/update_entity_sample.py +++ b/samples/api/lingo/v1/update_entity_sample.py @@ -5,80 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .entity_id("enterprise_40217521") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .entity_id("enterprise_40217521") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = client.lingo.v1.entity.update(request) + # 发起请求 + response: UpdateEntityResponse = client.lingo.v1.entity.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateEntityRequest = UpdateEntityRequest.builder() \ - .entity_id("enterprise_40217521") \ - .user_id_type("user_id") \ - .request_body(Entity.builder() - .main_keys([]) - .aliases([]) - .description( - "企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") - .related_meta(RelatedMeta.builder().build()) - .outer_info(OuterInfo.builder().build()) - .rich_text("") - .i18n_descs([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateEntityRequest = UpdateEntityRequest.builder() \ + .entity_id("enterprise_40217521") \ + .user_id_type("user_id") \ + .request_body(Entity.builder() + .main_keys([]) + .aliases([]) + .description("企业百科是飞书提供的一款知识管理工具,通过企业百科可以帮助企业将分散的知识信息进行聚合,并通过UGC的方式,促进企业知识的保鲜和流通") + .related_meta(RelatedMeta.builder().build()) + .outer_info(OuterInfo.builder().build()) + .rich_text("") + .i18n_descs([]) + .build()) \ + .build() - # 发起请求 - response: UpdateEntityResponse = await client.lingo.v1.entity.aupdate(request) + # 发起请求 + response: UpdateEntityResponse = await client.lingo.v1.entity.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.entity.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/lingo/v1/upload_file_sample.py b/samples/api/lingo/v1/upload_file_sample.py index 4dc4f4cf6..4e7631d54 100644 --- a/samples/api/lingo/v1/upload_file_sample.py +++ b/samples/api/lingo/v1/upload_file_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .request_body(File.builder() - .name("示例图片.png") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .request_body(File.builder() + .name("示例图片.png") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = client.lingo.v1.file.upload(request) + # 发起请求 + response: UploadFileResponse = client.lingo.v1.file.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.file.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadFileRequest = UploadFileRequest.builder() \ - .request_body(File.builder() - .name("示例图片.png") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadFileRequest = UploadFileRequest.builder() \ + .request_body(File.builder() + .name("示例图片.png") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadFileResponse = await client.lingo.v1.file.aupload(request) + # 发起请求 + response: UploadFileResponse = await client.lingo.v1.file.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.lingo.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.lingo.v1.file.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_create_mailgroup_manager_sample.py b/samples/api/mail/v1/batch_create_mailgroup_manager_sample.py index 69bd722c7..9dc8ea283 100644 --- a/samples/api/mail/v1/batch_create_mailgroup_manager_sample.py +++ b/samples/api/mail/v1/batch_create_mailgroup_manager_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupManagerRequest = BatchCreateMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ - .user_id_type("open_id") \ - .request_body(BatchCreateMailgroupManagerRequestBody.builder() - .mailgroup_manager_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupManagerRequest = BatchCreateMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ + .user_id_type("open_id") \ + .request_body(BatchCreateMailgroupManagerRequestBody.builder() + .mailgroup_manager_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupManagerResponse = client.mail.v1.mailgroup_manager.batch_create(request) + # 发起请求 + response: BatchCreateMailgroupManagerResponse = client.mail.v1.mailgroup_manager.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupManagerRequest = BatchCreateMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ - .user_id_type("open_id") \ - .request_body(BatchCreateMailgroupManagerRequestBody.builder() - .mailgroup_manager_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupManagerRequest = BatchCreateMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ + .user_id_type("open_id") \ + .request_body(BatchCreateMailgroupManagerRequestBody.builder() + .mailgroup_manager_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.abatch_create(request) + # 发起请求 + response: BatchCreateMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_create_mailgroup_member_sample.py b/samples/api/mail/v1/batch_create_mailgroup_member_sample.py index f888663a3..d47503de7 100644 --- a/samples/api/mail/v1/batch_create_mailgroup_member_sample.py +++ b/samples/api/mail/v1/batch_create_mailgroup_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupMemberRequest = BatchCreateMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .department_id_type("department_id") \ - .request_body(BatchCreateMailgroupMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupMemberRequest = BatchCreateMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .department_id_type("department_id") \ + .request_body(BatchCreateMailgroupMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupMemberResponse = client.mail.v1.mailgroup_member.batch_create(request) + # 发起请求 + response: BatchCreateMailgroupMemberResponse = client.mail.v1.mailgroup_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupMemberRequest = BatchCreateMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .department_id_type("department_id") \ - .request_body(BatchCreateMailgroupMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupMemberRequest = BatchCreateMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .department_id_type("department_id") \ + .request_body(BatchCreateMailgroupMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupMemberResponse = await client.mail.v1.mailgroup_member.abatch_create(request) + # 发起请求 + response: BatchCreateMailgroupMemberResponse = await client.mail.v1.mailgroup_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_create_mailgroup_permission_member_sample.py b/samples/api/mail/v1/batch_create_mailgroup_permission_member_sample.py index 4bcee2c07..797540f52 100644 --- a/samples/api/mail/v1/batch_create_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/batch_create_mailgroup_permission_member_sample.py @@ -5,70 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupPermissionMemberRequest = BatchCreateMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchCreateMailgroupPermissionMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupPermissionMemberRequest = BatchCreateMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchCreateMailgroupPermissionMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.batch_create( - request) + # 发起请求 + response: BatchCreateMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreateMailgroupPermissionMemberRequest = BatchCreateMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .department_id_type("open_department_id") \ - .request_body(BatchCreateMailgroupPermissionMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreateMailgroupPermissionMemberRequest = BatchCreateMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .department_id_type("open_department_id") \ + .request_body(BatchCreateMailgroupPermissionMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreateMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.abatch_create( - request) + # 发起请求 + response: BatchCreateMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_create_public_mailbox_member_sample.py b/samples/api/mail/v1/batch_create_public_mailbox_member_sample.py index 132742cf2..5415ac32e 100644 --- a/samples/api/mail/v1/batch_create_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/batch_create_public_mailbox_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreatePublicMailboxMemberRequest = BatchCreatePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .request_body(BatchCreatePublicMailboxMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreatePublicMailboxMemberRequest = BatchCreatePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .request_body(BatchCreatePublicMailboxMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreatePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.batch_create(request) + # 发起请求 + response: BatchCreatePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.batch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.batch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCreatePublicMailboxMemberRequest = BatchCreatePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .request_body(BatchCreatePublicMailboxMemberRequestBody.builder() - .items([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCreatePublicMailboxMemberRequest = BatchCreatePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .request_body(BatchCreatePublicMailboxMemberRequestBody.builder() + .items([]) + .build()) \ + .build() - # 发起请求 - response: BatchCreatePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.abatch_create(request) + # 发起请求 + response: BatchCreatePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.abatch_create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.abatch_create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_delete_mailgroup_manager_sample.py b/samples/api/mail/v1/batch_delete_mailgroup_manager_sample.py index 88d858066..b32c6f824 100644 --- a/samples/api/mail/v1/batch_delete_mailgroup_manager_sample.py +++ b/samples/api/mail/v1/batch_delete_mailgroup_manager_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupManagerRequest = BatchDeleteMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .request_body(BatchDeleteMailgroupManagerRequestBody.builder() - .mailgroup_manager_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupManagerRequest = BatchDeleteMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .request_body(BatchDeleteMailgroupManagerRequestBody.builder() + .mailgroup_manager_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupManagerResponse = client.mail.v1.mailgroup_manager.batch_delete(request) + # 发起请求 + response: BatchDeleteMailgroupManagerResponse = client.mail.v1.mailgroup_manager.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupManagerRequest = BatchDeleteMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("open_id") \ - .request_body(BatchDeleteMailgroupManagerRequestBody.builder() - .mailgroup_manager_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupManagerRequest = BatchDeleteMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("open_id") \ + .request_body(BatchDeleteMailgroupManagerRequestBody.builder() + .mailgroup_manager_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.abatch_delete(request) + # 发起请求 + response: BatchDeleteMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_delete_mailgroup_member_sample.py b/samples/api/mail/v1/batch_delete_mailgroup_member_sample.py index 8cc1177f9..68df393dc 100644 --- a/samples/api/mail/v1/batch_delete_mailgroup_member_sample.py +++ b/samples/api/mail/v1/batch_delete_mailgroup_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupMemberRequest = BatchDeleteMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .request_body(BatchDeleteMailgroupMemberRequestBody.builder() - .member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupMemberRequest = BatchDeleteMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .request_body(BatchDeleteMailgroupMemberRequestBody.builder() + .member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupMemberResponse = client.mail.v1.mailgroup_member.batch_delete(request) + # 发起请求 + response: BatchDeleteMailgroupMemberResponse = client.mail.v1.mailgroup_member.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupMemberRequest = BatchDeleteMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .request_body(BatchDeleteMailgroupMemberRequestBody.builder() - .member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupMemberRequest = BatchDeleteMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .request_body(BatchDeleteMailgroupMemberRequestBody.builder() + .member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupMemberResponse = await client.mail.v1.mailgroup_member.abatch_delete(request) + # 发起请求 + response: BatchDeleteMailgroupMemberResponse = await client.mail.v1.mailgroup_member.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_delete_mailgroup_permission_member_sample.py b/samples/api/mail/v1/batch_delete_mailgroup_permission_member_sample.py index 19851fb47..c933eb3d6 100644 --- a/samples/api/mail/v1/batch_delete_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/batch_delete_mailgroup_permission_member_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupPermissionMemberRequest = BatchDeleteMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .request_body(BatchDeleteMailgroupPermissionMemberRequestBody.builder() - .permission_member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupPermissionMemberRequest = BatchDeleteMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .request_body(BatchDeleteMailgroupPermissionMemberRequestBody.builder() + .permission_member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.batch_delete( - request) + # 发起请求 + response: BatchDeleteMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteMailgroupPermissionMemberRequest = BatchDeleteMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .request_body(BatchDeleteMailgroupPermissionMemberRequestBody.builder() - .permission_member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteMailgroupPermissionMemberRequest = BatchDeleteMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .request_body(BatchDeleteMailgroupPermissionMemberRequestBody.builder() + .permission_member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.abatch_delete( - request) + # 发起请求 + response: BatchDeleteMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/batch_delete_public_mailbox_member_sample.py b/samples/api/mail/v1/batch_delete_public_mailbox_member_sample.py index bbf3fafb3..ef64acd32 100644 --- a/samples/api/mail/v1/batch_delete_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/batch_delete_public_mailbox_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeletePublicMailboxMemberRequest = BatchDeletePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .request_body(BatchDeletePublicMailboxMemberRequestBody.builder() - .member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeletePublicMailboxMemberRequest = BatchDeletePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .request_body(BatchDeletePublicMailboxMemberRequestBody.builder() + .member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeletePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.batch_delete(request) + # 发起请求 + response: BatchDeletePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.batch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.batch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeletePublicMailboxMemberRequest = BatchDeletePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .request_body(BatchDeletePublicMailboxMemberRequestBody.builder() - .member_id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeletePublicMailboxMemberRequest = BatchDeletePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .request_body(BatchDeletePublicMailboxMemberRequestBody.builder() + .member_id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeletePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.abatch_delete(request) + # 发起请求 + response: BatchDeletePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.abatch_delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.abatch_delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/clear_public_mailbox_member_sample.py b/samples/api/mail/v1/clear_public_mailbox_member_sample.py index d885efcf5..d572f40bc 100644 --- a/samples/api/mail/v1/clear_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/clear_public_mailbox_member_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ClearPublicMailboxMemberRequest = ClearPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .build() + # 构造请求对象 + request: ClearPublicMailboxMemberRequest = ClearPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .build() - # 发起请求 - response: ClearPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.clear(request) + # 发起请求 + response: ClearPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.clear(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.clear failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.clear failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ClearPublicMailboxMemberRequest = ClearPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .build() + # 构造请求对象 + request: ClearPublicMailboxMemberRequest = ClearPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .build() - # 发起请求 - response: ClearPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.aclear(request) + # 发起请求 + response: ClearPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.aclear(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.aclear failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.aclear failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_mailgroup_alias_sample.py b/samples/api/mail/v1/create_mailgroup_alias_sample.py index 8db9209f1..25d006a00 100644 --- a/samples/api/mail/v1/create_mailgroup_alias_sample.py +++ b/samples/api/mail/v1/create_mailgroup_alias_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupAliasRequest = CreateMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxx 或者 xxx@xx.xxx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupAliasRequest = CreateMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxx 或者 xxx@xx.xxx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupAliasResponse = client.mail.v1.mailgroup_alias.create(request) + # 发起请求 + response: CreateMailgroupAliasResponse = client.mail.v1.mailgroup_alias.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupAliasRequest = CreateMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxx 或者 xxx@xx.xxx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupAliasRequest = CreateMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxx 或者 xxx@xx.xxx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.acreate(request) + # 发起请求 + response: CreateMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_mailgroup_member_sample.py b/samples/api/mail/v1/create_mailgroup_member_sample.py index ca4839ea3..4a1f57200 100644 --- a/samples/api/mail/v1/create_mailgroup_member_sample.py +++ b/samples/api/mail/v1/create_mailgroup_member_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupMemberRequest = CreateMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .request_body(MailgroupMember.builder() - .email("test_memeber@xxx.xx") - .user_id("xxxxxxxxxx") - .department_id("xxxxxxxxxx") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupMemberRequest = CreateMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .request_body(MailgroupMember.builder() + .email("test_memeber@xxx.xx") + .user_id("xxxxxxxxxx") + .department_id("xxxxxxxxxx") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupMemberResponse = client.mail.v1.mailgroup_member.create(request) + # 发起请求 + response: CreateMailgroupMemberResponse = client.mail.v1.mailgroup_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupMemberRequest = CreateMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .request_body(MailgroupMember.builder() - .email("test_memeber@xxx.xx") - .user_id("xxxxxxxxxx") - .department_id("xxxxxxxxxx") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupMemberRequest = CreateMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .request_body(MailgroupMember.builder() + .email("test_memeber@xxx.xx") + .user_id("xxxxxxxxxx") + .department_id("xxxxxxxxxx") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupMemberResponse = await client.mail.v1.mailgroup_member.acreate(request) + # 发起请求 + response: CreateMailgroupMemberResponse = await client.mail.v1.mailgroup_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_mailgroup_permission_member_sample.py b/samples/api/mail/v1/create_mailgroup_permission_member_sample.py index 0aa8cc861..8be694559 100644 --- a/samples/api/mail/v1/create_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/create_mailgroup_permission_member_sample.py @@ -5,75 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupPermissionMemberRequest = CreateMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("xxx") \ - .request_body(MailgroupPermissionMember.builder() - .user_id("xxxxxxxxxx") - .department_id("xxxxxxxxxx") - .email("xxx@xx.x") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupPermissionMemberRequest = CreateMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("xxx") \ + .request_body(MailgroupPermissionMember.builder() + .user_id("xxxxxxxxxx") + .department_id("xxxxxxxxxx") + .email("xxx@xx.x") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.create(request) + # 发起请求 + response: CreateMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupPermissionMemberRequest = CreateMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("xxx") \ - .request_body(MailgroupPermissionMember.builder() - .user_id("xxxxxxxxxx") - .department_id("xxxxxxxxxx") - .email("xxx@xx.x") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupPermissionMemberRequest = CreateMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("xxx") \ + .request_body(MailgroupPermissionMember.builder() + .user_id("xxxxxxxxxx") + .department_id("xxxxxxxxxx") + .email("xxx@xx.x") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.acreate( - request) + # 发起请求 + response: CreateMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_mailgroup_sample.py b/samples/api/mail/v1/create_mailgroup_sample.py index cf210e127..93655f569 100644 --- a/samples/api/mail/v1/create_mailgroup_sample.py +++ b/samples/api/mail/v1/create_mailgroup_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupRequest = CreateMailgroupRequest.builder() \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupRequest = CreateMailgroupRequest.builder() \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupResponse = client.mail.v1.mailgroup.create(request) + # 发起请求 + response: CreateMailgroupResponse = client.mail.v1.mailgroup.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMailgroupRequest = CreateMailgroupRequest.builder() \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: CreateMailgroupRequest = CreateMailgroupRequest.builder() \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: CreateMailgroupResponse = await client.mail.v1.mailgroup.acreate(request) + # 发起请求 + response: CreateMailgroupResponse = await client.mail.v1.mailgroup.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_public_mailbox_alias_sample.py b/samples/api/mail/v1/create_public_mailbox_alias_sample.py index d6cbbdd83..45bcb8bc6 100644 --- a/samples/api/mail/v1/create_public_mailbox_alias_sample.py +++ b/samples/api/mail/v1/create_public_mailbox_alias_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxAliasRequest = CreatePublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxAliasRequest = CreatePublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.create(request) + # 发起请求 + response: CreatePublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxAliasRequest = CreatePublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxAliasRequest = CreatePublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.acreate(request) + # 发起请求 + response: CreatePublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_public_mailbox_member_sample.py b/samples/api/mail/v1/create_public_mailbox_member_sample.py index 576b5f40c..da5b3da92 100644 --- a/samples/api/mail/v1/create_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/create_public_mailbox_member_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxMemberRequest = CreatePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .request_body(PublicMailboxMember.builder() - .user_id("xxxxxxxxxx") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxMemberRequest = CreatePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .request_body(PublicMailboxMember.builder() + .user_id("xxxxxxxxxx") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.create(request) + # 发起请求 + response: CreatePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxMemberRequest = CreatePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .request_body(PublicMailboxMember.builder() - .user_id("xxxxxxxxxx") - .type("USER") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxMemberRequest = CreatePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .request_body(PublicMailboxMember.builder() + .user_id("xxxxxxxxxx") + .type("USER") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.acreate(request) + # 发起请求 + response: CreatePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_public_mailbox_sample.py b/samples/api/mail/v1/create_public_mailbox_sample.py index 5321721a7..a1b4b0294 100644 --- a/samples/api/mail/v1/create_public_mailbox_sample.py +++ b/samples/api/mail/v1/create_public_mailbox_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxRequest = CreatePublicMailboxRequest.builder() \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .geo("cn") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxRequest = CreatePublicMailboxRequest.builder() \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .geo("cn") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxResponse = client.mail.v1.public_mailbox.create(request) + # 发起请求 + response: CreatePublicMailboxResponse = client.mail.v1.public_mailbox.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePublicMailboxRequest = CreatePublicMailboxRequest.builder() \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .geo("cn") - .build()) \ - .build() + # 构造请求对象 + request: CreatePublicMailboxRequest = CreatePublicMailboxRequest.builder() \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .geo("cn") + .build()) \ + .build() - # 发起请求 - response: CreatePublicMailboxResponse = await client.mail.v1.public_mailbox.acreate(request) + # 发起请求 + response: CreatePublicMailboxResponse = await client.mail.v1.public_mailbox.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/create_user_mailbox_alias_sample.py b/samples/api/mail/v1/create_user_mailbox_alias_sample.py index dcde37a90..b9dbf53d5 100644 --- a/samples/api/mail/v1/create_user_mailbox_alias_sample.py +++ b/samples/api/mail/v1/create_user_mailbox_alias_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserMailboxAliasRequest = CreateUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreateUserMailboxAliasRequest = CreateUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreateUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.create(request) + # 发起请求 + response: CreateUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateUserMailboxAliasRequest = CreateUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .request_body(EmailAlias.builder() - .email_alias("email_alias@xxx.xx") - .build()) \ - .build() + # 构造请求对象 + request: CreateUserMailboxAliasRequest = CreateUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .request_body(EmailAlias.builder() + .email_alias("email_alias@xxx.xx") + .build()) \ + .build() - # 发起请求 - response: CreateUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.acreate(request) + # 发起请求 + response: CreateUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_mailgroup_alias_sample.py b/samples/api/mail/v1/delete_mailgroup_alias_sample.py index 6d81c0011..c567051ca 100644 --- a/samples/api/mail/v1/delete_mailgroup_alias_sample.py +++ b/samples/api/mail/v1/delete_mailgroup_alias_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupAliasRequest = DeleteMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_group@xx.xxx") \ - .alias_id("xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupAliasRequest = DeleteMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_group@xx.xxx") \ + .alias_id("xxx@xx.xxx") \ + .build() - # 发起请求 - response: DeleteMailgroupAliasResponse = client.mail.v1.mailgroup_alias.delete(request) + # 发起请求 + response: DeleteMailgroupAliasResponse = client.mail.v1.mailgroup_alias.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupAliasRequest = DeleteMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_group@xx.xxx") \ - .alias_id("xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupAliasRequest = DeleteMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_group@xx.xxx") \ + .alias_id("xxx@xx.xxx") \ + .build() - # 发起请求 - response: DeleteMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.adelete(request) + # 发起请求 + response: DeleteMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_mailgroup_member_sample.py b/samples/api/mail/v1/delete_mailgroup_member_sample.py index 44c509a2c..c6321b570 100644 --- a/samples/api/mail/v1/delete_mailgroup_member_sample.py +++ b/samples/api/mail/v1/delete_mailgroup_member_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupMemberRequest = DeleteMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupMemberRequest = DeleteMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeleteMailgroupMemberResponse = client.mail.v1.mailgroup_member.delete(request) + # 发起请求 + response: DeleteMailgroupMemberResponse = client.mail.v1.mailgroup_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupMemberRequest = DeleteMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupMemberRequest = DeleteMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeleteMailgroupMemberResponse = await client.mail.v1.mailgroup_member.adelete(request) + # 发起请求 + response: DeleteMailgroupMemberResponse = await client.mail.v1.mailgroup_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py b/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py index d36701e58..bb52d7838 100644 --- a/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupPermissionMemberRequest = DeleteMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .permission_member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupPermissionMemberRequest = DeleteMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .permission_member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeleteMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.delete(request) + # 发起请求 + response: DeleteMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupPermissionMemberRequest = DeleteMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .permission_member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupPermissionMemberRequest = DeleteMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .permission_member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeleteMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.adelete( - request) + # 发起请求 + response: DeleteMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_mailgroup_sample.py b/samples/api/mail/v1/delete_mailgroup_sample.py index b99f7c2e9..747645cd7 100644 --- a/samples/api/mail/v1/delete_mailgroup_sample.py +++ b/samples/api/mail/v1/delete_mailgroup_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupRequest = DeleteMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupRequest = DeleteMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: DeleteMailgroupResponse = client.mail.v1.mailgroup.delete(request) + # 发起请求 + response: DeleteMailgroupResponse = client.mail.v1.mailgroup.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteMailgroupRequest = DeleteMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: DeleteMailgroupRequest = DeleteMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: DeleteMailgroupResponse = await client.mail.v1.mailgroup.adelete(request) + # 发起请求 + response: DeleteMailgroupResponse = await client.mail.v1.mailgroup.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_public_mailbox_alias_sample.py b/samples/api/mail/v1/delete_public_mailbox_alias_sample.py index 0e819e881..f7bce62e8 100644 --- a/samples/api/mail/v1/delete_public_mailbox_alias_sample.py +++ b/samples/api/mail/v1/delete_public_mailbox_alias_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxAliasRequest = DeletePublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .alias_id("xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxAliasRequest = DeletePublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .alias_id("xxx@xx.xxx") \ + .build() - # 发起请求 - response: DeletePublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.delete(request) + # 发起请求 + response: DeletePublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxAliasRequest = DeletePublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .alias_id("xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxAliasRequest = DeletePublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .alias_id("xxx@xx.xxx") \ + .build() - # 发起请求 - response: DeletePublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.adelete(request) + # 发起请求 + response: DeletePublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_public_mailbox_member_sample.py b/samples/api/mail/v1/delete_public_mailbox_member_sample.py index 1b7e3014d..976ec0fc5 100644 --- a/samples/api/mail/v1/delete_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/delete_public_mailbox_member_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxMemberRequest = DeletePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxMemberRequest = DeletePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeletePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.delete(request) + # 发起请求 + response: DeletePublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxMemberRequest = DeletePublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxMemberRequest = DeletePublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: DeletePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.adelete(request) + # 发起请求 + response: DeletePublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_public_mailbox_sample.py b/samples/api/mail/v1/delete_public_mailbox_sample.py index 9451a369a..b014a85d4 100644 --- a/samples/api/mail/v1/delete_public_mailbox_sample.py +++ b/samples/api/mail/v1/delete_public_mailbox_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxRequest = DeletePublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxx@abc.com") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxRequest = DeletePublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxx@abc.com") \ + .build() - # 发起请求 - response: DeletePublicMailboxResponse = client.mail.v1.public_mailbox.delete(request) + # 发起请求 + response: DeletePublicMailboxResponse = client.mail.v1.public_mailbox.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeletePublicMailboxRequest = DeletePublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxx@abc.com") \ - .build() + # 构造请求对象 + request: DeletePublicMailboxRequest = DeletePublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxx@abc.com") \ + .build() - # 发起请求 - response: DeletePublicMailboxResponse = await client.mail.v1.public_mailbox.adelete(request) + # 发起请求 + response: DeletePublicMailboxResponse = await client.mail.v1.public_mailbox.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_user_mailbox_alias_sample.py b/samples/api/mail/v1/delete_user_mailbox_alias_sample.py index 8b1958024..2f89c7589 100644 --- a/samples/api/mail/v1/delete_user_mailbox_alias_sample.py +++ b/samples/api/mail/v1/delete_user_mailbox_alias_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserMailboxAliasRequest = DeleteUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .alias_id("user_alias@xxx.xx") \ - .build() + # 构造请求对象 + request: DeleteUserMailboxAliasRequest = DeleteUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .alias_id("user_alias@xxx.xx") \ + .build() - # 发起请求 - response: DeleteUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.delete(request) + # 发起请求 + response: DeleteUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserMailboxAliasRequest = DeleteUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .alias_id("user_alias@xxx.xx") \ - .build() + # 构造请求对象 + request: DeleteUserMailboxAliasRequest = DeleteUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .alias_id("user_alias@xxx.xx") \ + .build() - # 发起请求 - response: DeleteUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.adelete(request) + # 发起请求 + response: DeleteUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/delete_user_mailbox_sample.py b/samples/api/mail/v1/delete_user_mailbox_sample.py index dae2b75b0..6fc859606 100644 --- a/samples/api/mail/v1/delete_user_mailbox_sample.py +++ b/samples/api/mail/v1/delete_user_mailbox_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserMailboxRequest = DeleteUserMailboxRequest.builder() \ - .user_mailbox_id("111111@abc.com") \ - .transfer_mailbox("888888@abc.com") \ - .build() + # 构造请求对象 + request: DeleteUserMailboxRequest = DeleteUserMailboxRequest.builder() \ + .user_mailbox_id("111111@abc.com") \ + .transfer_mailbox("888888@abc.com") \ + .build() - # 发起请求 - response: DeleteUserMailboxResponse = client.mail.v1.user_mailbox.delete(request) + # 发起请求 + response: DeleteUserMailboxResponse = client.mail.v1.user_mailbox.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteUserMailboxRequest = DeleteUserMailboxRequest.builder() \ - .user_mailbox_id("111111@abc.com") \ - .transfer_mailbox("888888@abc.com") \ - .build() + # 构造请求对象 + request: DeleteUserMailboxRequest = DeleteUserMailboxRequest.builder() \ + .user_mailbox_id("111111@abc.com") \ + .transfer_mailbox("888888@abc.com") \ + .build() - # 发起请求 - response: DeleteUserMailboxResponse = await client.mail.v1.user_mailbox.adelete(request) + # 发起请求 + response: DeleteUserMailboxResponse = await client.mail.v1.user_mailbox.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/get_mailgroup_member_sample.py b/samples/api/mail/v1/get_mailgroup_member_sample.py index 9a6332101..7a926f480 100644 --- a/samples/api/mail/v1/get_mailgroup_member_sample.py +++ b/samples/api/mail/v1/get_mailgroup_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupMemberRequest = GetMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetMailgroupMemberRequest = GetMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetMailgroupMemberResponse = client.mail.v1.mailgroup_member.get(request) + # 发起请求 + response: GetMailgroupMemberResponse = client.mail.v1.mailgroup_member.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupMemberRequest = GetMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetMailgroupMemberRequest = GetMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetMailgroupMemberResponse = await client.mail.v1.mailgroup_member.aget(request) + # 发起请求 + response: GetMailgroupMemberResponse = await client.mail.v1.mailgroup_member.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/get_mailgroup_permission_member_sample.py b/samples/api/mail/v1/get_mailgroup_permission_member_sample.py index 4d2e6eada..c7df34cb0 100644 --- a/samples/api/mail/v1/get_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/get_mailgroup_permission_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupPermissionMemberRequest = GetMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .permission_member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetMailgroupPermissionMemberRequest = GetMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .permission_member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.get(request) + # 发起请求 + response: GetMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupPermissionMemberRequest = GetMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .permission_member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .build() + # 构造请求对象 + request: GetMailgroupPermissionMemberRequest = GetMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .permission_member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .build() - # 发起请求 - response: GetMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.aget(request) + # 发起请求 + response: GetMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/get_mailgroup_sample.py b/samples/api/mail/v1/get_mailgroup_sample.py index 20620e2bd..6d6a3defd 100644 --- a/samples/api/mail/v1/get_mailgroup_sample.py +++ b/samples/api/mail/v1/get_mailgroup_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupRequest = GetMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: GetMailgroupRequest = GetMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: GetMailgroupResponse = client.mail.v1.mailgroup.get(request) + # 发起请求 + response: GetMailgroupResponse = client.mail.v1.mailgroup.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMailgroupRequest = GetMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: GetMailgroupRequest = GetMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: GetMailgroupResponse = await client.mail.v1.mailgroup.aget(request) + # 发起请求 + response: GetMailgroupResponse = await client.mail.v1.mailgroup.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/get_public_mailbox_member_sample.py b/samples/api/mail/v1/get_public_mailbox_member_sample.py index c52ac9249..5fcd4c652 100644 --- a/samples/api/mail/v1/get_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/get_public_mailbox_member_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPublicMailboxMemberRequest = GetPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetPublicMailboxMemberRequest = GetPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.get(request) + # 发起请求 + response: GetPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPublicMailboxMemberRequest = GetPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .member_id("xxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetPublicMailboxMemberRequest = GetPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .member_id("xxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.aget(request) + # 发起请求 + response: GetPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/get_public_mailbox_sample.py b/samples/api/mail/v1/get_public_mailbox_sample.py index 9d47674da..5f6c500c2 100644 --- a/samples/api/mail/v1/get_public_mailbox_sample.py +++ b/samples/api/mail/v1/get_public_mailbox_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPublicMailboxRequest = GetPublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .build() + # 构造请求对象 + request: GetPublicMailboxRequest = GetPublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .build() - # 发起请求 - response: GetPublicMailboxResponse = client.mail.v1.public_mailbox.get(request) + # 发起请求 + response: GetPublicMailboxResponse = client.mail.v1.public_mailbox.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetPublicMailboxRequest = GetPublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .build() + # 构造请求对象 + request: GetPublicMailboxRequest = GetPublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .build() - # 发起请求 - response: GetPublicMailboxResponse = await client.mail.v1.public_mailbox.aget(request) + # 发起请求 + response: GetPublicMailboxResponse = await client.mail.v1.public_mailbox.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_mailgroup_alias_sample.py b/samples/api/mail/v1/list_mailgroup_alias_sample.py index a0f0af7ed..e58025c57 100644 --- a/samples/api/mail/v1/list_mailgroup_alias_sample.py +++ b/samples/api/mail/v1/list_mailgroup_alias_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupAliasRequest = ListMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: ListMailgroupAliasRequest = ListMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: ListMailgroupAliasResponse = client.mail.v1.mailgroup_alias.list(request) + # 发起请求 + response: ListMailgroupAliasResponse = client.mail.v1.mailgroup_alias.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupAliasRequest = ListMailgroupAliasRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .build() + # 构造请求对象 + request: ListMailgroupAliasRequest = ListMailgroupAliasRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .build() - # 发起请求 - response: ListMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.alist(request) + # 发起请求 + response: ListMailgroupAliasResponse = await client.mail.v1.mailgroup_alias.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_mailgroup_manager_sample.py b/samples/api/mail/v1/list_mailgroup_manager_sample.py index 8697da12f..9fe4ebe52 100644 --- a/samples/api/mail/v1/list_mailgroup_manager_sample.py +++ b/samples/api/mail/v1/list_mailgroup_manager_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupManagerRequest = ListMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ - .page_size(20) \ - .page_token("xxxxxx") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListMailgroupManagerRequest = ListMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ + .page_size(20) \ + .page_token("xxxxxx") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListMailgroupManagerResponse = client.mail.v1.mailgroup_manager.list(request) + # 发起请求 + response: ListMailgroupManagerResponse = client.mail.v1.mailgroup_manager.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupManagerRequest = ListMailgroupManagerRequest.builder() \ - .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ - .page_size(20) \ - .page_token("xxxxxx") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListMailgroupManagerRequest = ListMailgroupManagerRequest.builder() \ + .mailgroup_id("xxxxxx 或 test_mail_group@xx.xx") \ + .page_size(20) \ + .page_token("xxxxxx") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.alist(request) + # 发起请求 + response: ListMailgroupManagerResponse = await client.mail.v1.mailgroup_manager.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_manager.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_manager.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_mailgroup_member_sample.py b/samples/api/mail/v1/list_mailgroup_member_sample.py index d20f1ac49..a6302a17e 100644 --- a/samples/api/mail/v1/list_mailgroup_member_sample.py +++ b/samples/api/mail/v1/list_mailgroup_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupMemberRequest = ListMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupMemberRequest = ListMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupMemberResponse = client.mail.v1.mailgroup_member.list(request) + # 发起请求 + response: ListMailgroupMemberResponse = client.mail.v1.mailgroup_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupMemberRequest = ListMailgroupMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupMemberRequest = ListMailgroupMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx or test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupMemberResponse = await client.mail.v1.mailgroup_member.alist(request) + # 发起请求 + response: ListMailgroupMemberResponse = await client.mail.v1.mailgroup_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_mailgroup_permission_member_sample.py b/samples/api/mail/v1/list_mailgroup_permission_member_sample.py index 2c04e01ae..ce4505ef8 100644 --- a/samples/api/mail/v1/list_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/list_mailgroup_permission_member_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupPermissionMemberRequest = ListMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupPermissionMemberRequest = ListMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.list(request) + # 发起请求 + response: ListMailgroupPermissionMemberResponse = client.mail.v1.mailgroup_permission_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupPermissionMemberRequest = ListMailgroupPermissionMemberRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .user_id_type("user_id") \ - .department_id_type("open_department_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupPermissionMemberRequest = ListMailgroupPermissionMemberRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .user_id_type("user_id") \ + .department_id_type("open_department_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.alist(request) + # 发起请求 + response: ListMailgroupPermissionMemberResponse = await client.mail.v1.mailgroup_permission_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup_permission_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup_permission_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_mailgroup_sample.py b/samples/api/mail/v1/list_mailgroup_sample.py index a007a5768..15982d221 100644 --- a/samples/api/mail/v1/list_mailgroup_sample.py +++ b/samples/api/mail/v1/list_mailgroup_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupRequest = ListMailgroupRequest.builder() \ - .manager_user_id("ou_xxxxxx") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupRequest = ListMailgroupRequest.builder() \ + .manager_user_id("ou_xxxxxx") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupResponse = client.mail.v1.mailgroup.list(request) + # 发起请求 + response: ListMailgroupResponse = client.mail.v1.mailgroup.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListMailgroupRequest = ListMailgroupRequest.builder() \ - .manager_user_id("ou_xxxxxx") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListMailgroupRequest = ListMailgroupRequest.builder() \ + .manager_user_id("ou_xxxxxx") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListMailgroupResponse = await client.mail.v1.mailgroup.alist(request) + # 发起请求 + response: ListMailgroupResponse = await client.mail.v1.mailgroup.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_public_mailbox_alias_sample.py b/samples/api/mail/v1/list_public_mailbox_alias_sample.py index 6f0a097c1..60d0cc7e1 100644 --- a/samples/api/mail/v1/list_public_mailbox_alias_sample.py +++ b/samples/api/mail/v1/list_public_mailbox_alias_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxAliasRequest = ListPublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: ListPublicMailboxAliasRequest = ListPublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .build() - # 发起请求 - response: ListPublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.list(request) + # 发起请求 + response: ListPublicMailboxAliasResponse = client.mail.v1.public_mailbox_alias.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxAliasRequest = ListPublicMailboxAliasRequest.builder() \ - .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ - .build() + # 构造请求对象 + request: ListPublicMailboxAliasRequest = ListPublicMailboxAliasRequest.builder() \ + .public_mailbox_id("xxxxxx 或 xxx@xx.xxx") \ + .build() - # 发起请求 - response: ListPublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.alist(request) + # 发起请求 + response: ListPublicMailboxAliasResponse = await client.mail.v1.public_mailbox_alias.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_public_mailbox_member_sample.py b/samples/api/mail/v1/list_public_mailbox_member_sample.py index cae4a5045..d07d5f46e 100644 --- a/samples/api/mail/v1/list_public_mailbox_member_sample.py +++ b/samples/api/mail/v1/list_public_mailbox_member_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxMemberRequest = ListPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListPublicMailboxMemberRequest = ListPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.list(request) + # 发起请求 + response: ListPublicMailboxMemberResponse = client.mail.v1.public_mailbox_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxMemberRequest = ListPublicMailboxMemberRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ - .user_id_type("user_id") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListPublicMailboxMemberRequest = ListPublicMailboxMemberRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx or test_public_mailbox@xxx.xx") \ + .user_id_type("user_id") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.alist(request) + # 发起请求 + response: ListPublicMailboxMemberResponse = await client.mail.v1.public_mailbox_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_public_mailbox_sample.py b/samples/api/mail/v1/list_public_mailbox_sample.py index c5cd0106f..b273916d8 100644 --- a/samples/api/mail/v1/list_public_mailbox_sample.py +++ b/samples/api/mail/v1/list_public_mailbox_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxRequest = ListPublicMailboxRequest.builder() \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListPublicMailboxRequest = ListPublicMailboxRequest.builder() \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListPublicMailboxResponse = client.mail.v1.public_mailbox.list(request) + # 发起请求 + response: ListPublicMailboxResponse = client.mail.v1.public_mailbox.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPublicMailboxRequest = ListPublicMailboxRequest.builder() \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListPublicMailboxRequest = ListPublicMailboxRequest.builder() \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListPublicMailboxResponse = await client.mail.v1.public_mailbox.alist(request) + # 发起请求 + response: ListPublicMailboxResponse = await client.mail.v1.public_mailbox.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/list_user_mailbox_alias_sample.py b/samples/api/mail/v1/list_user_mailbox_alias_sample.py index 1d86b1cef..300323a6a 100644 --- a/samples/api/mail/v1/list_user_mailbox_alias_sample.py +++ b/samples/api/mail/v1/list_user_mailbox_alias_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserMailboxAliasRequest = ListUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListUserMailboxAliasRequest = ListUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.list(request) + # 发起请求 + response: ListUserMailboxAliasResponse = client.mail.v1.user_mailbox_alias.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserMailboxAliasRequest = ListUserMailboxAliasRequest.builder() \ - .user_mailbox_id("user@xxx.xx") \ - .page_token("xxx") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListUserMailboxAliasRequest = ListUserMailboxAliasRequest.builder() \ + .user_mailbox_id("user@xxx.xx") \ + .page_token("xxx") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.alist(request) + # 发起请求 + response: ListUserMailboxAliasResponse = await client.mail.v1.user_mailbox_alias.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user_mailbox_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_alias.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/patch_mailgroup_sample.py b/samples/api/mail/v1/patch_mailgroup_sample.py index e8c8af87b..809301fe8 100644 --- a/samples/api/mail/v1/patch_mailgroup_sample.py +++ b/samples/api/mail/v1/patch_mailgroup_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchMailgroupRequest = PatchMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: PatchMailgroupRequest = PatchMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: PatchMailgroupResponse = client.mail.v1.mailgroup.patch(request) + # 发起请求 + response: PatchMailgroupResponse = client.mail.v1.mailgroup.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchMailgroupRequest = PatchMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: PatchMailgroupRequest = PatchMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: PatchMailgroupResponse = await client.mail.v1.mailgroup.apatch(request) + # 发起请求 + response: PatchMailgroupResponse = await client.mail.v1.mailgroup.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/patch_public_mailbox_sample.py b/samples/api/mail/v1/patch_public_mailbox_sample.py index cc3b19d91..b4b5bc901 100644 --- a/samples/api/mail/v1/patch_public_mailbox_sample.py +++ b/samples/api/mail/v1/patch_public_mailbox_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPublicMailboxRequest = PatchPublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .build()) \ - .build() + # 构造请求对象 + request: PatchPublicMailboxRequest = PatchPublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .build()) \ + .build() - # 发起请求 - response: PatchPublicMailboxResponse = client.mail.v1.public_mailbox.patch(request) + # 发起请求 + response: PatchPublicMailboxResponse = client.mail.v1.public_mailbox.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPublicMailboxRequest = PatchPublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .build()) \ - .build() + # 构造请求对象 + request: PatchPublicMailboxRequest = PatchPublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .build()) \ + .build() - # 发起请求 - response: PatchPublicMailboxResponse = await client.mail.v1.public_mailbox.apatch(request) + # 发起请求 + response: PatchPublicMailboxResponse = await client.mail.v1.public_mailbox.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/query_user_sample.py b/samples/api/mail/v1/query_user_sample.py index c726874e4..bc3486a3c 100644 --- a/samples/api/mail/v1/query_user_sample.py +++ b/samples/api/mail/v1/query_user_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserRequest = QueryUserRequest.builder() \ - .request_body(QueryUserRequestBody.builder() - .email_list([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserRequest = QueryUserRequest.builder() \ + .request_body(QueryUserRequestBody.builder() + .email_list([]) + .build()) \ + .build() - # 发起请求 - response: QueryUserResponse = client.mail.v1.user.query(request) + # 发起请求 + response: QueryUserResponse = client.mail.v1.user.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryUserRequest = QueryUserRequest.builder() \ - .request_body(QueryUserRequestBody.builder() - .email_list([]) - .build()) \ - .build() + # 构造请求对象 + request: QueryUserRequest = QueryUserRequest.builder() \ + .request_body(QueryUserRequestBody.builder() + .email_list([]) + .build()) \ + .build() - # 发起请求 - response: QueryUserResponse = await client.mail.v1.user.aquery(request) + # 发起请求 + response: QueryUserResponse = await client.mail.v1.user.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.user.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/update_mailgroup_sample.py b/samples/api/mail/v1/update_mailgroup_sample.py index 8e0cf155b..c1da9f0ae 100644 --- a/samples/api/mail/v1/update_mailgroup_sample.py +++ b/samples/api/mail/v1/update_mailgroup_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateMailgroupRequest = UpdateMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: UpdateMailgroupRequest = UpdateMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: UpdateMailgroupResponse = client.mail.v1.mailgroup.update(request) + # 发起请求 + response: UpdateMailgroupResponse = client.mail.v1.mailgroup.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateMailgroupRequest = UpdateMailgroupRequest.builder() \ - .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ - .request_body(Mailgroup.builder() - .email("test_mail_group@xxx.xx") - .name("test mail group") - .description("mail group for testing") - .who_can_send_mail("ALL_INTERNAL_USERS") - .build()) \ - .build() + # 构造请求对象 + request: UpdateMailgroupRequest = UpdateMailgroupRequest.builder() \ + .mailgroup_id("xxxxxxxxxxxxxxx 或 test_mail_group@xxx.xx") \ + .request_body(Mailgroup.builder() + .email("test_mail_group@xxx.xx") + .name("test mail group") + .description("mail group for testing") + .who_can_send_mail("ALL_INTERNAL_USERS") + .build()) \ + .build() - # 发起请求 - response: UpdateMailgroupResponse = await client.mail.v1.mailgroup.aupdate(request) + # 发起请求 + response: UpdateMailgroupResponse = await client.mail.v1.mailgroup.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.mailgroup.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.mailgroup.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mail/v1/update_public_mailbox_sample.py b/samples/api/mail/v1/update_public_mailbox_sample.py index af19e5652..b5724bd0b 100644 --- a/samples/api/mail/v1/update_public_mailbox_sample.py +++ b/samples/api/mail/v1/update_public_mailbox_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePublicMailboxRequest = UpdatePublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .build()) \ - .build() + # 构造请求对象 + request: UpdatePublicMailboxRequest = UpdatePublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .build()) \ + .build() - # 发起请求 - response: UpdatePublicMailboxResponse = client.mail.v1.public_mailbox.update(request) + # 发起请求 + response: UpdatePublicMailboxResponse = client.mail.v1.public_mailbox.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdatePublicMailboxRequest = UpdatePublicMailboxRequest.builder() \ - .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ - .request_body(PublicMailbox.builder() - .email("test_public_mailbox@xxx.xx") - .name("test public mailbox") - .build()) \ - .build() + # 构造请求对象 + request: UpdatePublicMailboxRequest = UpdatePublicMailboxRequest.builder() \ + .public_mailbox_id("xxxxxxxxxxxxxxx 或 test_public_mailbox@xxx.xx") \ + .request_body(PublicMailbox.builder() + .email("test_public_mailbox@xxx.xx") + .name("test public mailbox") + .build()) \ + .build() - # 发起请求 - response: UpdatePublicMailboxResponse = await client.mail.v1.public_mailbox.aupdate(request) + # 发起请求 + response: UpdatePublicMailboxResponse = await client.mail.v1.public_mailbox.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mail.v1.public_mailbox.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.public_mailbox.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mdm/v1/bind_user_auth_data_relation_sample.py b/samples/api/mdm/v1/bind_user_auth_data_relation_sample.py index 235fe7bc0..d78671f0a 100644 --- a/samples/api/mdm/v1/bind_user_auth_data_relation_sample.py +++ b/samples/api/mdm/v1/bind_user_auth_data_relation_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BindUserAuthDataRelationRequest = BindUserAuthDataRelationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(UserAuthDataRelation.builder() - .root_dimension_type("zijie") - .sub_dimension_types([]) - .authorized_user_ids([]) - .uams_app_id("uams-tenant-test") - .build()) \ - .build() + # 构造请求对象 + request: BindUserAuthDataRelationRequest = BindUserAuthDataRelationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(UserAuthDataRelation.builder() + .root_dimension_type("zijie") + .sub_dimension_types([]) + .authorized_user_ids([]) + .uams_app_id("uams-tenant-test") + .build()) \ + .build() - # 发起请求 - response: BindUserAuthDataRelationResponse = client.mdm.v1.user_auth_data_relation.bind(request) + # 发起请求 + response: BindUserAuthDataRelationResponse = client.mdm.v1.user_auth_data_relation.bind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mdm.v1.user_auth_data_relation.bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mdm.v1.user_auth_data_relation.bind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BindUserAuthDataRelationRequest = BindUserAuthDataRelationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(UserAuthDataRelation.builder() - .root_dimension_type("zijie") - .sub_dimension_types([]) - .authorized_user_ids([]) - .uams_app_id("uams-tenant-test") - .build()) \ - .build() + # 构造请求对象 + request: BindUserAuthDataRelationRequest = BindUserAuthDataRelationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(UserAuthDataRelation.builder() + .root_dimension_type("zijie") + .sub_dimension_types([]) + .authorized_user_ids([]) + .uams_app_id("uams-tenant-test") + .build()) \ + .build() - # 发起请求 - response: BindUserAuthDataRelationResponse = await client.mdm.v1.user_auth_data_relation.abind(request) + # 发起请求 + response: BindUserAuthDataRelationResponse = await client.mdm.v1.user_auth_data_relation.abind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mdm.v1.user_auth_data_relation.abind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mdm.v1.user_auth_data_relation.abind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/mdm/v1/unbind_user_auth_data_relation_sample.py b/samples/api/mdm/v1/unbind_user_auth_data_relation_sample.py index 9205490bf..246c27735 100644 --- a/samples/api/mdm/v1/unbind_user_auth_data_relation_sample.py +++ b/samples/api/mdm/v1/unbind_user_auth_data_relation_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindUserAuthDataRelationRequest = UnbindUserAuthDataRelationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(UserAuthDataRelation.builder() - .root_dimension_type("zijie") - .sub_dimension_types([]) - .authorized_user_ids([]) - .uams_app_id("uams-tenant-test") - .build()) \ - .build() + # 构造请求对象 + request: UnbindUserAuthDataRelationRequest = UnbindUserAuthDataRelationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(UserAuthDataRelation.builder() + .root_dimension_type("zijie") + .sub_dimension_types([]) + .authorized_user_ids([]) + .uams_app_id("uams-tenant-test") + .build()) \ + .build() - # 发起请求 - response: UnbindUserAuthDataRelationResponse = client.mdm.v1.user_auth_data_relation.unbind(request) + # 发起请求 + response: UnbindUserAuthDataRelationResponse = client.mdm.v1.user_auth_data_relation.unbind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mdm.v1.user_auth_data_relation.unbind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mdm.v1.user_auth_data_relation.unbind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UnbindUserAuthDataRelationRequest = UnbindUserAuthDataRelationRequest.builder() \ - .user_id_type("user_id") \ - .request_body(UserAuthDataRelation.builder() - .root_dimension_type("zijie") - .sub_dimension_types([]) - .authorized_user_ids([]) - .uams_app_id("uams-tenant-test") - .build()) \ - .build() + # 构造请求对象 + request: UnbindUserAuthDataRelationRequest = UnbindUserAuthDataRelationRequest.builder() \ + .user_id_type("user_id") \ + .request_body(UserAuthDataRelation.builder() + .root_dimension_type("zijie") + .sub_dimension_types([]) + .authorized_user_ids([]) + .uams_app_id("uams-tenant-test") + .build()) \ + .build() - # 发起请求 - response: UnbindUserAuthDataRelationResponse = await client.mdm.v1.user_auth_data_relation.aunbind(request) + # 发起请求 + response: UnbindUserAuthDataRelationResponse = await client.mdm.v1.user_auth_data_relation.aunbind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.mdm.v1.user_auth_data_relation.aunbind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mdm.v1.user_auth_data_relation.aunbind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/batch_get_okr_sample.py b/samples/api/okr/v1/batch_get_okr_sample.py index 806977fbf..3c3d0aabb 100644 --- a/samples/api/okr/v1/batch_get_okr_sample.py +++ b/samples/api/okr/v1/batch_get_okr_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetOkrRequest = BatchGetOkrRequest.builder() \ - .user_id_type("open_id") \ - .okr_ids([]) \ - .lang("zh_cn") \ - .build() + # 构造请求对象 + request: BatchGetOkrRequest = BatchGetOkrRequest.builder() \ + .user_id_type("open_id") \ + .okr_ids([]) \ + .lang("zh_cn") \ + .build() - # 发起请求 - response: BatchGetOkrResponse = client.okr.v1.okr.batch_get(request) + # 发起请求 + response: BatchGetOkrResponse = client.okr.v1.okr.batch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.okr.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.okr.batch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchGetOkrRequest = BatchGetOkrRequest.builder() \ - .user_id_type("open_id") \ - .okr_ids([]) \ - .lang("zh_cn") \ - .build() + # 构造请求对象 + request: BatchGetOkrRequest = BatchGetOkrRequest.builder() \ + .user_id_type("open_id") \ + .okr_ids([]) \ + .lang("zh_cn") \ + .build() - # 发起请求 - response: BatchGetOkrResponse = await client.okr.v1.okr.abatch_get(request) + # 发起请求 + response: BatchGetOkrResponse = await client.okr.v1.okr.abatch_get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.okr.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.okr.abatch_get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/create_period_sample.py b/samples/api/okr/v1/create_period_sample.py index 148b87ceb..a425796e7 100644 --- a/samples/api/okr/v1/create_period_sample.py +++ b/samples/api/okr/v1/create_period_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePeriodRequest = CreatePeriodRequest.builder() \ - .request_body(CreatePeriodRequestBody.builder() - .period_rule_id("6969864184272078374") - .start_month("2022-01") - .build()) \ - .build() + # 构造请求对象 + request: CreatePeriodRequest = CreatePeriodRequest.builder() \ + .request_body(CreatePeriodRequestBody.builder() + .period_rule_id("6969864184272078374") + .start_month("2022-01") + .build()) \ + .build() - # 发起请求 - response: CreatePeriodResponse = client.okr.v1.period.create(request) + # 发起请求 + response: CreatePeriodResponse = client.okr.v1.period.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreatePeriodRequest = CreatePeriodRequest.builder() \ - .request_body(CreatePeriodRequestBody.builder() - .period_rule_id("6969864184272078374") - .start_month("2022-01") - .build()) \ - .build() + # 构造请求对象 + request: CreatePeriodRequest = CreatePeriodRequest.builder() \ + .request_body(CreatePeriodRequestBody.builder() + .period_rule_id("6969864184272078374") + .start_month("2022-01") + .build()) \ + .build() - # 发起请求 - response: CreatePeriodResponse = await client.okr.v1.period.acreate(request) + # 发起请求 + response: CreatePeriodResponse = await client.okr.v1.period.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/create_progress_record_sample.py b/samples/api/okr/v1/create_progress_record_sample.py index b51b51515..6f7e578cc 100644 --- a/samples/api/okr/v1/create_progress_record_sample.py +++ b/samples/api/okr/v1/create_progress_record_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateProgressRecordRequest = CreateProgressRecordRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateProgressRecordRequestBody.builder() - .source_title("周报系统") - .source_url("https://www.zhoubao.com") - .target_id("7041430377642082323") - .target_type(1) - .content(ContentBlock.builder().build()) - .source_url_pc("open.feishu.cn") - .source_url_mobile("open.feishu.cn") - .build()) \ - .build() + # 构造请求对象 + request: CreateProgressRecordRequest = CreateProgressRecordRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateProgressRecordRequestBody.builder() + .source_title("周报系统") + .source_url("https://www.zhoubao.com") + .target_id("7041430377642082323") + .target_type(1) + .content(ContentBlock.builder().build()) + .source_url_pc("open.feishu.cn") + .source_url_mobile("open.feishu.cn") + .build()) \ + .build() - # 发起请求 - response: CreateProgressRecordResponse = client.okr.v1.progress_record.create(request) + # 发起请求 + response: CreateProgressRecordResponse = client.okr.v1.progress_record.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateProgressRecordRequest = CreateProgressRecordRequest.builder() \ - .user_id_type("user_id") \ - .request_body(CreateProgressRecordRequestBody.builder() - .source_title("周报系统") - .source_url("https://www.zhoubao.com") - .target_id("7041430377642082323") - .target_type(1) - .content(ContentBlock.builder().build()) - .source_url_pc("open.feishu.cn") - .source_url_mobile("open.feishu.cn") - .build()) \ - .build() + # 构造请求对象 + request: CreateProgressRecordRequest = CreateProgressRecordRequest.builder() \ + .user_id_type("user_id") \ + .request_body(CreateProgressRecordRequestBody.builder() + .source_title("周报系统") + .source_url("https://www.zhoubao.com") + .target_id("7041430377642082323") + .target_type(1) + .content(ContentBlock.builder().build()) + .source_url_pc("open.feishu.cn") + .source_url_mobile("open.feishu.cn") + .build()) \ + .build() - # 发起请求 - response: CreateProgressRecordResponse = await client.okr.v1.progress_record.acreate(request) + # 发起请求 + response: CreateProgressRecordResponse = await client.okr.v1.progress_record.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/delete_progress_record_sample.py b/samples/api/okr/v1/delete_progress_record_sample.py index 698d059b6..62dd85ba9 100644 --- a/samples/api/okr/v1/delete_progress_record_sample.py +++ b/samples/api/okr/v1/delete_progress_record_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteProgressRecordRequest = DeleteProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .build() + # 构造请求对象 + request: DeleteProgressRecordRequest = DeleteProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .build() - # 发起请求 - response: DeleteProgressRecordResponse = client.okr.v1.progress_record.delete(request) + # 发起请求 + response: DeleteProgressRecordResponse = client.okr.v1.progress_record.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteProgressRecordRequest = DeleteProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .build() + # 构造请求对象 + request: DeleteProgressRecordRequest = DeleteProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .build() - # 发起请求 - response: DeleteProgressRecordResponse = await client.okr.v1.progress_record.adelete(request) + # 发起请求 + response: DeleteProgressRecordResponse = await client.okr.v1.progress_record.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/get_progress_record_sample.py b/samples/api/okr/v1/get_progress_record_sample.py index c913df291..b72d02b57 100644 --- a/samples/api/okr/v1/get_progress_record_sample.py +++ b/samples/api/okr/v1/get_progress_record_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProgressRecordRequest = GetProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetProgressRecordRequest = GetProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetProgressRecordResponse = client.okr.v1.progress_record.get(request) + # 发起请求 + response: GetProgressRecordResponse = client.okr.v1.progress_record.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetProgressRecordRequest = GetProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetProgressRecordRequest = GetProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetProgressRecordResponse = await client.okr.v1.progress_record.aget(request) + # 发起请求 + response: GetProgressRecordResponse = await client.okr.v1.progress_record.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/list_period_rule_sample.py b/samples/api/okr/v1/list_period_rule_sample.py index c273c4566..611430a0c 100644 --- a/samples/api/okr/v1/list_period_rule_sample.py +++ b/samples/api/okr/v1/list_period_rule_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPeriodRuleRequest = ListPeriodRuleRequest.builder() \ - .build() + # 构造请求对象 + request: ListPeriodRuleRequest = ListPeriodRuleRequest.builder() \ + .build() - # 发起请求 - response: ListPeriodRuleResponse = client.okr.v1.period_rule.list(request) + # 发起请求 + response: ListPeriodRuleResponse = client.okr.v1.period_rule.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period_rule.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPeriodRuleRequest = ListPeriodRuleRequest.builder() \ - .build() + # 构造请求对象 + request: ListPeriodRuleRequest = ListPeriodRuleRequest.builder() \ + .build() - # 发起请求 - response: ListPeriodRuleResponse = await client.okr.v1.period_rule.alist(request) + # 发起请求 + response: ListPeriodRuleResponse = await client.okr.v1.period_rule.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period_rule.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/list_period_sample.py b/samples/api/okr/v1/list_period_sample.py index 4915ef814..1e4d9cbd9 100644 --- a/samples/api/okr/v1/list_period_sample.py +++ b/samples/api/okr/v1/list_period_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPeriodRequest = ListPeriodRequest.builder() \ - .page_token("xaasdasdax") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListPeriodRequest = ListPeriodRequest.builder() \ + .page_token("xaasdasdax") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListPeriodResponse = client.okr.v1.period.list(request) + # 发起请求 + response: ListPeriodResponse = client.okr.v1.period.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListPeriodRequest = ListPeriodRequest.builder() \ - .page_token("xaasdasdax") \ - .page_size(10) \ - .build() + # 构造请求对象 + request: ListPeriodRequest = ListPeriodRequest.builder() \ + .page_token("xaasdasdax") \ + .page_size(10) \ + .build() - # 发起请求 - response: ListPeriodResponse = await client.okr.v1.period.alist(request) + # 发起请求 + response: ListPeriodResponse = await client.okr.v1.period.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/list_user_okr_sample.py b/samples/api/okr/v1/list_user_okr_sample.py index ced225eee..130ab248a 100644 --- a/samples/api/okr/v1/list_user_okr_sample.py +++ b/samples/api/okr/v1/list_user_okr_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserOkrRequest = ListUserOkrRequest.builder() \ - .user_id("ou-asdasdasdasdasd") \ - .user_id_type("open_id") \ - .offset("0") \ - .limit("5") \ - .lang("zh_cn") \ - .period_ids([]) \ - .build() + # 构造请求对象 + request: ListUserOkrRequest = ListUserOkrRequest.builder() \ + .user_id("ou-asdasdasdasdasd") \ + .user_id_type("open_id") \ + .offset("0") \ + .limit("5") \ + .lang("zh_cn") \ + .period_ids([]) \ + .build() - # 发起请求 - response: ListUserOkrResponse = client.okr.v1.user_okr.list(request) + # 发起请求 + response: ListUserOkrResponse = client.okr.v1.user_okr.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.user_okr.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.user_okr.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListUserOkrRequest = ListUserOkrRequest.builder() \ - .user_id("ou-asdasdasdasdasd") \ - .user_id_type("open_id") \ - .offset("0") \ - .limit("5") \ - .lang("zh_cn") \ - .period_ids([]) \ - .build() + # 构造请求对象 + request: ListUserOkrRequest = ListUserOkrRequest.builder() \ + .user_id("ou-asdasdasdasdasd") \ + .user_id_type("open_id") \ + .offset("0") \ + .limit("5") \ + .lang("zh_cn") \ + .period_ids([]) \ + .build() - # 发起请求 - response: ListUserOkrResponse = await client.okr.v1.user_okr.alist(request) + # 发起请求 + response: ListUserOkrResponse = await client.okr.v1.user_okr.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.user_okr.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.user_okr.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/patch_period_sample.py b/samples/api/okr/v1/patch_period_sample.py index 9ba010032..74b02b0ee 100644 --- a/samples/api/okr/v1/patch_period_sample.py +++ b/samples/api/okr/v1/patch_period_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPeriodRequest = PatchPeriodRequest.builder() \ - .period_id("6969864184272078374") \ - .request_body(PatchPeriodRequestBody.builder() - .status(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchPeriodRequest = PatchPeriodRequest.builder() \ + .period_id("6969864184272078374") \ + .request_body(PatchPeriodRequestBody.builder() + .status(1) + .build()) \ + .build() - # 发起请求 - response: PatchPeriodResponse = client.okr.v1.period.patch(request) + # 发起请求 + response: PatchPeriodResponse = client.okr.v1.period.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchPeriodRequest = PatchPeriodRequest.builder() \ - .period_id("6969864184272078374") \ - .request_body(PatchPeriodRequestBody.builder() - .status(1) - .build()) \ - .build() + # 构造请求对象 + request: PatchPeriodRequest = PatchPeriodRequest.builder() \ + .period_id("6969864184272078374") \ + .request_body(PatchPeriodRequestBody.builder() + .status(1) + .build()) \ + .build() - # 发起请求 - response: PatchPeriodResponse = await client.okr.v1.period.apatch(request) + # 发起请求 + response: PatchPeriodResponse = await client.okr.v1.period.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.period.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.period.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/query_review_sample.py b/samples/api/okr/v1/query_review_sample.py index a807d121a..eb730ee89 100644 --- a/samples/api/okr/v1/query_review_sample.py +++ b/samples/api/okr/v1/query_review_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryReviewRequest = QueryReviewRequest.builder() \ - .user_id_type("open_id") \ - .user_ids([]) \ - .period_ids([]) \ - .build() + # 构造请求对象 + request: QueryReviewRequest = QueryReviewRequest.builder() \ + .user_id_type("open_id") \ + .user_ids([]) \ + .period_ids([]) \ + .build() - # 发起请求 - response: QueryReviewResponse = client.okr.v1.review.query(request) + # 发起请求 + response: QueryReviewResponse = client.okr.v1.review.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.review.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.review.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryReviewRequest = QueryReviewRequest.builder() \ - .user_id_type("open_id") \ - .user_ids([]) \ - .period_ids([]) \ - .build() + # 构造请求对象 + request: QueryReviewRequest = QueryReviewRequest.builder() \ + .user_id_type("open_id") \ + .user_ids([]) \ + .period_ids([]) \ + .build() - # 发起请求 - response: QueryReviewResponse = await client.okr.v1.review.aquery(request) + # 发起请求 + response: QueryReviewResponse = await client.okr.v1.review.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.review.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.review.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/update_progress_record_sample.py b/samples/api/okr/v1/update_progress_record_sample.py index db2c0face..ad1db9ece 100644 --- a/samples/api/okr/v1/update_progress_record_sample.py +++ b/samples/api/okr/v1/update_progress_record_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProgressRecordRequest = UpdateProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .user_id_type("user_id") \ - .request_body(UpdateProgressRecordRequestBody.builder() - .content(ContentBlock.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProgressRecordRequest = UpdateProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .user_id_type("user_id") \ + .request_body(UpdateProgressRecordRequestBody.builder() + .content(ContentBlock.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateProgressRecordResponse = client.okr.v1.progress_record.update(request) + # 发起请求 + response: UpdateProgressRecordResponse = client.okr.v1.progress_record.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateProgressRecordRequest = UpdateProgressRecordRequest.builder() \ - .progress_id("7041857032248410131") \ - .user_id_type("user_id") \ - .request_body(UpdateProgressRecordRequestBody.builder() - .content(ContentBlock.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateProgressRecordRequest = UpdateProgressRecordRequest.builder() \ + .progress_id("7041857032248410131") \ + .user_id_type("user_id") \ + .request_body(UpdateProgressRecordRequestBody.builder() + .content(ContentBlock.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateProgressRecordResponse = await client.okr.v1.progress_record.aupdate(request) + # 发起请求 + response: UpdateProgressRecordResponse = await client.okr.v1.progress_record.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.progress_record.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.progress_record.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/okr/v1/upload_image_sample.py b/samples/api/okr/v1/upload_image_sample.py index ddd815546..ea3dbdf71 100644 --- a/samples/api/okr/v1/upload_image_sample.py +++ b/samples/api/okr/v1/upload_image_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadImageRequest = UploadImageRequest.builder() \ - .request_body(UploadImageRequestBody.builder() - .data(file) - .target_id("6974586812998174252") - .target_type(1) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadImageRequest = UploadImageRequest.builder() \ + .request_body(UploadImageRequestBody.builder() + .data(file) + .target_id("6974586812998174252") + .target_type(1) + .build()) \ + .build() - # 发起请求 - response: UploadImageResponse = client.okr.v1.image.upload(request) + # 发起请求 + response: UploadImageResponse = client.okr.v1.image.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.image.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.image.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadImageRequest = UploadImageRequest.builder() \ - .request_body(UploadImageRequestBody.builder() - .data(file) - .target_id("6974586812998174252") - .target_type(1) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadImageRequest = UploadImageRequest.builder() \ + .request_body(UploadImageRequestBody.builder() + .data(file) + .target_id("6974586812998174252") + .target_type(1) + .build()) \ + .build() - # 发起请求 - response: UploadImageResponse = await client.okr.v1.image.aupload(request) + # 发起请求 + response: UploadImageResponse = await client.okr.v1.image.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.okr.v1.image.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.okr.v1.image.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/optical_char_recognition/v1/basic_recognize_image_sample.py b/samples/api/optical_char_recognition/v1/basic_recognize_image_sample.py index d688b2c34..8551b50b8 100644 --- a/samples/api/optical_char_recognition/v1/basic_recognize_image_sample.py +++ b/samples/api/optical_char_recognition/v1/basic_recognize_image_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BasicRecognizeImageRequest = BasicRecognizeImageRequest.builder() \ - .request_body(BasicRecognizeImageRequestBody.builder() - .image("base64后的图片二进制数据") - .build()) \ - .build() + # 构造请求对象 + request: BasicRecognizeImageRequest = BasicRecognizeImageRequest.builder() \ + .request_body(BasicRecognizeImageRequestBody.builder() + .image("base64后的图片二进制数据") + .build()) \ + .build() - # 发起请求 - response: BasicRecognizeImageResponse = client.optical_char_recognition.v1.image.basic_recognize(request) + # 发起请求 + response: BasicRecognizeImageResponse = client.optical_char_recognition.v1.image.basic_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.optical_char_recognition.v1.image.basic_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.optical_char_recognition.v1.image.basic_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BasicRecognizeImageRequest = BasicRecognizeImageRequest.builder() \ - .request_body(BasicRecognizeImageRequestBody.builder() - .image("base64后的图片二进制数据") - .build()) \ - .build() + # 构造请求对象 + request: BasicRecognizeImageRequest = BasicRecognizeImageRequest.builder() \ + .request_body(BasicRecognizeImageRequestBody.builder() + .image("base64后的图片二进制数据") + .build()) \ + .build() - # 发起请求 - response: BasicRecognizeImageResponse = await client.optical_char_recognition.v1.image.abasic_recognize(request) + # 发起请求 + response: BasicRecognizeImageResponse = await client.optical_char_recognition.v1.image.abasic_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.optical_char_recognition.v1.image.abasic_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.optical_char_recognition.v1.image.abasic_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/passport/v1/query_session_sample.py b/samples/api/passport/v1/query_session_sample.py index 21d4dce94..a88633156 100644 --- a/samples/api/passport/v1/query_session_sample.py +++ b/samples/api/passport/v1/query_session_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySessionRequest = QuerySessionRequest.builder() \ - .user_id_type("open_id") \ - .request_body(QuerySessionRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: QuerySessionRequest = QuerySessionRequest.builder() \ + .user_id_type("open_id") \ + .request_body(QuerySessionRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: QuerySessionResponse = client.passport.v1.session.query(request) + # 发起请求 + response: QuerySessionResponse = client.passport.v1.session.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.passport.v1.session.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.passport.v1.session.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySessionRequest = QuerySessionRequest.builder() \ - .user_id_type("open_id") \ - .request_body(QuerySessionRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: QuerySessionRequest = QuerySessionRequest.builder() \ + .user_id_type("open_id") \ + .request_body(QuerySessionRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: QuerySessionResponse = await client.passport.v1.session.aquery(request) + # 发起请求 + response: QuerySessionResponse = await client.passport.v1.session.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.passport.v1.session.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.passport.v1.session.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/batch_close_system_status_sample.py b/samples/api/personal_settings/v1/batch_close_system_status_sample.py index 3f0393414..c79ee8b39 100644 --- a/samples/api/personal_settings/v1/batch_close_system_status_sample.py +++ b/samples/api/personal_settings/v1/batch_close_system_status_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCloseSystemStatusRequest = BatchCloseSystemStatusRequest.builder() \ - .system_status_id("7101214603622940671") \ - .user_id_type("open_id") \ - .request_body(BatchCloseSystemStatusRequestBody.builder() - .user_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCloseSystemStatusRequest = BatchCloseSystemStatusRequest.builder() \ + .system_status_id("7101214603622940671") \ + .user_id_type("open_id") \ + .request_body(BatchCloseSystemStatusRequestBody.builder() + .user_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCloseSystemStatusResponse = client.personal_settings.v1.system_status.batch_close(request) + # 发起请求 + response: BatchCloseSystemStatusResponse = client.personal_settings.v1.system_status.batch_close(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.batch_close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.batch_close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchCloseSystemStatusRequest = BatchCloseSystemStatusRequest.builder() \ - .system_status_id("7101214603622940671") \ - .user_id_type("open_id") \ - .request_body(BatchCloseSystemStatusRequestBody.builder() - .user_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchCloseSystemStatusRequest = BatchCloseSystemStatusRequest.builder() \ + .system_status_id("7101214603622940671") \ + .user_id_type("open_id") \ + .request_body(BatchCloseSystemStatusRequestBody.builder() + .user_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchCloseSystemStatusResponse = await client.personal_settings.v1.system_status.abatch_close(request) + # 发起请求 + response: BatchCloseSystemStatusResponse = await client.personal_settings.v1.system_status.abatch_close(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.abatch_close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.abatch_close failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/batch_open_system_status_sample.py b/samples/api/personal_settings/v1/batch_open_system_status_sample.py index e30cc7721..6eda130b4 100644 --- a/samples/api/personal_settings/v1/batch_open_system_status_sample.py +++ b/samples/api/personal_settings/v1/batch_open_system_status_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchOpenSystemStatusRequest = BatchOpenSystemStatusRequest.builder() \ - .system_status_id("7101214603622940672") \ - .user_id_type("open_id") \ - .request_body(BatchOpenSystemStatusRequestBody.builder() - .user_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchOpenSystemStatusRequest = BatchOpenSystemStatusRequest.builder() \ + .system_status_id("7101214603622940672") \ + .user_id_type("open_id") \ + .request_body(BatchOpenSystemStatusRequestBody.builder() + .user_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchOpenSystemStatusResponse = client.personal_settings.v1.system_status.batch_open(request) + # 发起请求 + response: BatchOpenSystemStatusResponse = client.personal_settings.v1.system_status.batch_open(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.batch_open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.batch_open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchOpenSystemStatusRequest = BatchOpenSystemStatusRequest.builder() \ - .system_status_id("7101214603622940672") \ - .user_id_type("open_id") \ - .request_body(BatchOpenSystemStatusRequestBody.builder() - .user_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchOpenSystemStatusRequest = BatchOpenSystemStatusRequest.builder() \ + .system_status_id("7101214603622940672") \ + .user_id_type("open_id") \ + .request_body(BatchOpenSystemStatusRequestBody.builder() + .user_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchOpenSystemStatusResponse = await client.personal_settings.v1.system_status.abatch_open(request) + # 发起请求 + response: BatchOpenSystemStatusResponse = await client.personal_settings.v1.system_status.abatch_open(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.abatch_open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.abatch_open failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/create_system_status_sample.py b/samples/api/personal_settings/v1/create_system_status_sample.py index 26a652376..5e2d3ed1a 100644 --- a/samples/api/personal_settings/v1/create_system_status_sample.py +++ b/samples/api/personal_settings/v1/create_system_status_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSystemStatusRequest = CreateSystemStatusRequest.builder() \ - .request_body(SystemStatus.builder() - .title("出差") - .i18n_title(SystemStatusI18nName.builder().build()) - .icon_key("GeneralBusinessTrip") - .color("BLUE") - .priority(0) - .sync_setting(SystemStatusSyncSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateSystemStatusRequest = CreateSystemStatusRequest.builder() \ + .request_body(SystemStatus.builder() + .title("出差") + .i18n_title(SystemStatusI18nName.builder().build()) + .icon_key("GeneralBusinessTrip") + .color("BLUE") + .priority(0) + .sync_setting(SystemStatusSyncSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateSystemStatusResponse = client.personal_settings.v1.system_status.create(request) + # 发起请求 + response: CreateSystemStatusResponse = client.personal_settings.v1.system_status.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSystemStatusRequest = CreateSystemStatusRequest.builder() \ - .request_body(SystemStatus.builder() - .title("出差") - .i18n_title(SystemStatusI18nName.builder().build()) - .icon_key("GeneralBusinessTrip") - .color("BLUE") - .priority(0) - .sync_setting(SystemStatusSyncSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateSystemStatusRequest = CreateSystemStatusRequest.builder() \ + .request_body(SystemStatus.builder() + .title("出差") + .i18n_title(SystemStatusI18nName.builder().build()) + .icon_key("GeneralBusinessTrip") + .color("BLUE") + .priority(0) + .sync_setting(SystemStatusSyncSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateSystemStatusResponse = await client.personal_settings.v1.system_status.acreate(request) + # 发起请求 + response: CreateSystemStatusResponse = await client.personal_settings.v1.system_status.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/delete_system_status_sample.py b/samples/api/personal_settings/v1/delete_system_status_sample.py index 7c9507270..fe979c1f4 100644 --- a/samples/api/personal_settings/v1/delete_system_status_sample.py +++ b/samples/api/personal_settings/v1/delete_system_status_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSystemStatusRequest = DeleteSystemStatusRequest.builder() \ - .system_status_id("7101214603622940633") \ - .build() + # 构造请求对象 + request: DeleteSystemStatusRequest = DeleteSystemStatusRequest.builder() \ + .system_status_id("7101214603622940633") \ + .build() - # 发起请求 - response: DeleteSystemStatusResponse = client.personal_settings.v1.system_status.delete(request) + # 发起请求 + response: DeleteSystemStatusResponse = client.personal_settings.v1.system_status.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSystemStatusRequest = DeleteSystemStatusRequest.builder() \ - .system_status_id("7101214603622940633") \ - .build() + # 构造请求对象 + request: DeleteSystemStatusRequest = DeleteSystemStatusRequest.builder() \ + .system_status_id("7101214603622940633") \ + .build() - # 发起请求 - response: DeleteSystemStatusResponse = await client.personal_settings.v1.system_status.adelete(request) + # 发起请求 + response: DeleteSystemStatusResponse = await client.personal_settings.v1.system_status.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/list_system_status_sample.py b/samples/api/personal_settings/v1/list_system_status_sample.py index bf2d0db6d..6476a4d32 100644 --- a/samples/api/personal_settings/v1/list_system_status_sample.py +++ b/samples/api/personal_settings/v1/list_system_status_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSystemStatusRequest = ListSystemStatusRequest.builder() \ - .page_size(50) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListSystemStatusRequest = ListSystemStatusRequest.builder() \ + .page_size(50) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListSystemStatusResponse = client.personal_settings.v1.system_status.list(request) + # 发起请求 + response: ListSystemStatusResponse = client.personal_settings.v1.system_status.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSystemStatusRequest = ListSystemStatusRequest.builder() \ - .page_size(50) \ - .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ - .build() + # 构造请求对象 + request: ListSystemStatusRequest = ListSystemStatusRequest.builder() \ + .page_size(50) \ + .page_token("GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==") \ + .build() - # 发起请求 - response: ListSystemStatusResponse = await client.personal_settings.v1.system_status.alist(request) + # 发起请求 + response: ListSystemStatusResponse = await client.personal_settings.v1.system_status.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/personal_settings/v1/patch_system_status_sample.py b/samples/api/personal_settings/v1/patch_system_status_sample.py index c1d5e792b..16f4a4897 100644 --- a/samples/api/personal_settings/v1/patch_system_status_sample.py +++ b/samples/api/personal_settings/v1/patch_system_status_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSystemStatusRequest = PatchSystemStatusRequest.builder() \ - .system_status_id("7101214603622940633") \ - .request_body(PatchSystemStatusRequestBody.builder() - .system_status(SystemStatus.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSystemStatusRequest = PatchSystemStatusRequest.builder() \ + .system_status_id("7101214603622940633") \ + .request_body(PatchSystemStatusRequestBody.builder() + .system_status(SystemStatus.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchSystemStatusResponse = client.personal_settings.v1.system_status.patch(request) + # 发起请求 + response: PatchSystemStatusResponse = client.personal_settings.v1.system_status.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSystemStatusRequest = PatchSystemStatusRequest.builder() \ - .system_status_id("7101214603622940633") \ - .request_body(PatchSystemStatusRequestBody.builder() - .system_status(SystemStatus.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSystemStatusRequest = PatchSystemStatusRequest.builder() \ + .system_status_id("7101214603622940633") \ + .request_body(PatchSystemStatusRequestBody.builder() + .system_status(SystemStatus.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchSystemStatusResponse = await client.personal_settings.v1.system_status.apatch(request) + # 发起请求 + response: PatchSystemStatusResponse = await client.personal_settings.v1.system_status.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.personal_settings.v1.system_status.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.personal_settings.v1.system_status.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/report/v1/query_rule_sample.py b/samples/api/report/v1/query_rule_sample.py index 43b886d1d..c465477e9 100644 --- a/samples/api/report/v1/query_rule_sample.py +++ b/samples/api/report/v1/query_rule_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryRuleRequest = QueryRuleRequest.builder() \ - .rule_name("工作月报") \ - .include_deleted(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryRuleRequest = QueryRuleRequest.builder() \ + .rule_name("工作月报") \ + .include_deleted(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryRuleResponse = client.report.v1.rule.query(request) + # 发起请求 + response: QueryRuleResponse = client.report.v1.rule.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.rule.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.rule.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryRuleRequest = QueryRuleRequest.builder() \ - .rule_name("工作月报") \ - .include_deleted(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryRuleRequest = QueryRuleRequest.builder() \ + .rule_name("工作月报") \ + .include_deleted(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryRuleResponse = await client.report.v1.rule.aquery(request) + # 发起请求 + response: QueryRuleResponse = await client.report.v1.rule.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.rule.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.rule.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/report/v1/query_task_sample.py b/samples/api/report/v1/query_task_sample.py index 14c5cd7fd..d7f55c7e0 100644 --- a/samples/api/report/v1/query_task_sample.py +++ b/samples/api/report/v1/query_task_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTaskRequest = QueryTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(QueryTaskRequestBody.builder() - .commit_start_time(1622427266) - .commit_end_time(1622427266) - .rule_id("6894419345318182932") - .user_id("ou_133f0b6d0f097cf7d7ba00b38fffb110") - .page_token("6895699275733778451") - .page_size(10) - .build()) \ - .build() + # 构造请求对象 + request: QueryTaskRequest = QueryTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(QueryTaskRequestBody.builder() + .commit_start_time(1622427266) + .commit_end_time(1622427266) + .rule_id("6894419345318182932") + .user_id("ou_133f0b6d0f097cf7d7ba00b38fffb110") + .page_token("6895699275733778451") + .page_size(10) + .build()) \ + .build() - # 发起请求 - response: QueryTaskResponse = client.report.v1.task.query(request) + # 发起请求 + response: QueryTaskResponse = client.report.v1.task.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.task.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTaskRequest = QueryTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(QueryTaskRequestBody.builder() - .commit_start_time(1622427266) - .commit_end_time(1622427266) - .rule_id("6894419345318182932") - .user_id("ou_133f0b6d0f097cf7d7ba00b38fffb110") - .page_token("6895699275733778451") - .page_size(10) - .build()) \ - .build() + # 构造请求对象 + request: QueryTaskRequest = QueryTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(QueryTaskRequestBody.builder() + .commit_start_time(1622427266) + .commit_end_time(1622427266) + .rule_id("6894419345318182932") + .user_id("ou_133f0b6d0f097cf7d7ba00b38fffb110") + .page_token("6895699275733778451") + .page_size(10) + .build()) \ + .build() - # 发起请求 - response: QueryTaskResponse = await client.report.v1.task.aquery(request) + # 发起请求 + response: QueryTaskResponse = await client.report.v1.task.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.task.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/report/v1/remove_rule_view_sample.py b/samples/api/report/v1/remove_rule_view_sample.py index 15439475a..05ecf5218 100644 --- a/samples/api/report/v1/remove_rule_view_sample.py +++ b/samples/api/report/v1/remove_rule_view_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRuleViewRequest = RemoveRuleViewRequest.builder() \ - .rule_id("6894419345318182122") \ - .user_id_type("user_id") \ - .request_body(RemoveRuleViewRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveRuleViewRequest = RemoveRuleViewRequest.builder() \ + .rule_id("6894419345318182122") \ + .user_id_type("user_id") \ + .request_body(RemoveRuleViewRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: RemoveRuleViewResponse = client.report.v1.rule_view.remove(request) + # 发起请求 + response: RemoveRuleViewResponse = client.report.v1.rule_view.remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.rule_view.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.rule_view.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRuleViewRequest = RemoveRuleViewRequest.builder() \ - .rule_id("6894419345318182122") \ - .user_id_type("user_id") \ - .request_body(RemoveRuleViewRequestBody.builder() - .user_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveRuleViewRequest = RemoveRuleViewRequest.builder() \ + .rule_id("6894419345318182122") \ + .user_id_type("user_id") \ + .request_body(RemoveRuleViewRequestBody.builder() + .user_ids([]) + .build()) \ + .build() - # 发起请求 - response: RemoveRuleViewResponse = await client.report.v1.rule_view.aremove(request) + # 发起请求 + response: RemoveRuleViewResponse = await client.report.v1.rule_view.aremove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.report.v1.rule_view.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.report.v1.rule_view.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/create_app_sample.py b/samples/api/search/v2/create_app_sample.py index d5413f26a..802db69a1 100644 --- a/samples/api/search/v2/create_app_sample.py +++ b/samples/api/search/v2/create_app_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRequest = CreateAppRequest.builder() \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("str") \ - .request_body(CreateAppRequestBody.builder() - .query("测试应用") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRequest = CreateAppRequest.builder() \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("str") \ + .request_body(CreateAppRequestBody.builder() + .query("测试应用") + .build()) \ + .build() - # 发起请求 - response: CreateAppResponse = client.search.v2.app.create(request) + # 发起请求 + response: CreateAppResponse = client.search.v2.app.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.app.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.app.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateAppRequest = CreateAppRequest.builder() \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("str") \ - .request_body(CreateAppRequestBody.builder() - .query("测试应用") - .build()) \ - .build() + # 构造请求对象 + request: CreateAppRequest = CreateAppRequest.builder() \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("str") \ + .request_body(CreateAppRequestBody.builder() + .query("测试应用") + .build()) \ + .build() - # 发起请求 - response: CreateAppResponse = await client.search.v2.app.acreate(request) + # 发起请求 + response: CreateAppResponse = await client.search.v2.app.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.app.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.app.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/create_data_source_item_sample.py b/samples/api/search/v2/create_data_source_item_sample.py index 4162f020a..7c677e47d 100644 --- a/samples/api/search/v2/create_data_source_item_sample.py +++ b/samples/api/search/v2/create_data_source_item_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDataSourceItemRequest = CreateDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .request_body(Item.builder() - .id("my_item_01010111") - .acl([]) - .metadata(ItemMetadata.builder().build()) - .structured_data("") - .content(ItemContent.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateDataSourceItemRequest = CreateDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .request_body(Item.builder() + .id("my_item_01010111") + .acl([]) + .metadata(ItemMetadata.builder().build()) + .structured_data("") + .content(ItemContent.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateDataSourceItemResponse = client.search.v2.data_source_item.create(request) + # 发起请求 + response: CreateDataSourceItemResponse = client.search.v2.data_source_item.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDataSourceItemRequest = CreateDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .request_body(Item.builder() - .id("my_item_01010111") - .acl([]) - .metadata(ItemMetadata.builder().build()) - .structured_data("") - .content(ItemContent.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateDataSourceItemRequest = CreateDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .request_body(Item.builder() + .id("my_item_01010111") + .acl([]) + .metadata(ItemMetadata.builder().build()) + .structured_data("") + .content(ItemContent.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateDataSourceItemResponse = await client.search.v2.data_source_item.acreate(request) + # 发起请求 + response: CreateDataSourceItemResponse = await client.search.v2.data_source_item.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/create_data_source_sample.py b/samples/api/search/v2/create_data_source_sample.py index b0caa9ad7..5eff34d65 100644 --- a/samples/api/search/v2/create_data_source_sample.py +++ b/samples/api/search/v2/create_data_source_sample.py @@ -5,88 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDataSourceRequest = CreateDataSourceRequest.builder() \ - .request_body(DataSource.builder() - .name("客服工单") - .state(0) - .description("搜索客服工单") - .icon_url( - "https://s3-imfile.feishucdn.com/static-resource/v1/585fd740-f52e-4098-b864-57a32082ba1g") - .template("search_common_card") - .searchable_fields([]) - .i18n_name(I18nMeta.builder().build()) - .i18n_description(I18nMeta.builder().build()) - .schema_id("7159054681489010384") - .app_id("cli_a1306bed4738d01b") - .connect_type(0) - .connector_param(ConnectorParam.builder().build()) - .enable_answer(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateDataSourceRequest = CreateDataSourceRequest.builder() \ + .request_body(DataSource.builder() + .name("客服工单") + .state(0) + .description("搜索客服工单") + .icon_url("https://s3-imfile.feishucdn.com/static-resource/v1/585fd740-f52e-4098-b864-57a32082ba1g") + .template("search_common_card") + .searchable_fields([]) + .i18n_name(I18nMeta.builder().build()) + .i18n_description(I18nMeta.builder().build()) + .schema_id("7159054681489010384") + .app_id("cli_a1306bed4738d01b") + .connect_type(0) + .connector_param(ConnectorParam.builder().build()) + .enable_answer(False) + .build()) \ + .build() - # 发起请求 - response: CreateDataSourceResponse = client.search.v2.data_source.create(request) + # 发起请求 + response: CreateDataSourceResponse = client.search.v2.data_source.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateDataSourceRequest = CreateDataSourceRequest.builder() \ - .request_body(DataSource.builder() - .name("客服工单") - .state(0) - .description("搜索客服工单") - .icon_url( - "https://s3-imfile.feishucdn.com/static-resource/v1/585fd740-f52e-4098-b864-57a32082ba1g") - .template("search_common_card") - .searchable_fields([]) - .i18n_name(I18nMeta.builder().build()) - .i18n_description(I18nMeta.builder().build()) - .schema_id("7159054681489010384") - .app_id("cli_a1306bed4738d01b") - .connect_type(0) - .connector_param(ConnectorParam.builder().build()) - .enable_answer(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateDataSourceRequest = CreateDataSourceRequest.builder() \ + .request_body(DataSource.builder() + .name("客服工单") + .state(0) + .description("搜索客服工单") + .icon_url("https://s3-imfile.feishucdn.com/static-resource/v1/585fd740-f52e-4098-b864-57a32082ba1g") + .template("search_common_card") + .searchable_fields([]) + .i18n_name(I18nMeta.builder().build()) + .i18n_description(I18nMeta.builder().build()) + .schema_id("7159054681489010384") + .app_id("cli_a1306bed4738d01b") + .connect_type(0) + .connector_param(ConnectorParam.builder().build()) + .enable_answer(False) + .build()) \ + .build() - # 发起请求 - response: CreateDataSourceResponse = await client.search.v2.data_source.acreate(request) + # 发起请求 + response: CreateDataSourceResponse = await client.search.v2.data_source.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/create_message_sample.py b/samples/api/search/v2/create_message_sample.py index be8e8c596..3cd2db11b 100644 --- a/samples/api/search/v2/create_message_sample.py +++ b/samples/api/search/v2/create_message_sample.py @@ -5,84 +5,84 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("str") \ - .request_body(CreateMessageRequestBody.builder() - .query("测试消息") - .from_ids([]) - .chat_ids([]) - .message_type("file") - .at_chatter_ids([]) - .from_type("bot") - .chat_type("group_chat") - .start_time("1609296809") - .end_time("1609296809") - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("str") \ + .request_body(CreateMessageRequestBody.builder() + .query("测试消息") + .from_ids([]) + .chat_ids([]) + .message_type("file") + .at_chatter_ids([]) + .from_type("bot") + .chat_type("group_chat") + .start_time("1609296809") + .end_time("1609296809") + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = client.search.v2.message.create(request) + # 发起请求 + response: CreateMessageResponse = client.search.v2.message.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.message.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateMessageRequest = CreateMessageRequest.builder() \ - .user_id_type("user_id") \ - .page_size(20) \ - .page_token("str") \ - .request_body(CreateMessageRequestBody.builder() - .query("测试消息") - .from_ids([]) - .chat_ids([]) - .message_type("file") - .at_chatter_ids([]) - .from_type("bot") - .chat_type("group_chat") - .start_time("1609296809") - .end_time("1609296809") - .build()) \ - .build() + # 构造请求对象 + request: CreateMessageRequest = CreateMessageRequest.builder() \ + .user_id_type("user_id") \ + .page_size(20) \ + .page_token("str") \ + .request_body(CreateMessageRequestBody.builder() + .query("测试消息") + .from_ids([]) + .chat_ids([]) + .message_type("file") + .at_chatter_ids([]) + .from_type("bot") + .chat_type("group_chat") + .start_time("1609296809") + .end_time("1609296809") + .build()) \ + .build() - # 发起请求 - response: CreateMessageResponse = await client.search.v2.message.acreate(request) + # 发起请求 + response: CreateMessageResponse = await client.search.v2.message.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.message.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/create_schema_sample.py b/samples/api/search/v2/create_schema_sample.py index 3faecf9d3..aeaafd074 100644 --- a/samples/api/search/v2/create_schema_sample.py +++ b/samples/api/search/v2/create_schema_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSchemaRequest = CreateSchemaRequest.builder() \ - .validate_only(False) \ - .request_body(Schema.builder() - .properties([]) - .display(SchemaDisplay.builder().build()) - .schema_id("jira_schema") - .build()) \ - .build() + # 构造请求对象 + request: CreateSchemaRequest = CreateSchemaRequest.builder() \ + .validate_only(False) \ + .request_body(Schema.builder() + .properties([]) + .display(SchemaDisplay.builder().build()) + .schema_id("jira_schema") + .build()) \ + .build() - # 发起请求 - response: CreateSchemaResponse = client.search.v2.schema.create(request) + # 发起请求 + response: CreateSchemaResponse = client.search.v2.schema.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSchemaRequest = CreateSchemaRequest.builder() \ - .validate_only(False) \ - .request_body(Schema.builder() - .properties([]) - .display(SchemaDisplay.builder().build()) - .schema_id("jira_schema") - .build()) \ - .build() + # 构造请求对象 + request: CreateSchemaRequest = CreateSchemaRequest.builder() \ + .validate_only(False) \ + .request_body(Schema.builder() + .properties([]) + .display(SchemaDisplay.builder().build()) + .schema_id("jira_schema") + .build()) \ + .build() - # 发起请求 - response: CreateSchemaResponse = await client.search.v2.schema.acreate(request) + # 发起请求 + response: CreateSchemaResponse = await client.search.v2.schema.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/delete_data_source_item_sample.py b/samples/api/search/v2/delete_data_source_item_sample.py index b1184e551..236aa7384 100644 --- a/samples/api/search/v2/delete_data_source_item_sample.py +++ b/samples/api/search/v2/delete_data_source_item_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDataSourceItemRequest = DeleteDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .item_id("01010111") \ - .build() + # 构造请求对象 + request: DeleteDataSourceItemRequest = DeleteDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .item_id("01010111") \ + .build() - # 发起请求 - response: DeleteDataSourceItemResponse = client.search.v2.data_source_item.delete(request) + # 发起请求 + response: DeleteDataSourceItemResponse = client.search.v2.data_source_item.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDataSourceItemRequest = DeleteDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .item_id("01010111") \ - .build() + # 构造请求对象 + request: DeleteDataSourceItemRequest = DeleteDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .item_id("01010111") \ + .build() - # 发起请求 - response: DeleteDataSourceItemResponse = await client.search.v2.data_source_item.adelete(request) + # 发起请求 + response: DeleteDataSourceItemResponse = await client.search.v2.data_source_item.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/delete_data_source_sample.py b/samples/api/search/v2/delete_data_source_sample.py index 8ed508dd8..a936fe753 100644 --- a/samples/api/search/v2/delete_data_source_sample.py +++ b/samples/api/search/v2/delete_data_source_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDataSourceRequest = DeleteDataSourceRequest.builder() \ - .data_source_id("6953903108179099667") \ - .build() + # 构造请求对象 + request: DeleteDataSourceRequest = DeleteDataSourceRequest.builder() \ + .data_source_id("6953903108179099667") \ + .build() - # 发起请求 - response: DeleteDataSourceResponse = client.search.v2.data_source.delete(request) + # 发起请求 + response: DeleteDataSourceResponse = client.search.v2.data_source.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteDataSourceRequest = DeleteDataSourceRequest.builder() \ - .data_source_id("6953903108179099667") \ - .build() + # 构造请求对象 + request: DeleteDataSourceRequest = DeleteDataSourceRequest.builder() \ + .data_source_id("6953903108179099667") \ + .build() - # 发起请求 - response: DeleteDataSourceResponse = await client.search.v2.data_source.adelete(request) + # 发起请求 + response: DeleteDataSourceResponse = await client.search.v2.data_source.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/delete_schema_sample.py b/samples/api/search/v2/delete_schema_sample.py index e45e785ca..ce40ae0e9 100644 --- a/samples/api/search/v2/delete_schema_sample.py +++ b/samples/api/search/v2/delete_schema_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSchemaRequest = DeleteSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .build() + # 构造请求对象 + request: DeleteSchemaRequest = DeleteSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .build() - # 发起请求 - response: DeleteSchemaResponse = client.search.v2.schema.delete(request) + # 发起请求 + response: DeleteSchemaResponse = client.search.v2.schema.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSchemaRequest = DeleteSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .build() + # 构造请求对象 + request: DeleteSchemaRequest = DeleteSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .build() - # 发起请求 - response: DeleteSchemaResponse = await client.search.v2.schema.adelete(request) + # 发起请求 + response: DeleteSchemaResponse = await client.search.v2.schema.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/get_data_source_item_sample.py b/samples/api/search/v2/get_data_source_item_sample.py index 9f5110690..6f0dd1c72 100644 --- a/samples/api/search/v2/get_data_source_item_sample.py +++ b/samples/api/search/v2/get_data_source_item_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDataSourceItemRequest = GetDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .item_id("01010111") \ - .build() + # 构造请求对象 + request: GetDataSourceItemRequest = GetDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .item_id("01010111") \ + .build() - # 发起请求 - response: GetDataSourceItemResponse = client.search.v2.data_source_item.get(request) + # 发起请求 + response: GetDataSourceItemResponse = client.search.v2.data_source_item.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDataSourceItemRequest = GetDataSourceItemRequest.builder() \ - .data_source_id("service_ticket") \ - .item_id("01010111") \ - .build() + # 构造请求对象 + request: GetDataSourceItemRequest = GetDataSourceItemRequest.builder() \ + .data_source_id("service_ticket") \ + .item_id("01010111") \ + .build() - # 发起请求 - response: GetDataSourceItemResponse = await client.search.v2.data_source_item.aget(request) + # 发起请求 + response: GetDataSourceItemResponse = await client.search.v2.data_source_item.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source_item.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source_item.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/get_data_source_sample.py b/samples/api/search/v2/get_data_source_sample.py index 2146ff8e3..aa9c6f9fb 100644 --- a/samples/api/search/v2/get_data_source_sample.py +++ b/samples/api/search/v2/get_data_source_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDataSourceRequest = GetDataSourceRequest.builder() \ - .data_source_id("service_ticket") \ - .build() + # 构造请求对象 + request: GetDataSourceRequest = GetDataSourceRequest.builder() \ + .data_source_id("service_ticket") \ + .build() - # 发起请求 - response: GetDataSourceResponse = client.search.v2.data_source.get(request) + # 发起请求 + response: GetDataSourceResponse = client.search.v2.data_source.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDataSourceRequest = GetDataSourceRequest.builder() \ - .data_source_id("service_ticket") \ - .build() + # 构造请求对象 + request: GetDataSourceRequest = GetDataSourceRequest.builder() \ + .data_source_id("service_ticket") \ + .build() - # 发起请求 - response: GetDataSourceResponse = await client.search.v2.data_source.aget(request) + # 发起请求 + response: GetDataSourceResponse = await client.search.v2.data_source.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/get_schema_sample.py b/samples/api/search/v2/get_schema_sample.py index d5195e7b0..0f518ce6c 100644 --- a/samples/api/search/v2/get_schema_sample.py +++ b/samples/api/search/v2/get_schema_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSchemaRequest = GetSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .build() + # 构造请求对象 + request: GetSchemaRequest = GetSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .build() - # 发起请求 - response: GetSchemaResponse = client.search.v2.schema.get(request) + # 发起请求 + response: GetSchemaResponse = client.search.v2.schema.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSchemaRequest = GetSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .build() + # 构造请求对象 + request: GetSchemaRequest = GetSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .build() - # 发起请求 - response: GetSchemaResponse = await client.search.v2.schema.aget(request) + # 发起请求 + response: GetSchemaResponse = await client.search.v2.schema.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/list_data_source_sample.py b/samples/api/search/v2/list_data_source_sample.py index 233ea6a66..6a2922c40 100644 --- a/samples/api/search/v2/list_data_source_sample.py +++ b/samples/api/search/v2/list_data_source_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDataSourceRequest = ListDataSourceRequest.builder() \ - .view(0) \ - .page_size(10) \ - .page_token("PxZFma9OIRhdBlT/dOYNiu2Ro8F2WAhcby7OhOijfljZ") \ - .build() + # 构造请求对象 + request: ListDataSourceRequest = ListDataSourceRequest.builder() \ + .view(0) \ + .page_size(10) \ + .page_token("PxZFma9OIRhdBlT/dOYNiu2Ro8F2WAhcby7OhOijfljZ") \ + .build() - # 发起请求 - response: ListDataSourceResponse = client.search.v2.data_source.list(request) + # 发起请求 + response: ListDataSourceResponse = client.search.v2.data_source.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDataSourceRequest = ListDataSourceRequest.builder() \ - .view(0) \ - .page_size(10) \ - .page_token("PxZFma9OIRhdBlT/dOYNiu2Ro8F2WAhcby7OhOijfljZ") \ - .build() + # 构造请求对象 + request: ListDataSourceRequest = ListDataSourceRequest.builder() \ + .view(0) \ + .page_size(10) \ + .page_token("PxZFma9OIRhdBlT/dOYNiu2Ro8F2WAhcby7OhOijfljZ") \ + .build() - # 发起请求 - response: ListDataSourceResponse = await client.search.v2.data_source.alist(request) + # 发起请求 + response: ListDataSourceResponse = await client.search.v2.data_source.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/patch_data_source_sample.py b/samples/api/search/v2/patch_data_source_sample.py index 494e345c9..9782634bd 100644 --- a/samples/api/search/v2/patch_data_source_sample.py +++ b/samples/api/search/v2/patch_data_source_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDataSourceRequest = PatchDataSourceRequest.builder() \ - .data_source_id("service_ticket") \ - .request_body(PatchDataSourceRequestBody.builder() - .name("客服工单") - .state(0) - .description("搜索客服工单") - .icon_url("https://www.xxx.com/open.jpg") - .i18n_name(I18nMeta.builder().build()) - .i18n_description(I18nMeta.builder().build()) - .connector_param(ConnectorParam.builder().build()) - .enable_answer(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchDataSourceRequest = PatchDataSourceRequest.builder() \ + .data_source_id("service_ticket") \ + .request_body(PatchDataSourceRequestBody.builder() + .name("客服工单") + .state(0) + .description("搜索客服工单") + .icon_url("https://www.xxx.com/open.jpg") + .i18n_name(I18nMeta.builder().build()) + .i18n_description(I18nMeta.builder().build()) + .connector_param(ConnectorParam.builder().build()) + .enable_answer(False) + .build()) \ + .build() - # 发起请求 - response: PatchDataSourceResponse = client.search.v2.data_source.patch(request) + # 发起请求 + response: PatchDataSourceResponse = client.search.v2.data_source.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchDataSourceRequest = PatchDataSourceRequest.builder() \ - .data_source_id("service_ticket") \ - .request_body(PatchDataSourceRequestBody.builder() - .name("客服工单") - .state(0) - .description("搜索客服工单") - .icon_url("https://www.xxx.com/open.jpg") - .i18n_name(I18nMeta.builder().build()) - .i18n_description(I18nMeta.builder().build()) - .connector_param(ConnectorParam.builder().build()) - .enable_answer(False) - .build()) \ - .build() + # 构造请求对象 + request: PatchDataSourceRequest = PatchDataSourceRequest.builder() \ + .data_source_id("service_ticket") \ + .request_body(PatchDataSourceRequestBody.builder() + .name("客服工单") + .state(0) + .description("搜索客服工单") + .icon_url("https://www.xxx.com/open.jpg") + .i18n_name(I18nMeta.builder().build()) + .i18n_description(I18nMeta.builder().build()) + .connector_param(ConnectorParam.builder().build()) + .enable_answer(False) + .build()) \ + .build() - # 发起请求 - response: PatchDataSourceResponse = await client.search.v2.data_source.apatch(request) + # 发起请求 + response: PatchDataSourceResponse = await client.search.v2.data_source.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.data_source.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.data_source.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/search/v2/patch_schema_sample.py b/samples/api/search/v2/patch_schema_sample.py index 88363b56c..2ad1442a4 100644 --- a/samples/api/search/v2/patch_schema_sample.py +++ b/samples/api/search/v2/patch_schema_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSchemaRequest = PatchSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .request_body(PatchSchemaRequestBody.builder() - .display(SchemaDisplay.builder().build()) - .properties([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSchemaRequest = PatchSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .request_body(PatchSchemaRequestBody.builder() + .display(SchemaDisplay.builder().build()) + .properties([]) + .build()) \ + .build() - # 发起请求 - response: PatchSchemaResponse = client.search.v2.schema.patch(request) + # 发起请求 + response: PatchSchemaResponse = client.search.v2.schema.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSchemaRequest = PatchSchemaRequest.builder() \ - .schema_id("custom_schema_id") \ - .request_body(PatchSchemaRequestBody.builder() - .display(SchemaDisplay.builder().build()) - .properties([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSchemaRequest = PatchSchemaRequest.builder() \ + .schema_id("custom_schema_id") \ + .request_body(PatchSchemaRequestBody.builder() + .display(SchemaDisplay.builder().build()) + .properties([]) + .build()) \ + .build() - # 发起请求 - response: PatchSchemaResponse = await client.search.v2.schema.apatch(request) + # 发起请求 + response: PatchSchemaResponse = await client.search.v2.schema.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.search.v2.schema.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.search.v2.schema.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/security_and_compliance/v1/list_data_openapi_log_sample.py b/samples/api/security_and_compliance/v1/list_data_openapi_log_sample.py index 508e8ab08..8ba27e0f9 100644 --- a/samples/api/security_and_compliance/v1/list_data_openapi_log_sample.py +++ b/samples/api/security_and_compliance/v1/list_data_openapi_log_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDataOpenapiLogRequest = ListDataOpenapiLogRequest.builder() \ - .request_body(ListOpenapiLogRequest.builder() - .api_keys([]) - .start_time(1610613336) - .end_time(1610613336) - .app_id("cli_xxx") - .page_size(20) - .page_token("xxx") - .build()) \ - .build() + # 构造请求对象 + request: ListDataOpenapiLogRequest = ListDataOpenapiLogRequest.builder() \ + .request_body(ListOpenapiLogRequest.builder() + .api_keys([]) + .start_time(1610613336) + .end_time(1610613336) + .app_id("cli_xxx") + .page_size(20) + .page_token("xxx") + .build()) \ + .build() - # 发起请求 - response: ListDataOpenapiLogResponse = client.security_and_compliance.v1.openapi_log.list_data(request) + # 发起请求 + response: ListDataOpenapiLogResponse = client.security_and_compliance.v1.openapi_log.list_data(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.security_and_compliance.v1.openapi_log.list_data failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.security_and_compliance.v1.openapi_log.list_data failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListDataOpenapiLogRequest = ListDataOpenapiLogRequest.builder() \ - .request_body(ListOpenapiLogRequest.builder() - .api_keys([]) - .start_time(1610613336) - .end_time(1610613336) - .app_id("cli_xxx") - .page_size(20) - .page_token("xxx") - .build()) \ - .build() + # 构造请求对象 + request: ListDataOpenapiLogRequest = ListDataOpenapiLogRequest.builder() \ + .request_body(ListOpenapiLogRequest.builder() + .api_keys([]) + .start_time(1610613336) + .end_time(1610613336) + .app_id("cli_xxx") + .page_size(20) + .page_token("xxx") + .build()) \ + .build() - # 发起请求 - response: ListDataOpenapiLogResponse = await client.security_and_compliance.v1.openapi_log.alist_data(request) + # 发起请求 + response: ListDataOpenapiLogResponse = await client.security_and_compliance.v1.openapi_log.alist_data(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.security_and_compliance.v1.openapi_log.alist_data failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.security_and_compliance.v1.openapi_log.alist_data failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/create_spreadsheet_sample.py b/samples/api/sheets/v3/create_spreadsheet_sample.py index 772884c8b..45a63775f 100644 --- a/samples/api/sheets/v3/create_spreadsheet_sample.py +++ b/samples/api/sheets/v3/create_spreadsheet_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetRequest = CreateSpreadsheetRequest.builder() \ - .request_body(Spreadsheet.builder() - .title("title") - .folder_token("fldxxxxxxxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetRequest = CreateSpreadsheetRequest.builder() \ + .request_body(Spreadsheet.builder() + .title("title") + .folder_token("fldxxxxxxxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetResponse = client.sheets.v3.spreadsheet.create(request) + # 发起请求 + response: CreateSpreadsheetResponse = client.sheets.v3.spreadsheet.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetRequest = CreateSpreadsheetRequest.builder() \ - .request_body(Spreadsheet.builder() - .title("title") - .folder_token("fldxxxxxxxxxxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetRequest = CreateSpreadsheetRequest.builder() \ + .request_body(Spreadsheet.builder() + .title("title") + .folder_token("fldxxxxxxxxxxxx") + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetResponse = await client.sheets.v3.spreadsheet.acreate(request) + # 发起请求 + response: CreateSpreadsheetResponse = await client.sheets.v3.spreadsheet.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_sample.py b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_sample.py index 066a16f12..08378141d 100644 --- a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_sample.py +++ b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterRequest = CreateSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(CreateSheetFilter.builder() - .range("str") - .col("str") - .condition(Condition.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterRequest = CreateSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(CreateSheetFilter.builder() + .range("str") + .col("str") + .condition(Condition.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.create(request) + # 发起请求 + response: CreateSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterRequest = CreateSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(CreateSheetFilter.builder() - .range("str") - .col("str") - .condition(Condition.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterRequest = CreateSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(CreateSheetFilter.builder() + .range("str") + .col("str") + .condition(Condition.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.acreate(request) + # 发起请求 + response: CreateSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_condition_sample.py b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_condition_sample.py index 295a8a7bb..c56b3c8b4 100644 --- a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_condition_sample.py +++ b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_condition_sample.py @@ -5,76 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterViewConditionRequest = CreateSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .request_body(FilterViewCondition.builder() - .condition_id("str") - .filter_type("str") - .compare_type("str") - .expected([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterViewConditionRequest = CreateSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .request_body(FilterViewCondition.builder() + .condition_id("str") + .filter_type("str") + .compare_type("str") + .expected([]) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.create( - request) + # 发起请求 + response: CreateSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterViewConditionRequest = CreateSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .request_body(FilterViewCondition.builder() - .condition_id("str") - .filter_type("str") - .compare_type("str") - .expected([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterViewConditionRequest = CreateSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .request_body(FilterViewCondition.builder() + .condition_id("str") + .filter_type("str") + .compare_type("str") + .expected([]) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.acreate( - request) + # 发起请求 + response: CreateSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_sample.py b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_sample.py index 3747d9cbf..f2b970b16 100644 --- a/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_sample.py +++ b/samples/api/sheets/v3/create_spreadsheet_sheet_filter_view_sample.py @@ -5,71 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterViewRequest = CreateSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(FilterView.builder() - .filter_view_id("str") - .filter_view_name("str") - .range("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterViewRequest = CreateSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(FilterView.builder() + .filter_view_id("str") + .filter_view_name("str") + .range("str") + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.create(request) + # 发起请求 + response: CreateSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFilterViewRequest = CreateSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(FilterView.builder() - .filter_view_id("str") - .filter_view_name("str") - .range("str") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFilterViewRequest = CreateSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(FilterView.builder() + .filter_view_id("str") + .filter_view_name("str") + .range("str") + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.acreate( - request) + # 发起请求 + response: CreateSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/create_spreadsheet_sheet_float_image_sample.py b/samples/api/sheets/v3/create_spreadsheet_sheet_float_image_sample.py index 2e6eb6518..7fd31e055 100644 --- a/samples/api/sheets/v3/create_spreadsheet_sheet_float_image_sample.py +++ b/samples/api/sheets/v3/create_spreadsheet_sheet_float_image_sample.py @@ -5,79 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFloatImageRequest = CreateSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(FloatImage.builder() - .float_image_id("str") - .float_image_token("str") - .range("str") - .width(float) - .height(float) - .offset_x(float) - .offset_y(float) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFloatImageRequest = CreateSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(FloatImage.builder() + .float_image_id("str") + .float_image_token("str") + .range("str") + .width(float) + .height(float) + .offset_x(float) + .offset_y(float) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.create(request) + # 发起请求 + response: CreateSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpreadsheetSheetFloatImageRequest = CreateSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(FloatImage.builder() - .float_image_id("str") - .float_image_token("str") - .range("str") - .width(float) - .height(float) - .offset_x(float) - .offset_y(float) - .build()) \ - .build() + # 构造请求对象 + request: CreateSpreadsheetSheetFloatImageRequest = CreateSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(FloatImage.builder() + .float_image_id("str") + .float_image_token("str") + .range("str") + .width(float) + .height(float) + .offset_x(float) + .offset_y(float) + .build()) \ + .build() - # 发起请求 - response: CreateSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.acreate( - request) + # 发起请求 + response: CreateSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_sample.py b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_sample.py index 228c6134d..179c14217 100644 --- a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_sample.py +++ b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterRequest = DeleteSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterRequest = DeleteSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.delete(request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterRequest = DeleteSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterRequest = DeleteSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.adelete(request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_condition_sample.py b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_condition_sample.py index 7ee8c51d4..38dd4ff10 100644 --- a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_condition_sample.py +++ b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_condition_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterViewConditionRequest = DeleteSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterViewConditionRequest = DeleteSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.delete( - request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterViewConditionRequest = DeleteSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterViewConditionRequest = DeleteSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.adelete( - request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_sample.py b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_sample.py index cb1541d24..f16dec9c9 100644 --- a/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_sample.py +++ b/samples/api/sheets/v3/delete_spreadsheet_sheet_filter_view_sample.py @@ -5,63 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterViewRequest = DeleteSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterViewRequest = DeleteSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.delete(request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFilterViewRequest = DeleteSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFilterViewRequest = DeleteSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.adelete( - request) + # 发起请求 + response: DeleteSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/delete_spreadsheet_sheet_float_image_sample.py b/samples/api/sheets/v3/delete_spreadsheet_sheet_float_image_sample.py index e5b4486ee..a15962e95 100644 --- a/samples/api/sheets/v3/delete_spreadsheet_sheet_float_image_sample.py +++ b/samples/api/sheets/v3/delete_spreadsheet_sheet_float_image_sample.py @@ -5,63 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFloatImageRequest = DeleteSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFloatImageRequest = DeleteSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.delete(request) + # 发起请求 + response: DeleteSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpreadsheetSheetFloatImageRequest = DeleteSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .build() + # 构造请求对象 + request: DeleteSpreadsheetSheetFloatImageRequest = DeleteSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .build() - # 发起请求 - response: DeleteSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.adelete( - request) + # 发起请求 + response: DeleteSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/find_spreadsheet_sheet_sample.py b/samples/api/sheets/v3/find_spreadsheet_sheet_sample.py index 5bdb9876a..9eb3e2819 100644 --- a/samples/api/sheets/v3/find_spreadsheet_sheet_sample.py +++ b/samples/api/sheets/v3/find_spreadsheet_sheet_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FindSpreadsheetSheetRequest = FindSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(Find.builder() - .find_condition(FindCondition.builder().build()) - .find("str") - .build()) \ - .build() + # 构造请求对象 + request: FindSpreadsheetSheetRequest = FindSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(Find.builder() + .find_condition(FindCondition.builder().build()) + .find("str") + .build()) \ + .build() - # 发起请求 - response: FindSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.find(request) + # 发起请求 + response: FindSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.find(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.find failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.find failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FindSpreadsheetSheetRequest = FindSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(Find.builder() - .find_condition(FindCondition.builder().build()) - .find("str") - .build()) \ - .build() + # 构造请求对象 + request: FindSpreadsheetSheetRequest = FindSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(Find.builder() + .find_condition(FindCondition.builder().build()) + .find("str") + .build()) \ + .build() - # 发起请求 - response: FindSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.afind(request) + # 发起请求 + response: FindSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.afind(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.afind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.afind failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sample.py b/samples/api/sheets/v3/get_spreadsheet_sample.py index 6be6ef1e2..33cbb4bea 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetRequest = GetSpreadsheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetSpreadsheetRequest = GetSpreadsheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetSpreadsheetResponse = client.sheets.v3.spreadsheet.get(request) + # 发起请求 + response: GetSpreadsheetResponse = client.sheets.v3.spreadsheet.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetRequest = GetSpreadsheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetSpreadsheetRequest = GetSpreadsheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetSpreadsheetResponse = await client.sheets.v3.spreadsheet.aget(request) + # 发起请求 + response: GetSpreadsheetResponse = await client.sheets.v3.spreadsheet.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_sample.py b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_sample.py index f39a973e2..3c2afc1ef 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterRequest = GetSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterRequest = GetSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.get(request) + # 发起请求 + response: GetSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterRequest = GetSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterRequest = GetSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.aget(request) + # 发起请求 + response: GetSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_condition_sample.py b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_condition_sample.py index c5d630347..52316e549 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_condition_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_condition_sample.py @@ -5,66 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterViewConditionRequest = GetSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterViewConditionRequest = GetSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.get( - request) + # 发起请求 + response: GetSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterViewConditionRequest = GetSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterViewConditionRequest = GetSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aget( - request) + # 发起请求 + response: GetSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_sample.py b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_sample.py index cb6a22047..2cfbc027f 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sheet_filter_view_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterViewRequest = GetSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterViewRequest = GetSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.get(request) + # 发起请求 + response: GetSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFilterViewRequest = GetSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFilterViewRequest = GetSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.aget(request) + # 发起请求 + response: GetSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sheet_float_image_sample.py b/samples/api/sheets/v3/get_spreadsheet_sheet_float_image_sample.py index 113ff7412..096036995 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sheet_float_image_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sheet_float_image_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFloatImageRequest = GetSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFloatImageRequest = GetSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.get(request) + # 发起请求 + response: GetSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetFloatImageRequest = GetSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetFloatImageRequest = GetSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.aget(request) + # 发起请求 + response: GetSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/get_spreadsheet_sheet_sample.py b/samples/api/sheets/v3/get_spreadsheet_sheet_sample.py index 0fa956ccd..a4ebf00ac 100644 --- a/samples/api/sheets/v3/get_spreadsheet_sheet_sample.py +++ b/samples/api/sheets/v3/get_spreadsheet_sheet_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetRequest = GetSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .sheet_id("giDk9k") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetRequest = GetSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .sheet_id("giDk9k") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.get(request) + # 发起请求 + response: GetSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpreadsheetSheetRequest = GetSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .sheet_id("giDk9k") \ - .build() + # 构造请求对象 + request: GetSpreadsheetSheetRequest = GetSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .sheet_id("giDk9k") \ + .build() - # 发起请求 - response: GetSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.aget(request) + # 发起请求 + response: GetSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/move_dimension_spreadsheet_sheet_sample.py b/samples/api/sheets/v3/move_dimension_spreadsheet_sheet_sample.py index f0c50cb11..f66ed062f 100644 --- a/samples/api/sheets/v3/move_dimension_spreadsheet_sheet_sample.py +++ b/samples/api/sheets/v3/move_dimension_spreadsheet_sheet_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveDimensionSpreadsheetSheetRequest = MoveDimensionSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(MoveDimension.builder() - .source(Dimension.builder().build()) - .destination_index(int) - .build()) \ - .build() + # 构造请求对象 + request: MoveDimensionSpreadsheetSheetRequest = MoveDimensionSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(MoveDimension.builder() + .source(Dimension.builder().build()) + .destination_index(int) + .build()) \ + .build() - # 发起请求 - response: MoveDimensionSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.move_dimension(request) + # 发起请求 + response: MoveDimensionSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.move_dimension(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.move_dimension failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.move_dimension failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveDimensionSpreadsheetSheetRequest = MoveDimensionSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(MoveDimension.builder() - .source(Dimension.builder().build()) - .destination_index(int) - .build()) \ - .build() + # 构造请求对象 + request: MoveDimensionSpreadsheetSheetRequest = MoveDimensionSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(MoveDimension.builder() + .source(Dimension.builder().build()) + .destination_index(int) + .build()) \ + .build() - # 发起请求 - response: MoveDimensionSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.amove_dimension(request) + # 发起请求 + response: MoveDimensionSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.amove_dimension(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.amove_dimension failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.amove_dimension failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/patch_spreadsheet_sample.py b/samples/api/sheets/v3/patch_spreadsheet_sample.py index a83a97326..587b7c8f1 100644 --- a/samples/api/sheets/v3/patch_spreadsheet_sample.py +++ b/samples/api/sheets/v3/patch_spreadsheet_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetRequest = PatchSpreadsheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .request_body(UpdateSpreadsheetProperties.builder() - .title("title") - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetRequest = PatchSpreadsheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .request_body(UpdateSpreadsheetProperties.builder() + .title("title") + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetResponse = client.sheets.v3.spreadsheet.patch(request) + # 发起请求 + response: PatchSpreadsheetResponse = client.sheets.v3.spreadsheet.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetRequest = PatchSpreadsheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ - .request_body(UpdateSpreadsheetProperties.builder() - .title("title") - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetRequest = PatchSpreadsheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxx") \ + .request_body(UpdateSpreadsheetProperties.builder() + .title("title") + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetResponse = await client.sheets.v3.spreadsheet.apatch(request) + # 发起请求 + response: PatchSpreadsheetResponse = await client.sheets.v3.spreadsheet.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/patch_spreadsheet_sheet_filter_view_sample.py b/samples/api/sheets/v3/patch_spreadsheet_sheet_filter_view_sample.py index aef2b955e..4dc54007e 100644 --- a/samples/api/sheets/v3/patch_spreadsheet_sheet_filter_view_sample.py +++ b/samples/api/sheets/v3/patch_spreadsheet_sheet_filter_view_sample.py @@ -5,71 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetSheetFilterViewRequest = PatchSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .request_body(FilterView.builder() - .filter_view_name("str") - .range("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetSheetFilterViewRequest = PatchSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .request_body(FilterView.builder() + .filter_view_name("str") + .range("str") + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.patch(request) + # 发起请求 + response: PatchSpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetSheetFilterViewRequest = PatchSpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .request_body(FilterView.builder() - .filter_view_name("str") - .range("str") - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetSheetFilterViewRequest = PatchSpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .request_body(FilterView.builder() + .filter_view_name("str") + .range("str") + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.apatch( - request) + # 发起请求 + response: PatchSpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/patch_spreadsheet_sheet_float_image_sample.py b/samples/api/sheets/v3/patch_spreadsheet_sheet_float_image_sample.py index e0b1a6ee9..0d3d74b22 100644 --- a/samples/api/sheets/v3/patch_spreadsheet_sheet_float_image_sample.py +++ b/samples/api/sheets/v3/patch_spreadsheet_sheet_float_image_sample.py @@ -5,79 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetSheetFloatImageRequest = PatchSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .request_body(FloatImage.builder() - .float_image_token("str") - .range("str") - .width(float) - .height(float) - .offset_x(float) - .offset_y(float) - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetSheetFloatImageRequest = PatchSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .request_body(FloatImage.builder() + .float_image_token("str") + .range("str") + .width(float) + .height(float) + .offset_x(float) + .offset_y(float) + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.patch(request) + # 发起请求 + response: PatchSpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSpreadsheetSheetFloatImageRequest = PatchSpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .float_image_id("ye06SS14ph") \ - .request_body(FloatImage.builder() - .float_image_token("str") - .range("str") - .width(float) - .height(float) - .offset_x(float) - .offset_y(float) - .build()) \ - .build() + # 构造请求对象 + request: PatchSpreadsheetSheetFloatImageRequest = PatchSpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .float_image_id("ye06SS14ph") \ + .request_body(FloatImage.builder() + .float_image_token("str") + .range("str") + .width(float) + .height(float) + .offset_x(float) + .offset_y(float) + .build()) \ + .build() - # 发起请求 - response: PatchSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.apatch( - request) + # 发起请求 + response: PatchSpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_condition_sample.py b/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_condition_sample.py index 344edeae8..4fce5002b 100644 --- a/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_condition_sample.py +++ b/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_condition_sample.py @@ -5,64 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFilterViewConditionRequest = QuerySpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFilterViewConditionRequest = QuerySpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.query( - request) + # 发起请求 + response: QuerySpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFilterViewConditionRequest = QuerySpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFilterViewConditionRequest = QuerySpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aquery( - request) + # 发起请求 + response: QuerySpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_sample.py b/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_sample.py index 8706fea84..a3f7ecfbb 100644 --- a/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_sample.py +++ b/samples/api/sheets/v3/query_spreadsheet_sheet_filter_view_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFilterViewRequest = QuerySpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFilterViewRequest = QuerySpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.query(request) + # 发起请求 + response: QuerySpreadsheetSheetFilterViewResponse = client.sheets.v3.spreadsheet_sheet_filter_view.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFilterViewRequest = QuerySpreadsheetSheetFilterViewRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFilterViewRequest = QuerySpreadsheetSheetFilterViewRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.aquery( - request) + # 发起请求 + response: QuerySpreadsheetSheetFilterViewResponse = await client.sheets.v3.spreadsheet_sheet_filter_view.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/query_spreadsheet_sheet_float_image_sample.py b/samples/api/sheets/v3/query_spreadsheet_sheet_float_image_sample.py index f9265b466..9558f14a0 100644 --- a/samples/api/sheets/v3/query_spreadsheet_sheet_float_image_sample.py +++ b/samples/api/sheets/v3/query_spreadsheet_sheet_float_image_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFloatImageRequest = QuerySpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFloatImageRequest = QuerySpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.query(request) + # 发起请求 + response: QuerySpreadsheetSheetFloatImageResponse = client.sheets.v3.spreadsheet_sheet_float_image.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetFloatImageRequest = QuerySpreadsheetSheetFloatImageRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetFloatImageRequest = QuerySpreadsheetSheetFloatImageRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.aquery( - request) + # 发起请求 + response: QuerySpreadsheetSheetFloatImageResponse = await client.sheets.v3.spreadsheet_sheet_float_image.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_float_image.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_float_image.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/query_spreadsheet_sheet_sample.py b/samples/api/sheets/v3/query_spreadsheet_sheet_sample.py index b1fe26c42..6e220360c 100644 --- a/samples/api/sheets/v3/query_spreadsheet_sheet_sample.py +++ b/samples/api/sheets/v3/query_spreadsheet_sheet_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetRequest = QuerySpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetRequest = QuerySpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.query(request) + # 发起请求 + response: QuerySpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QuerySpreadsheetSheetRequest = QuerySpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtxxxxxxxxxxxxxxxx") \ - .build() + # 构造请求对象 + request: QuerySpreadsheetSheetRequest = QuerySpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtxxxxxxxxxxxxxxxx") \ + .build() - # 发起请求 - response: QuerySpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.aquery(request) + # 发起请求 + response: QuerySpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/replace_spreadsheet_sheet_sample.py b/samples/api/sheets/v3/replace_spreadsheet_sheet_sample.py index 9e7df164f..383949a7f 100644 --- a/samples/api/sheets/v3/replace_spreadsheet_sheet_sample.py +++ b/samples/api/sheets/v3/replace_spreadsheet_sheet_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplaceSpreadsheetSheetRequest = ReplaceSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(Replace.builder() - .find_condition(FindCondition.builder().build()) - .find("str") - .replacement("str") - .build()) \ - .build() + # 构造请求对象 + request: ReplaceSpreadsheetSheetRequest = ReplaceSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(Replace.builder() + .find_condition(FindCondition.builder().build()) + .find("str") + .replacement("str") + .build()) \ + .build() - # 发起请求 - response: ReplaceSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.replace(request) + # 发起请求 + response: ReplaceSpreadsheetSheetResponse = client.sheets.v3.spreadsheet_sheet.replace(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.replace failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.replace failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReplaceSpreadsheetSheetRequest = ReplaceSpreadsheetSheetRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .request_body(Replace.builder() - .find_condition(FindCondition.builder().build()) - .find("str") - .replacement("str") - .build()) \ - .build() + # 构造请求对象 + request: ReplaceSpreadsheetSheetRequest = ReplaceSpreadsheetSheetRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .request_body(Replace.builder() + .find_condition(FindCondition.builder().build()) + .find("str") + .replacement("str") + .build()) \ + .build() - # 发起请求 - response: ReplaceSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.areplace(request) + # 发起请求 + response: ReplaceSpreadsheetSheetResponse = await client.sheets.v3.spreadsheet_sheet.areplace(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet.areplace failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet.areplace failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/update_spreadsheet_sheet_filter_sample.py b/samples/api/sheets/v3/update_spreadsheet_sheet_filter_sample.py index ad1d5487f..e62a71693 100644 --- a/samples/api/sheets/v3/update_spreadsheet_sheet_filter_sample.py +++ b/samples/api/sheets/v3/update_spreadsheet_sheet_filter_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpreadsheetSheetFilterRequest = UpdateSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(UpdateSheetFilter.builder() - .col("str") - .condition(Condition.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpreadsheetSheetFilterRequest = UpdateSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(UpdateSheetFilter.builder() + .col("str") + .condition(Condition.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.update(request) + # 发起请求 + response: UpdateSpreadsheetSheetFilterResponse = client.sheets.v3.spreadsheet_sheet_filter.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpreadsheetSheetFilterRequest = UpdateSpreadsheetSheetFilterRequest.builder() \ - .spreadsheet_token("") \ - .sheet_id("") \ - .request_body(UpdateSheetFilter.builder() - .col("str") - .condition(Condition.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpreadsheetSheetFilterRequest = UpdateSpreadsheetSheetFilterRequest.builder() \ + .spreadsheet_token("") \ + .sheet_id("") \ + .request_body(UpdateSheetFilter.builder() + .col("str") + .condition(Condition.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.aupdate(request) + # 发起请求 + response: UpdateSpreadsheetSheetFilterResponse = await client.sheets.v3.spreadsheet_sheet_filter.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/sheets/v3/update_spreadsheet_sheet_filter_view_condition_sample.py b/samples/api/sheets/v3/update_spreadsheet_sheet_filter_view_condition_sample.py index 7d9f9c996..dd4c908c9 100644 --- a/samples/api/sheets/v3/update_spreadsheet_sheet_filter_view_condition_sample.py +++ b/samples/api/sheets/v3/update_spreadsheet_sheet_filter_view_condition_sample.py @@ -5,76 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpreadsheetSheetFilterViewConditionRequest = UpdateSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .request_body(FilterViewCondition.builder() - .filter_type("str") - .compare_type("str") - .expected([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpreadsheetSheetFilterViewConditionRequest = UpdateSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .request_body(FilterViewCondition.builder() + .filter_type("str") + .compare_type("str") + .expected([]) + .build()) \ + .build() - # 发起请求 - response: UpdateSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.update( - request) + # 发起请求 + response: UpdateSpreadsheetSheetFilterViewConditionResponse = client.sheets.v3.spreadsheet_sheet_filter_view_condition.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpreadsheetSheetFilterViewConditionRequest = UpdateSpreadsheetSheetFilterViewConditionRequest.builder() \ - .spreadsheet_token("shtcnmBA*****yGehy8") \ - .sheet_id("0b**12") \ - .filter_view_id("pH9hbVcCXA") \ - .condition_id("E") \ - .request_body(FilterViewCondition.builder() - .filter_type("str") - .compare_type("str") - .expected([]) - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpreadsheetSheetFilterViewConditionRequest = UpdateSpreadsheetSheetFilterViewConditionRequest.builder() \ + .spreadsheet_token("shtcnmBA*****yGehy8") \ + .sheet_id("0b**12") \ + .filter_view_id("pH9hbVcCXA") \ + .condition_id("E") \ + .request_body(FilterViewCondition.builder() + .filter_type("str") + .compare_type("str") + .expected([]) + .build()) \ + .build() - # 发起请求 - response: UpdateSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aupdate( - request) + # 发起请求 + response: UpdateSpreadsheetSheetFilterViewConditionResponse = await client.sheets.v3.spreadsheet_sheet_filter_view_condition.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.sheets.v3.spreadsheet_sheet_filter_view_condition.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/speech_to_text/v1/file_recognize_speech_sample.py b/samples/api/speech_to_text/v1/file_recognize_speech_sample.py index e743b8313..9e4f9c9b3 100644 --- a/samples/api/speech_to_text/v1/file_recognize_speech_sample.py +++ b/samples/api/speech_to_text/v1/file_recognize_speech_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FileRecognizeSpeechRequest = FileRecognizeSpeechRequest.builder() \ - .request_body(FileRecognizeSpeechRequestBody.builder() - .speech(Speech.builder().build()) - .config(FileConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: FileRecognizeSpeechRequest = FileRecognizeSpeechRequest.builder() \ + .request_body(FileRecognizeSpeechRequestBody.builder() + .speech(Speech.builder().build()) + .config(FileConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: FileRecognizeSpeechResponse = client.speech_to_text.v1.speech.file_recognize(request) + # 发起请求 + response: FileRecognizeSpeechResponse = client.speech_to_text.v1.speech.file_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.speech_to_text.v1.speech.file_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.speech_to_text.v1.speech.file_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: FileRecognizeSpeechRequest = FileRecognizeSpeechRequest.builder() \ - .request_body(FileRecognizeSpeechRequestBody.builder() - .speech(Speech.builder().build()) - .config(FileConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: FileRecognizeSpeechRequest = FileRecognizeSpeechRequest.builder() \ + .request_body(FileRecognizeSpeechRequestBody.builder() + .speech(Speech.builder().build()) + .config(FileConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: FileRecognizeSpeechResponse = await client.speech_to_text.v1.speech.afile_recognize(request) + # 发起请求 + response: FileRecognizeSpeechResponse = await client.speech_to_text.v1.speech.afile_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.speech_to_text.v1.speech.afile_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.speech_to_text.v1.speech.afile_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/speech_to_text/v1/stream_recognize_speech_sample.py b/samples/api/speech_to_text/v1/stream_recognize_speech_sample.py index 83bcb14ad..4d12fd64a 100644 --- a/samples/api/speech_to_text/v1/stream_recognize_speech_sample.py +++ b/samples/api/speech_to_text/v1/stream_recognize_speech_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StreamRecognizeSpeechRequest = StreamRecognizeSpeechRequest.builder() \ - .request_body(StreamRecognizeSpeechRequestBody.builder() - .speech(Speech.builder().build()) - .config(StreamConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: StreamRecognizeSpeechRequest = StreamRecognizeSpeechRequest.builder() \ + .request_body(StreamRecognizeSpeechRequestBody.builder() + .speech(Speech.builder().build()) + .config(StreamConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: StreamRecognizeSpeechResponse = client.speech_to_text.v1.speech.stream_recognize(request) + # 发起请求 + response: StreamRecognizeSpeechResponse = client.speech_to_text.v1.speech.stream_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.speech_to_text.v1.speech.stream_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.speech_to_text.v1.speech.stream_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StreamRecognizeSpeechRequest = StreamRecognizeSpeechRequest.builder() \ - .request_body(StreamRecognizeSpeechRequestBody.builder() - .speech(Speech.builder().build()) - .config(StreamConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: StreamRecognizeSpeechRequest = StreamRecognizeSpeechRequest.builder() \ + .request_body(StreamRecognizeSpeechRequestBody.builder() + .speech(Speech.builder().build()) + .config(StreamConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: StreamRecognizeSpeechResponse = await client.speech_to_text.v1.speech.astream_recognize(request) + # 发起请求 + response: StreamRecognizeSpeechResponse = await client.speech_to_text.v1.speech.astream_recognize(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.speech_to_text.v1.speech.astream_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.speech_to_text.v1.speech.astream_recognize failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/batch_delete_collaborator_task_sample.py b/samples/api/task/v1/batch_delete_collaborator_task_sample.py index 839b60c96..d675d5c21 100644 --- a/samples/api/task/v1/batch_delete_collaborator_task_sample.py +++ b/samples/api/task/v1/batch_delete_collaborator_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteCollaboratorTaskRequest = BatchDeleteCollaboratorTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Collaborator.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteCollaboratorTaskRequest = BatchDeleteCollaboratorTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Collaborator.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteCollaboratorTaskResponse = client.task.v1.task.batch_delete_collaborator(request) + # 发起请求 + response: BatchDeleteCollaboratorTaskResponse = client.task.v1.task.batch_delete_collaborator(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.batch_delete_collaborator failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.batch_delete_collaborator failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteCollaboratorTaskRequest = BatchDeleteCollaboratorTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Collaborator.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteCollaboratorTaskRequest = BatchDeleteCollaboratorTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Collaborator.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteCollaboratorTaskResponse = await client.task.v1.task.abatch_delete_collaborator(request) + # 发起请求 + response: BatchDeleteCollaboratorTaskResponse = await client.task.v1.task.abatch_delete_collaborator(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.abatch_delete_collaborator failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.abatch_delete_collaborator failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/batch_delete_follower_task_sample.py b/samples/api/task/v1/batch_delete_follower_task_sample.py index 31e77d31f..cc18ccbe0 100644 --- a/samples/api/task/v1/batch_delete_follower_task_sample.py +++ b/samples/api/task/v1/batch_delete_follower_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteFollowerTaskRequest = BatchDeleteFollowerTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Follower.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteFollowerTaskRequest = BatchDeleteFollowerTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Follower.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteFollowerTaskResponse = client.task.v1.task.batch_delete_follower(request) + # 发起请求 + response: BatchDeleteFollowerTaskResponse = client.task.v1.task.batch_delete_follower(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.batch_delete_follower failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.batch_delete_follower failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: BatchDeleteFollowerTaskRequest = BatchDeleteFollowerTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Follower.builder() - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: BatchDeleteFollowerTaskRequest = BatchDeleteFollowerTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Follower.builder() + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: BatchDeleteFollowerTaskResponse = await client.task.v1.task.abatch_delete_follower(request) + # 发起请求 + response: BatchDeleteFollowerTaskResponse = await client.task.v1.task.abatch_delete_follower(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.abatch_delete_follower failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.abatch_delete_follower failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/complete_task_sample.py b/samples/api/task/v1/complete_task_sample.py index 8505b0a69..985c48a66 100644 --- a/samples/api/task/v1/complete_task_sample.py +++ b/samples/api/task/v1/complete_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CompleteTaskRequest = CompleteTaskRequest.builder() \ - .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ - .build() + # 构造请求对象 + request: CompleteTaskRequest = CompleteTaskRequest.builder() \ + .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ + .build() - # 发起请求 - response: CompleteTaskResponse = client.task.v1.task.complete(request) + # 发起请求 + response: CompleteTaskResponse = client.task.v1.task.complete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.complete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.complete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CompleteTaskRequest = CompleteTaskRequest.builder() \ - .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ - .build() + # 构造请求对象 + request: CompleteTaskRequest = CompleteTaskRequest.builder() \ + .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ + .build() - # 发起请求 - response: CompleteTaskResponse = await client.task.v1.task.acomplete(request) + # 发起请求 + response: CompleteTaskResponse = await client.task.v1.task.acomplete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.acomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.acomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/create_task_collaborator_sample.py b/samples/api/task/v1/create_task_collaborator_sample.py index 5700c6775..66613c8ce 100644 --- a/samples/api/task/v1/create_task_collaborator_sample.py +++ b/samples/api/task/v1/create_task_collaborator_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskCollaboratorRequest = CreateTaskCollaboratorRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Collaborator.builder() - .id("ou_99e1a581b36ecc4862cbfbce473f1234") - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskCollaboratorRequest = CreateTaskCollaboratorRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Collaborator.builder() + .id("ou_99e1a581b36ecc4862cbfbce473f1234") + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateTaskCollaboratorResponse = client.task.v1.task_collaborator.create(request) + # 发起请求 + response: CreateTaskCollaboratorResponse = client.task.v1.task_collaborator.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskCollaboratorRequest = CreateTaskCollaboratorRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Collaborator.builder() - .id("ou_99e1a581b36ecc4862cbfbce473f1234") - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskCollaboratorRequest = CreateTaskCollaboratorRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Collaborator.builder() + .id("ou_99e1a581b36ecc4862cbfbce473f1234") + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateTaskCollaboratorResponse = await client.task.v1.task_collaborator.acreate(request) + # 发起请求 + response: CreateTaskCollaboratorResponse = await client.task.v1.task_collaborator.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/create_task_comment_sample.py b/samples/api/task/v1/create_task_comment_sample.py index a3c06999c..4aa990b48 100644 --- a/samples/api/task/v1/create_task_comment_sample.py +++ b/samples/api/task/v1/create_task_comment_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskCommentRequest = CreateTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Comment.builder() - .content("举杯邀明月,对影成三人") - .parent_id("6937231762296684564") - .create_milli_time("1657075055135") - .rich_content("举杯邀明月,对影成三人") - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskCommentRequest = CreateTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Comment.builder() + .content("举杯邀明月,对影成三人") + .parent_id("6937231762296684564") + .create_milli_time("1657075055135") + .rich_content("举杯邀明月,对影成三人") + .build()) \ + .build() - # 发起请求 - response: CreateTaskCommentResponse = client.task.v1.task_comment.create(request) + # 发起请求 + response: CreateTaskCommentResponse = client.task.v1.task_comment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskCommentRequest = CreateTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Comment.builder() - .content("举杯邀明月,对影成三人") - .parent_id("6937231762296684564") - .create_milli_time("1657075055135") - .rich_content("举杯邀明月,对影成三人") - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskCommentRequest = CreateTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Comment.builder() + .content("举杯邀明月,对影成三人") + .parent_id("6937231762296684564") + .create_milli_time("1657075055135") + .rich_content("举杯邀明月,对影成三人") + .build()) \ + .build() - # 发起请求 - response: CreateTaskCommentResponse = await client.task.v1.task_comment.acreate(request) + # 发起请求 + response: CreateTaskCommentResponse = await client.task.v1.task_comment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/create_task_follower_sample.py b/samples/api/task/v1/create_task_follower_sample.py index e47050010..01a5f377b 100644 --- a/samples/api/task/v1/create_task_follower_sample.py +++ b/samples/api/task/v1/create_task_follower_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskFollowerRequest = CreateTaskFollowerRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Follower.builder() - .id("ou_99e1a581b36ecc4862cbfbce473f3123") - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskFollowerRequest = CreateTaskFollowerRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Follower.builder() + .id("ou_99e1a581b36ecc4862cbfbce473f3123") + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateTaskFollowerResponse = client.task.v1.task_follower.create(request) + # 发起请求 + response: CreateTaskFollowerResponse = client.task.v1.task_follower.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskFollowerRequest = CreateTaskFollowerRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(Follower.builder() - .id("ou_99e1a581b36ecc4862cbfbce473f3123") - .id_list([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskFollowerRequest = CreateTaskFollowerRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(Follower.builder() + .id("ou_99e1a581b36ecc4862cbfbce473f3123") + .id_list([]) + .build()) \ + .build() - # 发起请求 - response: CreateTaskFollowerResponse = await client.task.v1.task_follower.acreate(request) + # 发起请求 + response: CreateTaskFollowerResponse = await client.task.v1.task_follower.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/create_task_reminder_sample.py b/samples/api/task/v1/create_task_reminder_sample.py index 50f6d2628..795d7698a 100644 --- a/samples/api/task/v1/create_task_reminder_sample.py +++ b/samples/api/task/v1/create_task_reminder_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskReminderRequest = CreateTaskReminderRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .request_body(Reminder.builder() - .relative_fire_minute(30) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskReminderRequest = CreateTaskReminderRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .request_body(Reminder.builder() + .relative_fire_minute(30) + .build()) \ + .build() - # 发起请求 - response: CreateTaskReminderResponse = client.task.v1.task_reminder.create(request) + # 发起请求 + response: CreateTaskReminderResponse = client.task.v1.task_reminder.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskReminderRequest = CreateTaskReminderRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .request_body(Reminder.builder() - .relative_fire_minute(30) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskReminderRequest = CreateTaskReminderRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .request_body(Reminder.builder() + .relative_fire_minute(30) + .build()) \ + .build() - # 发起请求 - response: CreateTaskReminderResponse = await client.task.v1.task_reminder.acreate(request) + # 发起请求 + response: CreateTaskReminderResponse = await client.task.v1.task_reminder.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/create_task_sample.py b/samples/api/task/v1/create_task_sample.py index 6429c690e..7ef6d4487 100644 --- a/samples/api/task/v1/create_task_sample.py +++ b/samples/api/task/v1/create_task_sample.py @@ -5,86 +5,86 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskRequest = CreateTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Task.builder() - .summary("每天喝八杯水,保持身心愉悦") - .description("多吃水果,多运动,健康生活,快乐工作。") - .extra("dGVzdA==") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .can_edit(False) - .custom("") - .collaborator_ids([]) - .follower_ids([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .rich_summary("每天喝八杯水,保持身心愉悦。[谷歌](https://www.google.com/)") - .rich_description("多吃水果,多运动,健康生活,快乐工作。[谷歌](https://www.google.com/)") - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskRequest = CreateTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Task.builder() + .summary("每天喝八杯水,保持身心愉悦") + .description("多吃水果,多运动,健康生活,快乐工作。") + .extra("dGVzdA==") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .can_edit(False) + .custom("") + .collaborator_ids([]) + .follower_ids([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .rich_summary("每天喝八杯水,保持身心愉悦。[谷歌](https://www.google.com/)") + .rich_description("多吃水果,多运动,健康生活,快乐工作。[谷歌](https://www.google.com/)") + .build()) \ + .build() - # 发起请求 - response: CreateTaskResponse = client.task.v1.task.create(request) + # 发起请求 + response: CreateTaskResponse = client.task.v1.task.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskRequest = CreateTaskRequest.builder() \ - .user_id_type("user_id") \ - .request_body(Task.builder() - .summary("每天喝八杯水,保持身心愉悦") - .description("多吃水果,多运动,健康生活,快乐工作。") - .extra("dGVzdA==") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .can_edit(False) - .custom("") - .collaborator_ids([]) - .follower_ids([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .rich_summary("每天喝八杯水,保持身心愉悦。[谷歌](https://www.google.com/)") - .rich_description("多吃水果,多运动,健康生活,快乐工作。[谷歌](https://www.google.com/)") - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskRequest = CreateTaskRequest.builder() \ + .user_id_type("user_id") \ + .request_body(Task.builder() + .summary("每天喝八杯水,保持身心愉悦") + .description("多吃水果,多运动,健康生活,快乐工作。") + .extra("dGVzdA==") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .can_edit(False) + .custom("") + .collaborator_ids([]) + .follower_ids([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .rich_summary("每天喝八杯水,保持身心愉悦。[谷歌](https://www.google.com/)") + .rich_description("多吃水果,多运动,健康生活,快乐工作。[谷歌](https://www.google.com/)") + .build()) \ + .build() - # 发起请求 - response: CreateTaskResponse = await client.task.v1.task.acreate(request) + # 发起请求 + response: CreateTaskResponse = await client.task.v1.task.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/delete_task_collaborator_sample.py b/samples/api/task/v1/delete_task_collaborator_sample.py index 714fef510..b1d14d506 100644 --- a/samples/api/task/v1/delete_task_collaborator_sample.py +++ b/samples/api/task/v1/delete_task_collaborator_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskCollaboratorRequest = DeleteTaskCollaboratorRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .collaborator_id("ou_99e1a581b36ecc4862cbfbce123f346a") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteTaskCollaboratorRequest = DeleteTaskCollaboratorRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .collaborator_id("ou_99e1a581b36ecc4862cbfbce123f346a") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteTaskCollaboratorResponse = client.task.v1.task_collaborator.delete(request) + # 发起请求 + response: DeleteTaskCollaboratorResponse = client.task.v1.task_collaborator.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskCollaboratorRequest = DeleteTaskCollaboratorRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .collaborator_id("ou_99e1a581b36ecc4862cbfbce123f346a") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteTaskCollaboratorRequest = DeleteTaskCollaboratorRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .collaborator_id("ou_99e1a581b36ecc4862cbfbce123f346a") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteTaskCollaboratorResponse = await client.task.v1.task_collaborator.adelete(request) + # 发起请求 + response: DeleteTaskCollaboratorResponse = await client.task.v1.task_collaborator.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/delete_task_comment_sample.py b/samples/api/task/v1/delete_task_comment_sample.py index aa1c16c95..d75a19ee9 100644 --- a/samples/api/task/v1/delete_task_comment_sample.py +++ b/samples/api/task/v1/delete_task_comment_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskCommentRequest = DeleteTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .build() + # 构造请求对象 + request: DeleteTaskCommentRequest = DeleteTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .build() - # 发起请求 - response: DeleteTaskCommentResponse = client.task.v1.task_comment.delete(request) + # 发起请求 + response: DeleteTaskCommentResponse = client.task.v1.task_comment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskCommentRequest = DeleteTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .build() + # 构造请求对象 + request: DeleteTaskCommentRequest = DeleteTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .build() - # 发起请求 - response: DeleteTaskCommentResponse = await client.task.v1.task_comment.adelete(request) + # 发起请求 + response: DeleteTaskCommentResponse = await client.task.v1.task_comment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/delete_task_follower_sample.py b/samples/api/task/v1/delete_task_follower_sample.py index ef73a2fb1..685091e52 100644 --- a/samples/api/task/v1/delete_task_follower_sample.py +++ b/samples/api/task/v1/delete_task_follower_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskFollowerRequest = DeleteTaskFollowerRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .follower_id("ou_87e1a581b36ecc4862cbfbce473f346a") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteTaskFollowerRequest = DeleteTaskFollowerRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .follower_id("ou_87e1a581b36ecc4862cbfbce473f346a") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteTaskFollowerResponse = client.task.v1.task_follower.delete(request) + # 发起请求 + response: DeleteTaskFollowerResponse = client.task.v1.task_follower.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskFollowerRequest = DeleteTaskFollowerRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .follower_id("ou_87e1a581b36ecc4862cbfbce473f346a") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: DeleteTaskFollowerRequest = DeleteTaskFollowerRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .follower_id("ou_87e1a581b36ecc4862cbfbce473f346a") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: DeleteTaskFollowerResponse = await client.task.v1.task_follower.adelete(request) + # 发起请求 + response: DeleteTaskFollowerResponse = await client.task.v1.task_follower.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/delete_task_reminder_sample.py b/samples/api/task/v1/delete_task_reminder_sample.py index 063c3d614..9ec1a91d8 100644 --- a/samples/api/task/v1/delete_task_reminder_sample.py +++ b/samples/api/task/v1/delete_task_reminder_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskReminderRequest = DeleteTaskReminderRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .reminder_id("1") \ - .build() + # 构造请求对象 + request: DeleteTaskReminderRequest = DeleteTaskReminderRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .reminder_id("1") \ + .build() - # 发起请求 - response: DeleteTaskReminderResponse = client.task.v1.task_reminder.delete(request) + # 发起请求 + response: DeleteTaskReminderResponse = client.task.v1.task_reminder.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskReminderRequest = DeleteTaskReminderRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .reminder_id("1") \ - .build() + # 构造请求对象 + request: DeleteTaskReminderRequest = DeleteTaskReminderRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .reminder_id("1") \ + .build() - # 发起请求 - response: DeleteTaskReminderResponse = await client.task.v1.task_reminder.adelete(request) + # 发起请求 + response: DeleteTaskReminderResponse = await client.task.v1.task_reminder.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/delete_task_sample.py b/samples/api/task/v1/delete_task_sample.py index aa5cd6747..0f08bce9d 100644 --- a/samples/api/task/v1/delete_task_sample.py +++ b/samples/api/task/v1/delete_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskRequest = DeleteTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .build() + # 构造请求对象 + request: DeleteTaskRequest = DeleteTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .build() - # 发起请求 - response: DeleteTaskResponse = client.task.v1.task.delete(request) + # 发起请求 + response: DeleteTaskResponse = client.task.v1.task.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskRequest = DeleteTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .build() + # 构造请求对象 + request: DeleteTaskRequest = DeleteTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .build() - # 发起请求 - response: DeleteTaskResponse = await client.task.v1.task.adelete(request) + # 发起请求 + response: DeleteTaskResponse = await client.task.v1.task.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/get_task_comment_sample.py b/samples/api/task/v1/get_task_comment_sample.py index b3594f536..d3089f287 100644 --- a/samples/api/task/v1/get_task_comment_sample.py +++ b/samples/api/task/v1/get_task_comment_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskCommentRequest = GetTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTaskCommentRequest = GetTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTaskCommentResponse = client.task.v1.task_comment.get(request) + # 发起请求 + response: GetTaskCommentResponse = client.task.v1.task_comment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskCommentRequest = GetTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTaskCommentRequest = GetTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTaskCommentResponse = await client.task.v1.task_comment.aget(request) + # 发起请求 + response: GetTaskCommentResponse = await client.task.v1.task_comment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/get_task_sample.py b/samples/api/task/v1/get_task_sample.py index d9fcd7816..06227b4e9 100644 --- a/samples/api/task/v1/get_task_sample.py +++ b/samples/api/task/v1/get_task_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTaskResponse = client.task.v1.task.get(request) + # 发起请求 + response: GetTaskResponse = client.task.v1.task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTaskResponse = await client.task.v1.task.aget(request) + # 发起请求 + response: GetTaskResponse = await client.task.v1.task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/list_task_collaborator_sample.py b/samples/api/task/v1/list_task_collaborator_sample.py index 193d9cc02..b81123d97 100644 --- a/samples/api/task/v1/list_task_collaborator_sample.py +++ b/samples/api/task/v1/list_task_collaborator_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskCollaboratorRequest = ListTaskCollaboratorRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(50) \ - .page_token("「上次返回的page_token」") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskCollaboratorRequest = ListTaskCollaboratorRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(50) \ + .page_token("「上次返回的page_token」") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskCollaboratorResponse = client.task.v1.task_collaborator.list(request) + # 发起请求 + response: ListTaskCollaboratorResponse = client.task.v1.task_collaborator.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskCollaboratorRequest = ListTaskCollaboratorRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(50) \ - .page_token("「上次返回的page_token」") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskCollaboratorRequest = ListTaskCollaboratorRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(50) \ + .page_token("「上次返回的page_token」") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskCollaboratorResponse = await client.task.v1.task_collaborator.alist(request) + # 发起请求 + response: ListTaskCollaboratorResponse = await client.task.v1.task_collaborator.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_collaborator.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_collaborator.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/list_task_comment_sample.py b/samples/api/task/v1/list_task_comment_sample.py index c8862fca4..79057c0be 100644 --- a/samples/api/task/v1/list_task_comment_sample.py +++ b/samples/api/task/v1/list_task_comment_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskCommentRequest = ListTaskCommentRequest.builder() \ - .task_id("") \ - .page_size(10) \ - .page_token("") \ - .list_direction(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskCommentRequest = ListTaskCommentRequest.builder() \ + .task_id("") \ + .page_size(10) \ + .page_token("") \ + .list_direction(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskCommentResponse = client.task.v1.task_comment.list(request) + # 发起请求 + response: ListTaskCommentResponse = client.task.v1.task_comment.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskCommentRequest = ListTaskCommentRequest.builder() \ - .task_id("") \ - .page_size(10) \ - .page_token("") \ - .list_direction(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskCommentRequest = ListTaskCommentRequest.builder() \ + .task_id("") \ + .page_size(10) \ + .page_token("") \ + .list_direction(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskCommentResponse = await client.task.v1.task_comment.alist(request) + # 发起请求 + response: ListTaskCommentResponse = await client.task.v1.task_comment.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/list_task_follower_sample.py b/samples/api/task/v1/list_task_follower_sample.py index 12710ee67..ec1494001 100644 --- a/samples/api/task/v1/list_task_follower_sample.py +++ b/samples/api/task/v1/list_task_follower_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskFollowerRequest = ListTaskFollowerRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(10) \ - .page_token("「上次返回的page_token」") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskFollowerRequest = ListTaskFollowerRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(10) \ + .page_token("「上次返回的page_token」") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskFollowerResponse = client.task.v1.task_follower.list(request) + # 发起请求 + response: ListTaskFollowerResponse = client.task.v1.task_follower.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskFollowerRequest = ListTaskFollowerRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(10) \ - .page_token("「上次返回的page_token」") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskFollowerRequest = ListTaskFollowerRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(10) \ + .page_token("「上次返回的page_token」") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskFollowerResponse = await client.task.v1.task_follower.alist(request) + # 发起请求 + response: ListTaskFollowerResponse = await client.task.v1.task_follower.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_follower.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_follower.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/list_task_reminder_sample.py b/samples/api/task/v1/list_task_reminder_sample.py index 40500a1d8..f24be4c03 100644 --- a/samples/api/task/v1/list_task_reminder_sample.py +++ b/samples/api/task/v1/list_task_reminder_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskReminderRequest = ListTaskReminderRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(50) \ - .page_token("「填写上次返回的page_token」") \ - .build() + # 构造请求对象 + request: ListTaskReminderRequest = ListTaskReminderRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(50) \ + .page_token("「填写上次返回的page_token」") \ + .build() - # 发起请求 - response: ListTaskReminderResponse = client.task.v1.task_reminder.list(request) + # 发起请求 + response: ListTaskReminderResponse = client.task.v1.task_reminder.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskReminderRequest = ListTaskReminderRequest.builder() \ - .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ - .page_size(50) \ - .page_token("「填写上次返回的page_token」") \ - .build() + # 构造请求对象 + request: ListTaskReminderRequest = ListTaskReminderRequest.builder() \ + .task_id("0d38e26e-190a-49e9-93a2-35067763ed1f") \ + .page_size(50) \ + .page_token("「填写上次返回的page_token」") \ + .build() - # 发起请求 - response: ListTaskReminderResponse = await client.task.v1.task_reminder.alist(request) + # 发起请求 + response: ListTaskReminderResponse = await client.task.v1.task_reminder.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_reminder.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_reminder.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/list_task_sample.py b/samples/api/task/v1/list_task_sample.py index 922a3f91d..62c3d4fa8 100644 --- a/samples/api/task/v1/list_task_sample.py +++ b/samples/api/task/v1/list_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskRequest = ListTaskRequest.builder() \ - .page_size(10) \ - .page_token("MTYzMTg3ODUxNQ==") \ - .start_create_time("1652323331") \ - .end_create_time("1652323335") \ - .task_completed(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskRequest = ListTaskRequest.builder() \ + .page_size(10) \ + .page_token("MTYzMTg3ODUxNQ==") \ + .start_create_time("1652323331") \ + .end_create_time("1652323335") \ + .task_completed(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskResponse = client.task.v1.task.list(request) + # 发起请求 + response: ListTaskResponse = client.task.v1.task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskRequest = ListTaskRequest.builder() \ - .page_size(10) \ - .page_token("MTYzMTg3ODUxNQ==") \ - .start_create_time("1652323331") \ - .end_create_time("1652323335") \ - .task_completed(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListTaskRequest = ListTaskRequest.builder() \ + .page_size(10) \ + .page_token("MTYzMTg3ODUxNQ==") \ + .start_create_time("1652323331") \ + .end_create_time("1652323335") \ + .task_completed(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListTaskResponse = await client.task.v1.task.alist(request) + # 发起请求 + response: ListTaskResponse = await client.task.v1.task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/patch_task_sample.py b/samples/api/task/v1/patch_task_sample.py index 3e8478033..a343f0337 100644 --- a/samples/api/task/v1/patch_task_sample.py +++ b/samples/api/task/v1/patch_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTaskRequest = PatchTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(PatchTaskRequestBody.builder() - .task(Task.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTaskRequest = PatchTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(PatchTaskRequestBody.builder() + .task(Task.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTaskResponse = client.task.v1.task.patch(request) + # 发起请求 + response: PatchTaskResponse = client.task.v1.task.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTaskRequest = PatchTaskRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .user_id_type("user_id") \ - .request_body(PatchTaskRequestBody.builder() - .task(Task.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTaskRequest = PatchTaskRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .user_id_type("user_id") \ + .request_body(PatchTaskRequestBody.builder() + .task(Task.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTaskResponse = await client.task.v1.task.apatch(request) + # 发起请求 + response: PatchTaskResponse = await client.task.v1.task.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/uncomplete_task_sample.py b/samples/api/task/v1/uncomplete_task_sample.py index dd200cbfa..7f28b2634 100644 --- a/samples/api/task/v1/uncomplete_task_sample.py +++ b/samples/api/task/v1/uncomplete_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UncompleteTaskRequest = UncompleteTaskRequest.builder() \ - .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ - .build() + # 构造请求对象 + request: UncompleteTaskRequest = UncompleteTaskRequest.builder() \ + .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ + .build() - # 发起请求 - response: UncompleteTaskResponse = client.task.v1.task.uncomplete(request) + # 发起请求 + response: UncompleteTaskResponse = client.task.v1.task.uncomplete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.uncomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.uncomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UncompleteTaskRequest = UncompleteTaskRequest.builder() \ - .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ - .build() + # 构造请求对象 + request: UncompleteTaskRequest = UncompleteTaskRequest.builder() \ + .task_id("bb54ab99-d360-434f-bcaa-a4cc4c05840e") \ + .build() - # 发起请求 - response: UncompleteTaskResponse = await client.task.v1.task.auncomplete(request) + # 发起请求 + response: UncompleteTaskResponse = await client.task.v1.task.auncomplete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task.auncomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task.auncomplete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v1/update_task_comment_sample.py b/samples/api/task/v1/update_task_comment_sample.py index 12e75f63b..6f2b6ba5b 100644 --- a/samples/api/task/v1/update_task_comment_sample.py +++ b/samples/api/task/v1/update_task_comment_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTaskCommentRequest = UpdateTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .user_id_type("user_id") \ - .request_body(UpdateTaskCommentRequestBody.builder() - .content("飞流直下三千尺,疑是银河落九天") - .rich_content("飞流直下三千尺,疑是银河落九天") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTaskCommentRequest = UpdateTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .user_id_type("user_id") \ + .request_body(UpdateTaskCommentRequestBody.builder() + .content("飞流直下三千尺,疑是银河落九天") + .rich_content("飞流直下三千尺,疑是银河落九天") + .build()) \ + .build() - # 发起请求 - response: UpdateTaskCommentResponse = client.task.v1.task_comment.update(request) + # 发起请求 + response: UpdateTaskCommentResponse = client.task.v1.task_comment.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTaskCommentRequest = UpdateTaskCommentRequest.builder() \ - .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ - .comment_id("6937231762296684564") \ - .user_id_type("user_id") \ - .request_body(UpdateTaskCommentRequestBody.builder() - .content("飞流直下三千尺,疑是银河落九天") - .rich_content("飞流直下三千尺,疑是银河落九天") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTaskCommentRequest = UpdateTaskCommentRequest.builder() \ + .task_id("83912691-2e43-47fc-94a4-d512e03984fa") \ + .comment_id("6937231762296684564") \ + .user_id_type("user_id") \ + .request_body(UpdateTaskCommentRequestBody.builder() + .content("飞流直下三千尺,疑是银河落九天") + .rich_content("飞流直下三千尺,疑是银河落九天") + .build()) \ + .build() - # 发起请求 - response: UpdateTaskCommentResponse = await client.task.v1.task_comment.aupdate(request) + # 发起请求 + response: UpdateTaskCommentResponse = await client.task.v1.task_comment.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v1.task_comment.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v1.task_comment.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_custom_field_sample.py b/samples/api/task/v2/add_custom_field_sample.py index 987232581..b0dfcb884 100644 --- a/samples/api/task/v2/add_custom_field_sample.py +++ b/samples/api/task/v2/add_custom_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddCustomFieldRequest = AddCustomFieldRequest.builder() \ - .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ - .request_body(AddCustomFieldRequestBody.builder() - .resource_type("tasklist") - .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") - .build()) \ - .build() + # 构造请求对象 + request: AddCustomFieldRequest = AddCustomFieldRequest.builder() \ + .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ + .request_body(AddCustomFieldRequestBody.builder() + .resource_type("tasklist") + .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") + .build()) \ + .build() - # 发起请求 - response: AddCustomFieldResponse = client.task.v2.custom_field.add(request) + # 发起请求 + response: AddCustomFieldResponse = client.task.v2.custom_field.add(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.add failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddCustomFieldRequest = AddCustomFieldRequest.builder() \ - .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ - .request_body(AddCustomFieldRequestBody.builder() - .resource_type("tasklist") - .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") - .build()) \ - .build() + # 构造请求对象 + request: AddCustomFieldRequest = AddCustomFieldRequest.builder() \ + .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ + .request_body(AddCustomFieldRequestBody.builder() + .resource_type("tasklist") + .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") + .build()) \ + .build() - # 发起请求 - response: AddCustomFieldResponse = await client.task.v2.custom_field.aadd(request) + # 发起请求 + response: AddCustomFieldResponse = await client.task.v2.custom_field.aadd(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.aadd failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.aadd failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_dependencies_task_sample.py b/samples/api/task/v2/add_dependencies_task_sample.py index 3b9f4ebfc..30b27cff2 100644 --- a/samples/api/task/v2/add_dependencies_task_sample.py +++ b/samples/api/task/v2/add_dependencies_task_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddDependenciesTaskRequest = AddDependenciesTaskRequest.builder() \ - .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ - .request_body(AddDependenciesTaskRequestBody.builder() - .dependencies([]) - .build()) \ - .build() + # 构造请求对象 + request: AddDependenciesTaskRequest = AddDependenciesTaskRequest.builder() \ + .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ + .request_body(AddDependenciesTaskRequestBody.builder() + .dependencies([]) + .build()) \ + .build() - # 发起请求 - response: AddDependenciesTaskResponse = client.task.v2.task.add_dependencies(request) + # 发起请求 + response: AddDependenciesTaskResponse = client.task.v2.task.add_dependencies(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.add_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.add_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddDependenciesTaskRequest = AddDependenciesTaskRequest.builder() \ - .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ - .request_body(AddDependenciesTaskRequestBody.builder() - .dependencies([]) - .build()) \ - .build() + # 构造请求对象 + request: AddDependenciesTaskRequest = AddDependenciesTaskRequest.builder() \ + .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ + .request_body(AddDependenciesTaskRequestBody.builder() + .dependencies([]) + .build()) \ + .build() - # 发起请求 - response: AddDependenciesTaskResponse = await client.task.v2.task.aadd_dependencies(request) + # 发起请求 + response: AddDependenciesTaskResponse = await client.task.v2.task.aadd_dependencies(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aadd_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aadd_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_members_task_sample.py b/samples/api/task/v2/add_members_task_sample.py index a1d13c765..d88bd3b51 100644 --- a/samples/api/task/v2/add_members_task_sample.py +++ b/samples/api/task/v2/add_members_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddMembersTaskRequest = AddMembersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddMembersTaskRequestBody.builder() - .members([]) - .client_token("6d99f59c-4d7d-4452-98d6-3d0556393cf6") - .build()) \ - .build() + # 构造请求对象 + request: AddMembersTaskRequest = AddMembersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddMembersTaskRequestBody.builder() + .members([]) + .client_token("6d99f59c-4d7d-4452-98d6-3d0556393cf6") + .build()) \ + .build() - # 发起请求 - response: AddMembersTaskResponse = client.task.v2.task.add_members(request) + # 发起请求 + response: AddMembersTaskResponse = client.task.v2.task.add_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.add_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.add_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddMembersTaskRequest = AddMembersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddMembersTaskRequestBody.builder() - .members([]) - .client_token("6d99f59c-4d7d-4452-98d6-3d0556393cf6") - .build()) \ - .build() + # 构造请求对象 + request: AddMembersTaskRequest = AddMembersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddMembersTaskRequestBody.builder() + .members([]) + .client_token("6d99f59c-4d7d-4452-98d6-3d0556393cf6") + .build()) \ + .build() - # 发起请求 - response: AddMembersTaskResponse = await client.task.v2.task.aadd_members(request) + # 发起请求 + response: AddMembersTaskResponse = await client.task.v2.task.aadd_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aadd_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aadd_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_members_tasklist_sample.py b/samples/api/task/v2/add_members_tasklist_sample.py index fca48cfdb..5e9776cbc 100644 --- a/samples/api/task/v2/add_members_tasklist_sample.py +++ b/samples/api/task/v2/add_members_tasklist_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddMembersTasklistRequest = AddMembersTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddMembersTasklistRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: AddMembersTasklistRequest = AddMembersTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddMembersTasklistRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: AddMembersTasklistResponse = client.task.v2.tasklist.add_members(request) + # 发起请求 + response: AddMembersTasklistResponse = client.task.v2.tasklist.add_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.add_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.add_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddMembersTasklistRequest = AddMembersTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddMembersTasklistRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: AddMembersTasklistRequest = AddMembersTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddMembersTasklistRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: AddMembersTasklistResponse = await client.task.v2.tasklist.aadd_members(request) + # 发起请求 + response: AddMembersTasklistResponse = await client.task.v2.tasklist.aadd_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.aadd_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.aadd_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_reminders_task_sample.py b/samples/api/task/v2/add_reminders_task_sample.py index c0c5ef42f..d6a137173 100644 --- a/samples/api/task/v2/add_reminders_task_sample.py +++ b/samples/api/task/v2/add_reminders_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddRemindersTaskRequest = AddRemindersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddRemindersTaskRequestBody.builder() - .reminders([]) - .build()) \ - .build() + # 构造请求对象 + request: AddRemindersTaskRequest = AddRemindersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddRemindersTaskRequestBody.builder() + .reminders([]) + .build()) \ + .build() - # 发起请求 - response: AddRemindersTaskResponse = client.task.v2.task.add_reminders(request) + # 发起请求 + response: AddRemindersTaskResponse = client.task.v2.task.add_reminders(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.add_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.add_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddRemindersTaskRequest = AddRemindersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddRemindersTaskRequestBody.builder() - .reminders([]) - .build()) \ - .build() + # 构造请求对象 + request: AddRemindersTaskRequest = AddRemindersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddRemindersTaskRequestBody.builder() + .reminders([]) + .build()) \ + .build() - # 发起请求 - response: AddRemindersTaskResponse = await client.task.v2.task.aadd_reminders(request) + # 发起请求 + response: AddRemindersTaskResponse = await client.task.v2.task.aadd_reminders(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aadd_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aadd_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/add_tasklist_task_sample.py b/samples/api/task/v2/add_tasklist_task_sample.py index 673dba310..b4b763dca 100644 --- a/samples/api/task/v2/add_tasklist_task_sample.py +++ b/samples/api/task/v2/add_tasklist_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddTasklistTaskRequest = AddTasklistTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddTasklistTaskRequestBody.builder() - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .section_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .build()) \ - .build() + # 构造请求对象 + request: AddTasklistTaskRequest = AddTasklistTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddTasklistTaskRequestBody.builder() + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .section_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .build()) \ + .build() - # 发起请求 - response: AddTasklistTaskResponse = client.task.v2.task.add_tasklist(request) + # 发起请求 + response: AddTasklistTaskResponse = client.task.v2.task.add_tasklist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.add_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.add_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: AddTasklistTaskRequest = AddTasklistTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(AddTasklistTaskRequestBody.builder() - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .section_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .build()) \ - .build() + # 构造请求对象 + request: AddTasklistTaskRequest = AddTasklistTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(AddTasklistTaskRequestBody.builder() + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .section_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .build()) \ + .build() - # 发起请求 - response: AddTasklistTaskResponse = await client.task.v2.task.aadd_tasklist(request) + # 发起请求 + response: AddTasklistTaskResponse = await client.task.v2.task.aadd_tasklist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aadd_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aadd_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_comment_sample.py b/samples/api/task/v2/create_comment_sample.py index 689e5c66e..4e82318ad 100644 --- a/samples/api/task/v2/create_comment_sample.py +++ b/samples/api/task/v2/create_comment_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCommentRequest = CreateCommentRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputComment.builder() - .content("这是一条评论。") - .reply_to_comment_id("6937231762296684564") - .resource_type("task") - .resource_id("ccb55625-95d2-2e80-655f-0e40bf67953f") - .build()) \ - .build() + # 构造请求对象 + request: CreateCommentRequest = CreateCommentRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputComment.builder() + .content("这是一条评论。") + .reply_to_comment_id("6937231762296684564") + .resource_type("task") + .resource_id("ccb55625-95d2-2e80-655f-0e40bf67953f") + .build()) \ + .build() - # 发起请求 - response: CreateCommentResponse = client.task.v2.comment.create(request) + # 发起请求 + response: CreateCommentResponse = client.task.v2.comment.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCommentRequest = CreateCommentRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputComment.builder() - .content("这是一条评论。") - .reply_to_comment_id("6937231762296684564") - .resource_type("task") - .resource_id("ccb55625-95d2-2e80-655f-0e40bf67953f") - .build()) \ - .build() + # 构造请求对象 + request: CreateCommentRequest = CreateCommentRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputComment.builder() + .content("这是一条评论。") + .reply_to_comment_id("6937231762296684564") + .resource_type("task") + .resource_id("ccb55625-95d2-2e80-655f-0e40bf67953f") + .build()) \ + .build() - # 发起请求 - response: CreateCommentResponse = await client.task.v2.comment.acreate(request) + # 发起请求 + response: CreateCommentResponse = await client.task.v2.comment.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_custom_field_option_sample.py b/samples/api/task/v2/create_custom_field_option_sample.py index 9ad3256a0..346dd3920 100644 --- a/samples/api/task/v2/create_custom_field_option_sample.py +++ b/samples/api/task/v2/create_custom_field_option_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCustomFieldOptionRequest = CreateCustomFieldOptionRequest.builder() \ - .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .request_body(InputOption.builder() - .name("高优") - .color_index(10) - .insert_before("2bd905f8-ef38-408b-aa1f-2b2ad33b2913") - .insert_after("b13adf3c-cad6-4e02-8929-550c112b5633") - .is_hidden(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateCustomFieldOptionRequest = CreateCustomFieldOptionRequest.builder() \ + .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .request_body(InputOption.builder() + .name("高优") + .color_index(10) + .insert_before("2bd905f8-ef38-408b-aa1f-2b2ad33b2913") + .insert_after("b13adf3c-cad6-4e02-8929-550c112b5633") + .is_hidden(False) + .build()) \ + .build() - # 发起请求 - response: CreateCustomFieldOptionResponse = client.task.v2.custom_field_option.create(request) + # 发起请求 + response: CreateCustomFieldOptionResponse = client.task.v2.custom_field_option.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field_option.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field_option.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCustomFieldOptionRequest = CreateCustomFieldOptionRequest.builder() \ - .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .request_body(InputOption.builder() - .name("高优") - .color_index(10) - .insert_before("2bd905f8-ef38-408b-aa1f-2b2ad33b2913") - .insert_after("b13adf3c-cad6-4e02-8929-550c112b5633") - .is_hidden(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateCustomFieldOptionRequest = CreateCustomFieldOptionRequest.builder() \ + .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .request_body(InputOption.builder() + .name("高优") + .color_index(10) + .insert_before("2bd905f8-ef38-408b-aa1f-2b2ad33b2913") + .insert_after("b13adf3c-cad6-4e02-8929-550c112b5633") + .is_hidden(False) + .build()) \ + .build() - # 发起请求 - response: CreateCustomFieldOptionResponse = await client.task.v2.custom_field_option.acreate(request) + # 发起请求 + response: CreateCustomFieldOptionResponse = await client.task.v2.custom_field_option.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field_option.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field_option.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_custom_field_sample.py b/samples/api/task/v2/create_custom_field_sample.py index 96824b1a5..f22039b68 100644 --- a/samples/api/task/v2/create_custom_field_sample.py +++ b/samples/api/task/v2/create_custom_field_sample.py @@ -5,82 +5,82 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCustomFieldRequest = CreateCustomFieldRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputCustomField.builder() - .resource_type("tasklist") - .resource_id("ec5ed63d-a4a9-44de-a935-7ba243471c0a") - .name("优先级") - .type("number") - .number_setting(NumberSetting.builder().build()) - .member_setting(MemberSetting.builder().build()) - .datetime_setting(DatetimeSetting.builder().build()) - .single_select_setting(SelectSetting.builder().build()) - .multi_select_setting(SelectSetting.builder().build()) - .text_setting(TextSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCustomFieldRequest = CreateCustomFieldRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputCustomField.builder() + .resource_type("tasklist") + .resource_id("ec5ed63d-a4a9-44de-a935-7ba243471c0a") + .name("优先级") + .type("number") + .number_setting(NumberSetting.builder().build()) + .member_setting(MemberSetting.builder().build()) + .datetime_setting(DatetimeSetting.builder().build()) + .single_select_setting(SelectSetting.builder().build()) + .multi_select_setting(SelectSetting.builder().build()) + .text_setting(TextSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCustomFieldResponse = client.task.v2.custom_field.create(request) + # 发起请求 + response: CreateCustomFieldResponse = client.task.v2.custom_field.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateCustomFieldRequest = CreateCustomFieldRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputCustomField.builder() - .resource_type("tasklist") - .resource_id("ec5ed63d-a4a9-44de-a935-7ba243471c0a") - .name("优先级") - .type("number") - .number_setting(NumberSetting.builder().build()) - .member_setting(MemberSetting.builder().build()) - .datetime_setting(DatetimeSetting.builder().build()) - .single_select_setting(SelectSetting.builder().build()) - .multi_select_setting(SelectSetting.builder().build()) - .text_setting(TextSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateCustomFieldRequest = CreateCustomFieldRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputCustomField.builder() + .resource_type("tasklist") + .resource_id("ec5ed63d-a4a9-44de-a935-7ba243471c0a") + .name("优先级") + .type("number") + .number_setting(NumberSetting.builder().build()) + .member_setting(MemberSetting.builder().build()) + .datetime_setting(DatetimeSetting.builder().build()) + .single_select_setting(SelectSetting.builder().build()) + .multi_select_setting(SelectSetting.builder().build()) + .text_setting(TextSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateCustomFieldResponse = await client.task.v2.custom_field.acreate(request) + # 发起请求 + response: CreateCustomFieldResponse = await client.task.v2.custom_field.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_section_sample.py b/samples/api/task/v2/create_section_sample.py index 55bf014e0..217d86d71 100644 --- a/samples/api/task/v2/create_section_sample.py +++ b/samples/api/task/v2/create_section_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSectionRequest = CreateSectionRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputSection.builder() - .name("已经审核过的任务") - .resource_type("tasklist") - .resource_id("cc371766-6584-cf50-a222-c22cd9055004") - .insert_before("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") - .insert_after("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") - .build()) \ - .build() + # 构造请求对象 + request: CreateSectionRequest = CreateSectionRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputSection.builder() + .name("已经审核过的任务") + .resource_type("tasklist") + .resource_id("cc371766-6584-cf50-a222-c22cd9055004") + .insert_before("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") + .insert_after("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") + .build()) \ + .build() - # 发起请求 - response: CreateSectionResponse = client.task.v2.section.create(request) + # 发起请求 + response: CreateSectionResponse = client.task.v2.section.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSectionRequest = CreateSectionRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputSection.builder() - .name("已经审核过的任务") - .resource_type("tasklist") - .resource_id("cc371766-6584-cf50-a222-c22cd9055004") - .insert_before("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") - .insert_after("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") - .build()) \ - .build() + # 构造请求对象 + request: CreateSectionRequest = CreateSectionRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputSection.builder() + .name("已经审核过的任务") + .resource_type("tasklist") + .resource_id("cc371766-6584-cf50-a222-c22cd9055004") + .insert_before("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") + .insert_after("e6e37dcc-f75a-5936-f589-12fb4b5c80c2") + .build()) \ + .build() - # 发起请求 - response: CreateSectionResponse = await client.task.v2.section.acreate(request) + # 发起请求 + response: CreateSectionResponse = await client.task.v2.section.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_task_sample.py b/samples/api/task/v2/create_task_sample.py index 9227ea60d..c6b5fd514 100644 --- a/samples/api/task/v2/create_task_sample.py +++ b/samples/api/task/v2/create_task_sample.py @@ -5,96 +5,96 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskRequest = CreateTaskRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputTask.builder() - .summary("针对全年销售进行一次复盘") - .description("需要事先阅读复盘总结文档") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .extra("dGVzdA==") - .completed_at("0") - .members([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .custom_complete(CustomComplete.builder().build()) - .tasklists([]) - .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") - .start(Start.builder().build()) - .reminders([]) - .mode(2) - .is_milestone(False) - .custom_fields([]) - .docx_source(DocxSource.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskRequest = CreateTaskRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputTask.builder() + .summary("针对全年销售进行一次复盘") + .description("需要事先阅读复盘总结文档") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .extra("dGVzdA==") + .completed_at("0") + .members([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .custom_complete(CustomComplete.builder().build()) + .tasklists([]) + .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") + .start(Start.builder().build()) + .reminders([]) + .mode(2) + .is_milestone(False) + .custom_fields([]) + .docx_source(DocxSource.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTaskResponse = client.task.v2.task.create(request) + # 发起请求 + response: CreateTaskResponse = client.task.v2.task.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskRequest = CreateTaskRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputTask.builder() - .summary("针对全年销售进行一次复盘") - .description("需要事先阅读复盘总结文档") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .extra("dGVzdA==") - .completed_at("0") - .members([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .custom_complete(CustomComplete.builder().build()) - .tasklists([]) - .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") - .start(Start.builder().build()) - .reminders([]) - .mode(2) - .is_milestone(False) - .custom_fields([]) - .docx_source(DocxSource.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskRequest = CreateTaskRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputTask.builder() + .summary("针对全年销售进行一次复盘") + .description("需要事先阅读复盘总结文档") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .extra("dGVzdA==") + .completed_at("0") + .members([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .custom_complete(CustomComplete.builder().build()) + .tasklists([]) + .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") + .start(Start.builder().build()) + .reminders([]) + .mode(2) + .is_milestone(False) + .custom_fields([]) + .docx_source(DocxSource.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTaskResponse = await client.task.v2.task.acreate(request) + # 发起请求 + response: CreateTaskResponse = await client.task.v2.task.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_task_subtask_sample.py b/samples/api/task/v2/create_task_subtask_sample.py index dba392891..0d4b876bf 100644 --- a/samples/api/task/v2/create_task_subtask_sample.py +++ b/samples/api/task/v2/create_task_subtask_sample.py @@ -5,98 +5,98 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskSubtaskRequest = CreateTaskSubtaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .request_body(InputTask.builder() - .summary("针对全年销售进行一次复盘") - .description("需要事先阅读复盘总结文档") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .extra("dGVzdA==") - .completed_at("0") - .members([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .custom_complete(CustomComplete.builder().build()) - .tasklists([]) - .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") - .start(Start.builder().build()) - .reminders([]) - .mode(2) - .is_milestone(False) - .custom_fields([]) - .docx_source(DocxSource.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskSubtaskRequest = CreateTaskSubtaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .request_body(InputTask.builder() + .summary("针对全年销售进行一次复盘") + .description("需要事先阅读复盘总结文档") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .extra("dGVzdA==") + .completed_at("0") + .members([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .custom_complete(CustomComplete.builder().build()) + .tasklists([]) + .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") + .start(Start.builder().build()) + .reminders([]) + .mode(2) + .is_milestone(False) + .custom_fields([]) + .docx_source(DocxSource.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTaskSubtaskResponse = client.task.v2.task_subtask.create(request) + # 发起请求 + response: CreateTaskSubtaskResponse = client.task.v2.task_subtask.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task_subtask.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task_subtask.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTaskSubtaskRequest = CreateTaskSubtaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .request_body(InputTask.builder() - .summary("针对全年销售进行一次复盘") - .description("需要事先阅读复盘总结文档") - .due(Due.builder().build()) - .origin(Origin.builder().build()) - .extra("dGVzdA==") - .completed_at("0") - .members([]) - .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") - .custom_complete(CustomComplete.builder().build()) - .tasklists([]) - .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") - .start(Start.builder().build()) - .reminders([]) - .mode(2) - .is_milestone(False) - .custom_fields([]) - .docx_source(DocxSource.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateTaskSubtaskRequest = CreateTaskSubtaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .request_body(InputTask.builder() + .summary("针对全年销售进行一次复盘") + .description("需要事先阅读复盘总结文档") + .due(Due.builder().build()) + .origin(Origin.builder().build()) + .extra("dGVzdA==") + .completed_at("0") + .members([]) + .repeat_rule("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + .custom_complete(CustomComplete.builder().build()) + .tasklists([]) + .client_token("daa2237f-8310-4707-a83b-52c8a81e0fb7") + .start(Start.builder().build()) + .reminders([]) + .mode(2) + .is_milestone(False) + .custom_fields([]) + .docx_source(DocxSource.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateTaskSubtaskResponse = await client.task.v2.task_subtask.acreate(request) + # 发起请求 + response: CreateTaskSubtaskResponse = await client.task.v2.task_subtask.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task_subtask.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task_subtask.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_tasklist_activity_subscription_sample.py b/samples/api/task/v2/create_tasklist_activity_subscription_sample.py index 9543059f4..2dfe71d76 100644 --- a/samples/api/task/v2/create_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/create_tasklist_activity_subscription_sample.py @@ -5,73 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTasklistActivitySubscriptionRequest = CreateTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .user_id_type("open_id") \ - .request_body(TasklistActivitySubscription.builder() - .name("我的订阅") - .subscribers([]) - .include_keys([]) - .disabled(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateTasklistActivitySubscriptionRequest = CreateTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .user_id_type("open_id") \ + .request_body(TasklistActivitySubscription.builder() + .name("我的订阅") + .subscribers([]) + .include_keys([]) + .disabled(False) + .build()) \ + .build() - # 发起请求 - response: CreateTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.create(request) + # 发起请求 + response: CreateTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTasklistActivitySubscriptionRequest = CreateTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .user_id_type("open_id") \ - .request_body(TasklistActivitySubscription.builder() - .name("我的订阅") - .subscribers([]) - .include_keys([]) - .disabled(False) - .build()) \ - .build() + # 构造请求对象 + request: CreateTasklistActivitySubscriptionRequest = CreateTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .user_id_type("open_id") \ + .request_body(TasklistActivitySubscription.builder() + .name("我的订阅") + .subscribers([]) + .include_keys([]) + .disabled(False) + .build()) \ + .build() - # 发起请求 - response: CreateTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.acreate( - request) + # 发起请求 + response: CreateTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/create_tasklist_sample.py b/samples/api/task/v2/create_tasklist_sample.py index 0b8634db9..356945c93 100644 --- a/samples/api/task/v2/create_tasklist_sample.py +++ b/samples/api/task/v2/create_tasklist_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTasklistRequest = CreateTasklistRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputTasklist.builder() - .name("年会工作任务清单") - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTasklistRequest = CreateTasklistRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputTasklist.builder() + .name("年会工作任务清单") + .members([]) + .build()) \ + .build() - # 发起请求 - response: CreateTasklistResponse = client.task.v2.tasklist.create(request) + # 发起请求 + response: CreateTasklistResponse = client.task.v2.tasklist.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateTasklistRequest = CreateTasklistRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputTasklist.builder() - .name("年会工作任务清单") - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateTasklistRequest = CreateTasklistRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputTasklist.builder() + .name("年会工作任务清单") + .members([]) + .build()) \ + .build() - # 发起请求 - response: CreateTasklistResponse = await client.task.v2.tasklist.acreate(request) + # 发起请求 + response: CreateTasklistResponse = await client.task.v2.tasklist.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_attachment_sample.py b/samples/api/task/v2/delete_attachment_sample.py index aefd0230c..ee4a8d882 100644 --- a/samples/api/task/v2/delete_attachment_sample.py +++ b/samples/api/task/v2/delete_attachment_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAttachmentRequest = DeleteAttachmentRequest.builder() \ - .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ - .build() + # 构造请求对象 + request: DeleteAttachmentRequest = DeleteAttachmentRequest.builder() \ + .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ + .build() - # 发起请求 - response: DeleteAttachmentResponse = client.task.v2.attachment.delete(request) + # 发起请求 + response: DeleteAttachmentResponse = client.task.v2.attachment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteAttachmentRequest = DeleteAttachmentRequest.builder() \ - .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ - .build() + # 构造请求对象 + request: DeleteAttachmentRequest = DeleteAttachmentRequest.builder() \ + .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ + .build() - # 发起请求 - response: DeleteAttachmentResponse = await client.task.v2.attachment.adelete(request) + # 发起请求 + response: DeleteAttachmentResponse = await client.task.v2.attachment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_comment_sample.py b/samples/api/task/v2/delete_comment_sample.py index d1f06a51b..ef07e65f0 100644 --- a/samples/api/task/v2/delete_comment_sample.py +++ b/samples/api/task/v2/delete_comment_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCommentRequest = DeleteCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .build() + # 构造请求对象 + request: DeleteCommentRequest = DeleteCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .build() - # 发起请求 - response: DeleteCommentResponse = client.task.v2.comment.delete(request) + # 发起请求 + response: DeleteCommentResponse = client.task.v2.comment.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteCommentRequest = DeleteCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .build() + # 构造请求对象 + request: DeleteCommentRequest = DeleteCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .build() - # 发起请求 - response: DeleteCommentResponse = await client.task.v2.comment.adelete(request) + # 发起请求 + response: DeleteCommentResponse = await client.task.v2.comment.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_section_sample.py b/samples/api/task/v2/delete_section_sample.py index bbbe5b933..2dbd497cf 100644 --- a/samples/api/task/v2/delete_section_sample.py +++ b/samples/api/task/v2/delete_section_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSectionRequest = DeleteSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .build() + # 构造请求对象 + request: DeleteSectionRequest = DeleteSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .build() - # 发起请求 - response: DeleteSectionResponse = client.task.v2.section.delete(request) + # 发起请求 + response: DeleteSectionResponse = client.task.v2.section.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSectionRequest = DeleteSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .build() + # 构造请求对象 + request: DeleteSectionRequest = DeleteSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .build() - # 发起请求 - response: DeleteSectionResponse = await client.task.v2.section.adelete(request) + # 发起请求 + response: DeleteSectionResponse = await client.task.v2.section.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_task_sample.py b/samples/api/task/v2/delete_task_sample.py index 2317ebe21..922809730 100644 --- a/samples/api/task/v2/delete_task_sample.py +++ b/samples/api/task/v2/delete_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskRequest = DeleteTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .build() + # 构造请求对象 + request: DeleteTaskRequest = DeleteTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .build() - # 发起请求 - response: DeleteTaskResponse = client.task.v2.task.delete(request) + # 发起请求 + response: DeleteTaskResponse = client.task.v2.task.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTaskRequest = DeleteTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .build() + # 构造请求对象 + request: DeleteTaskRequest = DeleteTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .build() - # 发起请求 - response: DeleteTaskResponse = await client.task.v2.task.adelete(request) + # 发起请求 + response: DeleteTaskResponse = await client.task.v2.task.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py b/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py index 85c3d3e75..0a064eb45 100644 --- a/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py @@ -5,61 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTasklistActivitySubscriptionRequest = DeleteTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ - .activity_subscription_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .build() + # 构造请求对象 + request: DeleteTasklistActivitySubscriptionRequest = DeleteTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ + .activity_subscription_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .build() - # 发起请求 - response: DeleteTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.delete(request) + # 发起请求 + response: DeleteTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTasklistActivitySubscriptionRequest = DeleteTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ - .activity_subscription_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .build() + # 构造请求对象 + request: DeleteTasklistActivitySubscriptionRequest = DeleteTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ + .activity_subscription_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .build() - # 发起请求 - response: DeleteTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.adelete( - request) + # 发起请求 + response: DeleteTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/delete_tasklist_sample.py b/samples/api/task/v2/delete_tasklist_sample.py index e54a98fd1..da594d587 100644 --- a/samples/api/task/v2/delete_tasklist_sample.py +++ b/samples/api/task/v2/delete_tasklist_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTasklistRequest = DeleteTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .build() + # 构造请求对象 + request: DeleteTasklistRequest = DeleteTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .build() - # 发起请求 - response: DeleteTasklistResponse = client.task.v2.tasklist.delete(request) + # 发起请求 + response: DeleteTasklistResponse = client.task.v2.tasklist.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteTasklistRequest = DeleteTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .build() + # 构造请求对象 + request: DeleteTasklistRequest = DeleteTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .build() - # 发起请求 - response: DeleteTasklistResponse = await client.task.v2.tasklist.adelete(request) + # 发起请求 + response: DeleteTasklistResponse = await client.task.v2.tasklist.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_attachment_sample.py b/samples/api/task/v2/get_attachment_sample.py index 489901667..4978a54eb 100644 --- a/samples/api/task/v2/get_attachment_sample.py +++ b/samples/api/task/v2/get_attachment_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetAttachmentResponse = client.task.v2.attachment.get(request) + # 发起请求 + response: GetAttachmentResponse = client.task.v2.attachment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetAttachmentRequest = GetAttachmentRequest.builder() \ - .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetAttachmentRequest = GetAttachmentRequest.builder() \ + .attachment_guid("b59aa7a3-e98c-4830-8273-cbb29f89b837") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetAttachmentResponse = await client.task.v2.attachment.aget(request) + # 发起请求 + response: GetAttachmentResponse = await client.task.v2.attachment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_comment_sample.py b/samples/api/task/v2/get_comment_sample.py index bcdea95a3..c3ada786c 100644 --- a/samples/api/task/v2/get_comment_sample.py +++ b/samples/api/task/v2/get_comment_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCommentRequest = GetCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetCommentRequest = GetCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetCommentResponse = client.task.v2.comment.get(request) + # 发起请求 + response: GetCommentResponse = client.task.v2.comment.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCommentRequest = GetCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetCommentRequest = GetCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetCommentResponse = await client.task.v2.comment.aget(request) + # 发起请求 + response: GetCommentResponse = await client.task.v2.comment.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_custom_field_sample.py b/samples/api/task/v2/get_custom_field_sample.py index ece28d1e9..4fd860257 100644 --- a/samples/api/task/v2/get_custom_field_sample.py +++ b/samples/api/task/v2/get_custom_field_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCustomFieldRequest = GetCustomFieldRequest.builder() \ - .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetCustomFieldRequest = GetCustomFieldRequest.builder() \ + .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetCustomFieldResponse = client.task.v2.custom_field.get(request) + # 发起请求 + response: GetCustomFieldResponse = client.task.v2.custom_field.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetCustomFieldRequest = GetCustomFieldRequest.builder() \ - .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetCustomFieldRequest = GetCustomFieldRequest.builder() \ + .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetCustomFieldResponse = await client.task.v2.custom_field.aget(request) + # 发起请求 + response: GetCustomFieldResponse = await client.task.v2.custom_field.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_section_sample.py b/samples/api/task/v2/get_section_sample.py index 24fa04f59..ab90017ef 100644 --- a/samples/api/task/v2/get_section_sample.py +++ b/samples/api/task/v2/get_section_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSectionRequest = GetSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetSectionRequest = GetSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetSectionResponse = client.task.v2.section.get(request) + # 发起请求 + response: GetSectionResponse = client.task.v2.section.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSectionRequest = GetSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetSectionRequest = GetSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetSectionResponse = await client.task.v2.section.aget(request) + # 发起请求 + response: GetSectionResponse = await client.task.v2.section.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_task_sample.py b/samples/api/task/v2/get_task_sample.py index c03823fdf..2ced6af37 100644 --- a/samples/api/task/v2/get_task_sample.py +++ b/samples/api/task/v2/get_task_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTaskResponse = client.task.v2.task.get(request) + # 发起请求 + response: GetTaskResponse = client.task.v2.task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTaskResponse = await client.task.v2.task.aget(request) + # 发起请求 + response: GetTaskResponse = await client.task.v2.task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_tasklist_activity_subscription_sample.py b/samples/api/task/v2/get_tasklist_activity_subscription_sample.py index 88e5ec04b..7bf44497e 100644 --- a/samples/api/task/v2/get_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/get_tasklist_activity_subscription_sample.py @@ -5,63 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTasklistActivitySubscriptionRequest = GetTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .activity_subscription_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTasklistActivitySubscriptionRequest = GetTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .activity_subscription_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.get(request) + # 发起请求 + response: GetTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTasklistActivitySubscriptionRequest = GetTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .activity_subscription_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTasklistActivitySubscriptionRequest = GetTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .activity_subscription_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.aget( - request) + # 发起请求 + response: GetTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/get_tasklist_sample.py b/samples/api/task/v2/get_tasklist_sample.py index 7f44e582f..d32a25587 100644 --- a/samples/api/task/v2/get_tasklist_sample.py +++ b/samples/api/task/v2/get_tasklist_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTasklistRequest = GetTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTasklistRequest = GetTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTasklistResponse = client.task.v2.tasklist.get(request) + # 发起请求 + response: GetTasklistResponse = client.task.v2.tasklist.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTasklistRequest = GetTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: GetTasklistRequest = GetTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: GetTasklistResponse = await client.task.v2.tasklist.aget(request) + # 发起请求 + response: GetTasklistResponse = await client.task.v2.tasklist.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_attachment_sample.py b/samples/api/task/v2/list_attachment_sample.py index a59acf8f4..47913b12b 100644 --- a/samples/api/task/v2/list_attachment_sample.py +++ b/samples/api/task/v2/list_attachment_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAttachmentRequest = ListAttachmentRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("task") \ - .resource_id("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListAttachmentRequest = ListAttachmentRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("task") \ + .resource_id("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListAttachmentResponse = client.task.v2.attachment.list(request) + # 发起请求 + response: ListAttachmentResponse = client.task.v2.attachment.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAttachmentRequest = ListAttachmentRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("task") \ - .resource_id("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListAttachmentRequest = ListAttachmentRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("task") \ + .resource_id("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListAttachmentResponse = await client.task.v2.attachment.alist(request) + # 发起请求 + response: ListAttachmentResponse = await client.task.v2.attachment.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_comment_sample.py b/samples/api/task/v2/list_comment_sample.py index a690e4381..14117677c 100644 --- a/samples/api/task/v2/list_comment_sample.py +++ b/samples/api/task/v2/list_comment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCommentRequest = ListCommentRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("task") \ - .resource_id("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .direction("asc") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListCommentRequest = ListCommentRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("task") \ + .resource_id("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .direction("asc") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListCommentResponse = client.task.v2.comment.list(request) + # 发起请求 + response: ListCommentResponse = client.task.v2.comment.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCommentRequest = ListCommentRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("task") \ - .resource_id("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .direction("asc") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListCommentRequest = ListCommentRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("task") \ + .resource_id("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .direction("asc") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListCommentResponse = await client.task.v2.comment.alist(request) + # 发起请求 + response: ListCommentResponse = await client.task.v2.comment.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_custom_field_sample.py b/samples/api/task/v2/list_custom_field_sample.py index e3c39da98..b350f9856 100644 --- a/samples/api/task/v2/list_custom_field_sample.py +++ b/samples/api/task/v2/list_custom_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCustomFieldRequest = ListCustomFieldRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .resource_type("tasklist") \ - .resource_id("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .build() + # 构造请求对象 + request: ListCustomFieldRequest = ListCustomFieldRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .resource_type("tasklist") \ + .resource_id("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .build() - # 发起请求 - response: ListCustomFieldResponse = client.task.v2.custom_field.list(request) + # 发起请求 + response: ListCustomFieldResponse = client.task.v2.custom_field.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListCustomFieldRequest = ListCustomFieldRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .resource_type("tasklist") \ - .resource_id("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .build() + # 构造请求对象 + request: ListCustomFieldRequest = ListCustomFieldRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .resource_type("tasklist") \ + .resource_id("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .build() - # 发起请求 - response: ListCustomFieldResponse = await client.task.v2.custom_field.alist(request) + # 发起请求 + response: ListCustomFieldResponse = await client.task.v2.custom_field.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_section_sample.py b/samples/api/task/v2/list_section_sample.py index 5f29ec5b2..d0fdeb2e8 100644 --- a/samples/api/task/v2/list_section_sample.py +++ b/samples/api/task/v2/list_section_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSectionRequest = ListSectionRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("tasklist") \ - .resource_id("caef228f-2342-23c1-c36d-91186414dc64") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListSectionRequest = ListSectionRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("tasklist") \ + .resource_id("caef228f-2342-23c1-c36d-91186414dc64") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListSectionResponse = client.task.v2.section.list(request) + # 发起请求 + response: ListSectionResponse = client.task.v2.section.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSectionRequest = ListSectionRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .resource_type("tasklist") \ - .resource_id("caef228f-2342-23c1-c36d-91186414dc64") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListSectionRequest = ListSectionRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .resource_type("tasklist") \ + .resource_id("caef228f-2342-23c1-c36d-91186414dc64") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListSectionResponse = await client.task.v2.section.alist(request) + # 发起请求 + response: ListSectionResponse = await client.task.v2.section.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_task_sample.py b/samples/api/task/v2/list_task_sample.py index 9ef1aa6a5..3373c537d 100644 --- a/samples/api/task/v2/list_task_sample.py +++ b/samples/api/task/v2/list_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskRequest = ListTaskRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .type("my_tasks") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTaskRequest = ListTaskRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .type("my_tasks") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTaskResponse = client.task.v2.task.list(request) + # 发起请求 + response: ListTaskResponse = client.task.v2.task.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskRequest = ListTaskRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .type("my_tasks") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTaskRequest = ListTaskRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .type("my_tasks") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTaskResponse = await client.task.v2.task.alist(request) + # 发起请求 + response: ListTaskResponse = await client.task.v2.task.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_task_subtask_sample.py b/samples/api/task/v2/list_task_subtask_sample.py index 286e92dd9..3d58ca936 100644 --- a/samples/api/task/v2/list_task_subtask_sample.py +++ b/samples/api/task/v2/list_task_subtask_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskSubtaskRequest = ListTaskSubtaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTaskSubtaskRequest = ListTaskSubtaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTaskSubtaskResponse = client.task.v2.task_subtask.list(request) + # 发起请求 + response: ListTaskSubtaskResponse = client.task.v2.task_subtask.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task_subtask.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task_subtask.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTaskSubtaskRequest = ListTaskSubtaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTaskSubtaskRequest = ListTaskSubtaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTaskSubtaskResponse = await client.task.v2.task_subtask.alist(request) + # 发起请求 + response: ListTaskSubtaskResponse = await client.task.v2.task_subtask.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task_subtask.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task_subtask.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_tasklist_activity_subscription_sample.py b/samples/api/task/v2/list_tasklist_activity_subscription_sample.py index 471736abc..642cf4591 100644 --- a/samples/api/task/v2/list_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/list_tasklist_activity_subscription_sample.py @@ -5,63 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTasklistActivitySubscriptionRequest = ListTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .limit(50) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTasklistActivitySubscriptionRequest = ListTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .limit(50) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.list(request) + # 发起请求 + response: ListTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTasklistActivitySubscriptionRequest = ListTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ - .limit(50) \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTasklistActivitySubscriptionRequest = ListTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("d19e3a2a-edc0-4e4e-b7cc-950e162b53ae") \ + .limit(50) \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.alist( - request) + # 发起请求 + response: ListTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/list_tasklist_sample.py b/samples/api/task/v2/list_tasklist_sample.py index 4df256a83..6c099f9b9 100644 --- a/samples/api/task/v2/list_tasklist_sample.py +++ b/samples/api/task/v2/list_tasklist_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTasklistRequest = ListTasklistRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTasklistRequest = ListTasklistRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTasklistResponse = client.task.v2.tasklist.list(request) + # 发起请求 + response: ListTasklistResponse = client.task.v2.tasklist.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListTasklistRequest = ListTasklistRequest.builder() \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: ListTasklistRequest = ListTasklistRequest.builder() \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: ListTasklistResponse = await client.task.v2.tasklist.alist(request) + # 发起请求 + response: ListTasklistResponse = await client.task.v2.tasklist.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_comment_sample.py b/samples/api/task/v2/patch_comment_sample.py index ced668bf0..77b017624 100644 --- a/samples/api/task/v2/patch_comment_sample.py +++ b/samples/api/task/v2/patch_comment_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCommentRequest = PatchCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .user_id_type("open_id") \ - .request_body(PatchCommentRequestBody.builder() - .comment(InputComment.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCommentRequest = PatchCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .user_id_type("open_id") \ + .request_body(PatchCommentRequestBody.builder() + .comment(InputComment.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCommentResponse = client.task.v2.comment.patch(request) + # 发起请求 + response: PatchCommentResponse = client.task.v2.comment.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCommentRequest = PatchCommentRequest.builder() \ - .comment_id("7198104824246747156") \ - .user_id_type("open_id") \ - .request_body(PatchCommentRequestBody.builder() - .comment(InputComment.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCommentRequest = PatchCommentRequest.builder() \ + .comment_id("7198104824246747156") \ + .user_id_type("open_id") \ + .request_body(PatchCommentRequestBody.builder() + .comment(InputComment.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCommentResponse = await client.task.v2.comment.apatch(request) + # 发起请求 + response: PatchCommentResponse = await client.task.v2.comment.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.comment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.comment.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_custom_field_option_sample.py b/samples/api/task/v2/patch_custom_field_option_sample.py index 9df132c04..473f84c10 100644 --- a/samples/api/task/v2/patch_custom_field_option_sample.py +++ b/samples/api/task/v2/patch_custom_field_option_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCustomFieldOptionRequest = PatchCustomFieldOptionRequest.builder() \ - .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .option_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .request_body(PatchCustomFieldOptionRequestBody.builder() - .option(InputOption.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCustomFieldOptionRequest = PatchCustomFieldOptionRequest.builder() \ + .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .option_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .request_body(PatchCustomFieldOptionRequestBody.builder() + .option(InputOption.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCustomFieldOptionResponse = client.task.v2.custom_field_option.patch(request) + # 发起请求 + response: PatchCustomFieldOptionResponse = client.task.v2.custom_field_option.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field_option.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field_option.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCustomFieldOptionRequest = PatchCustomFieldOptionRequest.builder() \ - .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .option_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ - .request_body(PatchCustomFieldOptionRequestBody.builder() - .option(InputOption.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCustomFieldOptionRequest = PatchCustomFieldOptionRequest.builder() \ + .custom_field_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .option_guid("b13adf3c-cad6-4e02-8929-550c112b5633") \ + .request_body(PatchCustomFieldOptionRequestBody.builder() + .option(InputOption.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCustomFieldOptionResponse = await client.task.v2.custom_field_option.apatch(request) + # 发起请求 + response: PatchCustomFieldOptionResponse = await client.task.v2.custom_field_option.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field_option.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field_option.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_custom_field_sample.py b/samples/api/task/v2/patch_custom_field_sample.py index f27bf0604..89f9d5081 100644 --- a/samples/api/task/v2/patch_custom_field_sample.py +++ b/samples/api/task/v2/patch_custom_field_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCustomFieldRequest = PatchCustomFieldRequest.builder() \ - .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .user_id_type("open_id") \ - .request_body(PatchCustomFieldRequestBody.builder() - .custom_field(InputCustomField.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCustomFieldRequest = PatchCustomFieldRequest.builder() \ + .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .user_id_type("open_id") \ + .request_body(PatchCustomFieldRequestBody.builder() + .custom_field(InputCustomField.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCustomFieldResponse = client.task.v2.custom_field.patch(request) + # 发起请求 + response: PatchCustomFieldResponse = client.task.v2.custom_field.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchCustomFieldRequest = PatchCustomFieldRequest.builder() \ - .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ - .user_id_type("open_id") \ - .request_body(PatchCustomFieldRequestBody.builder() - .custom_field(InputCustomField.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchCustomFieldRequest = PatchCustomFieldRequest.builder() \ + .custom_field_guid("5ffbe0ca-6600-41e0-a634-2b38cbcf13b8") \ + .user_id_type("open_id") \ + .request_body(PatchCustomFieldRequestBody.builder() + .custom_field(InputCustomField.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchCustomFieldResponse = await client.task.v2.custom_field.apatch(request) + # 发起请求 + response: PatchCustomFieldResponse = await client.task.v2.custom_field.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_section_sample.py b/samples/api/task/v2/patch_section_sample.py index f61b6cb4d..9c56a2dc5 100644 --- a/samples/api/task/v2/patch_section_sample.py +++ b/samples/api/task/v2/patch_section_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSectionRequest = PatchSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .request_body(PatchSectionRequestBody.builder() - .section(InputSection.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSectionRequest = PatchSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .request_body(PatchSectionRequestBody.builder() + .section(InputSection.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchSectionResponse = client.task.v2.section.patch(request) + # 发起请求 + response: PatchSectionResponse = client.task.v2.section.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchSectionRequest = PatchSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .user_id_type("open_id") \ - .request_body(PatchSectionRequestBody.builder() - .section(InputSection.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchSectionRequest = PatchSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .user_id_type("open_id") \ + .request_body(PatchSectionRequestBody.builder() + .section(InputSection.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchSectionResponse = await client.task.v2.section.apatch(request) + # 发起请求 + response: PatchSectionResponse = await client.task.v2.section.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_task_sample.py b/samples/api/task/v2/patch_task_sample.py index 94a22b1d4..50a894b09 100644 --- a/samples/api/task/v2/patch_task_sample.py +++ b/samples/api/task/v2/patch_task_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTaskRequest = PatchTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .request_body(PatchTaskRequestBody.builder() - .task(InputTask.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTaskRequest = PatchTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .request_body(PatchTaskRequestBody.builder() + .task(InputTask.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTaskResponse = client.task.v2.task.patch(request) + # 发起请求 + response: PatchTaskResponse = client.task.v2.task.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTaskRequest = PatchTaskRequest.builder() \ - .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ - .user_id_type("open_id") \ - .request_body(PatchTaskRequestBody.builder() - .task(InputTask.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTaskRequest = PatchTaskRequest.builder() \ + .task_guid("e297ddff-06ca-4166-b917-4ce57cd3a7a0") \ + .user_id_type("open_id") \ + .request_body(PatchTaskRequestBody.builder() + .task(InputTask.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTaskResponse = await client.task.v2.task.apatch(request) + # 发起请求 + response: PatchTaskResponse = await client.task.v2.task.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py b/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py index 4aafac781..0b09c766d 100644 --- a/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py @@ -5,71 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTasklistActivitySubscriptionRequest = PatchTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .activity_subscription_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ - .user_id_type("open_id") \ - .request_body(PatchTasklistActivitySubscriptionRequestBody.builder() - .activity_subscription(TasklistActivitySubscription.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTasklistActivitySubscriptionRequest = PatchTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .activity_subscription_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ + .user_id_type("open_id") \ + .request_body(PatchTasklistActivitySubscriptionRequestBody.builder() + .activity_subscription(TasklistActivitySubscription.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.patch(request) + # 发起请求 + response: PatchTasklistActivitySubscriptionResponse = client.task.v2.tasklist_activity_subscription.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTasklistActivitySubscriptionRequest = PatchTasklistActivitySubscriptionRequest.builder() \ - .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ - .activity_subscription_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ - .user_id_type("open_id") \ - .request_body(PatchTasklistActivitySubscriptionRequestBody.builder() - .activity_subscription(TasklistActivitySubscription.builder().build()) - .update_fields([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchTasklistActivitySubscriptionRequest = PatchTasklistActivitySubscriptionRequest.builder() \ + .tasklist_guid("33991879-704f-444f-81d7-55a6aa7be80c") \ + .activity_subscription_guid("f5ca6747-5ac3-422e-a97e-972c1b2c24f3") \ + .user_id_type("open_id") \ + .request_body(PatchTasklistActivitySubscriptionRequestBody.builder() + .activity_subscription(TasklistActivitySubscription.builder().build()) + .update_fields([]) + .build()) \ + .build() - # 发起请求 - response: PatchTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.apatch( - request) + # 发起请求 + response: PatchTasklistActivitySubscriptionResponse = await client.task.v2.tasklist_activity_subscription.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist_activity_subscription.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist_activity_subscription.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/patch_tasklist_sample.py b/samples/api/task/v2/patch_tasklist_sample.py index d1b051ef3..a9cd92154 100644 --- a/samples/api/task/v2/patch_tasklist_sample.py +++ b/samples/api/task/v2/patch_tasklist_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTasklistRequest = PatchTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(PatchTasklistRequestBody.builder() - .tasklist(InputTasklist.builder().build()) - .update_fields([]) - .origin_owner_to_role("none") - .build()) \ - .build() + # 构造请求对象 + request: PatchTasklistRequest = PatchTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(PatchTasklistRequestBody.builder() + .tasklist(InputTasklist.builder().build()) + .update_fields([]) + .origin_owner_to_role("none") + .build()) \ + .build() - # 发起请求 - response: PatchTasklistResponse = client.task.v2.tasklist.patch(request) + # 发起请求 + response: PatchTasklistResponse = client.task.v2.tasklist.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchTasklistRequest = PatchTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(PatchTasklistRequestBody.builder() - .tasklist(InputTasklist.builder().build()) - .update_fields([]) - .origin_owner_to_role("none") - .build()) \ - .build() + # 构造请求对象 + request: PatchTasklistRequest = PatchTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(PatchTasklistRequestBody.builder() + .tasklist(InputTasklist.builder().build()) + .update_fields([]) + .origin_owner_to_role("none") + .build()) \ + .build() - # 发起请求 - response: PatchTasklistResponse = await client.task.v2.tasklist.apatch(request) + # 发起请求 + response: PatchTasklistResponse = await client.task.v2.tasklist.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_custom_field_sample.py b/samples/api/task/v2/remove_custom_field_sample.py index 49dd3ad43..2a96f6f68 100644 --- a/samples/api/task/v2/remove_custom_field_sample.py +++ b/samples/api/task/v2/remove_custom_field_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveCustomFieldRequest = RemoveCustomFieldRequest.builder() \ - .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ - .request_body(RemoveCustomFieldRequestBody.builder() - .resource_type("tasklist") - .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") - .build()) \ - .build() + # 构造请求对象 + request: RemoveCustomFieldRequest = RemoveCustomFieldRequest.builder() \ + .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ + .request_body(RemoveCustomFieldRequestBody.builder() + .resource_type("tasklist") + .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") + .build()) \ + .build() - # 发起请求 - response: RemoveCustomFieldResponse = client.task.v2.custom_field.remove(request) + # 发起请求 + response: RemoveCustomFieldResponse = client.task.v2.custom_field.remove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.remove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveCustomFieldRequest = RemoveCustomFieldRequest.builder() \ - .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ - .request_body(RemoveCustomFieldRequestBody.builder() - .resource_type("tasklist") - .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") - .build()) \ - .build() + # 构造请求对象 + request: RemoveCustomFieldRequest = RemoveCustomFieldRequest.builder() \ + .custom_field_guid("0110a4bd-f24b-4a93-8c1a-1732b94f9593") \ + .request_body(RemoveCustomFieldRequestBody.builder() + .resource_type("tasklist") + .resource_id("0110a4bd-f24b-4a93-8c1a-1732b94f9593") + .build()) \ + .build() - # 发起请求 - response: RemoveCustomFieldResponse = await client.task.v2.custom_field.aremove(request) + # 发起请求 + response: RemoveCustomFieldResponse = await client.task.v2.custom_field.aremove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.custom_field.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.custom_field.aremove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_dependencies_task_sample.py b/samples/api/task/v2/remove_dependencies_task_sample.py index 4593a7718..3bd3b8e30 100644 --- a/samples/api/task/v2/remove_dependencies_task_sample.py +++ b/samples/api/task/v2/remove_dependencies_task_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveDependenciesTaskRequest = RemoveDependenciesTaskRequest.builder() \ - .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ - .request_body(RemoveDependenciesTaskRequestBody.builder() - .dependencies([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveDependenciesTaskRequest = RemoveDependenciesTaskRequest.builder() \ + .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ + .request_body(RemoveDependenciesTaskRequestBody.builder() + .dependencies([]) + .build()) \ + .build() - # 发起请求 - response: RemoveDependenciesTaskResponse = client.task.v2.task.remove_dependencies(request) + # 发起请求 + response: RemoveDependenciesTaskResponse = client.task.v2.task.remove_dependencies(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.remove_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.remove_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveDependenciesTaskRequest = RemoveDependenciesTaskRequest.builder() \ - .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ - .request_body(RemoveDependenciesTaskRequestBody.builder() - .dependencies([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveDependenciesTaskRequest = RemoveDependenciesTaskRequest.builder() \ + .task_guid("93b7bd05-35e6-4371-b3c9-6b7cbd7100c0") \ + .request_body(RemoveDependenciesTaskRequestBody.builder() + .dependencies([]) + .build()) \ + .build() - # 发起请求 - response: RemoveDependenciesTaskResponse = await client.task.v2.task.aremove_dependencies(request) + # 发起请求 + response: RemoveDependenciesTaskResponse = await client.task.v2.task.aremove_dependencies(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aremove_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aremove_dependencies failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_members_task_sample.py b/samples/api/task/v2/remove_members_task_sample.py index ebee14206..97ffc0dc1 100644 --- a/samples/api/task/v2/remove_members_task_sample.py +++ b/samples/api/task/v2/remove_members_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveMembersTaskRequest = RemoveMembersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveMembersTaskRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveMembersTaskRequest = RemoveMembersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveMembersTaskRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: RemoveMembersTaskResponse = client.task.v2.task.remove_members(request) + # 发起请求 + response: RemoveMembersTaskResponse = client.task.v2.task.remove_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.remove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.remove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveMembersTaskRequest = RemoveMembersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveMembersTaskRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveMembersTaskRequest = RemoveMembersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveMembersTaskRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: RemoveMembersTaskResponse = await client.task.v2.task.aremove_members(request) + # 发起请求 + response: RemoveMembersTaskResponse = await client.task.v2.task.aremove_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aremove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aremove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_members_tasklist_sample.py b/samples/api/task/v2/remove_members_tasklist_sample.py index 886e43992..83e393d83 100644 --- a/samples/api/task/v2/remove_members_tasklist_sample.py +++ b/samples/api/task/v2/remove_members_tasklist_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveMembersTasklistRequest = RemoveMembersTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveMembersTasklistRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveMembersTasklistRequest = RemoveMembersTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveMembersTasklistRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: RemoveMembersTasklistResponse = client.task.v2.tasklist.remove_members(request) + # 发起请求 + response: RemoveMembersTasklistResponse = client.task.v2.tasklist.remove_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.remove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.remove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveMembersTasklistRequest = RemoveMembersTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveMembersTasklistRequestBody.builder() - .members([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveMembersTasklistRequest = RemoveMembersTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveMembersTasklistRequestBody.builder() + .members([]) + .build()) \ + .build() - # 发起请求 - response: RemoveMembersTasklistResponse = await client.task.v2.tasklist.aremove_members(request) + # 发起请求 + response: RemoveMembersTasklistResponse = await client.task.v2.tasklist.aremove_members(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.aremove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.aremove_members failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_reminders_task_sample.py b/samples/api/task/v2/remove_reminders_task_sample.py index d7352f9f1..81f9b7152 100644 --- a/samples/api/task/v2/remove_reminders_task_sample.py +++ b/samples/api/task/v2/remove_reminders_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRemindersTaskRequest = RemoveRemindersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveRemindersTaskRequestBody.builder() - .reminder_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveRemindersTaskRequest = RemoveRemindersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveRemindersTaskRequestBody.builder() + .reminder_ids([]) + .build()) \ + .build() - # 发起请求 - response: RemoveRemindersTaskResponse = client.task.v2.task.remove_reminders(request) + # 发起请求 + response: RemoveRemindersTaskResponse = client.task.v2.task.remove_reminders(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.remove_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.remove_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveRemindersTaskRequest = RemoveRemindersTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveRemindersTaskRequestBody.builder() - .reminder_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: RemoveRemindersTaskRequest = RemoveRemindersTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveRemindersTaskRequestBody.builder() + .reminder_ids([]) + .build()) \ + .build() - # 发起请求 - response: RemoveRemindersTaskResponse = await client.task.v2.task.aremove_reminders(request) + # 发起请求 + response: RemoveRemindersTaskResponse = await client.task.v2.task.aremove_reminders(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aremove_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aremove_reminders failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/remove_tasklist_task_sample.py b/samples/api/task/v2/remove_tasklist_task_sample.py index 055949621..dcb0be804 100644 --- a/samples/api/task/v2/remove_tasklist_task_sample.py +++ b/samples/api/task/v2/remove_tasklist_task_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveTasklistTaskRequest = RemoveTasklistTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveTasklistTaskRequestBody.builder() - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .build()) \ - .build() + # 构造请求对象 + request: RemoveTasklistTaskRequest = RemoveTasklistTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveTasklistTaskRequestBody.builder() + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .build()) \ + .build() - # 发起请求 - response: RemoveTasklistTaskResponse = client.task.v2.task.remove_tasklist(request) + # 发起请求 + response: RemoveTasklistTaskResponse = client.task.v2.task.remove_tasklist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.remove_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.remove_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: RemoveTasklistTaskRequest = RemoveTasklistTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .user_id_type("open_id") \ - .request_body(RemoveTasklistTaskRequestBody.builder() - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") - .build()) \ - .build() + # 构造请求对象 + request: RemoveTasklistTaskRequest = RemoveTasklistTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .user_id_type("open_id") \ + .request_body(RemoveTasklistTaskRequestBody.builder() + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") + .build()) \ + .build() - # 发起请求 - response: RemoveTasklistTaskResponse = await client.task.v2.task.aremove_tasklist(request) + # 发起请求 + response: RemoveTasklistTaskResponse = await client.task.v2.task.aremove_tasklist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.aremove_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.aremove_tasklist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/tasklists_task_sample.py b/samples/api/task/v2/tasklists_task_sample.py index dc0870a54..3da2c0853 100644 --- a/samples/api/task/v2/tasklists_task_sample.py +++ b/samples/api/task/v2/tasklists_task_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasklistsTaskRequest = TasklistsTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .build() + # 构造请求对象 + request: TasklistsTaskRequest = TasklistsTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .build() - # 发起请求 - response: TasklistsTaskResponse = client.task.v2.task.tasklists(request) + # 发起请求 + response: TasklistsTaskResponse = client.task.v2.task.tasklists(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.tasklists failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.tasklists failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasklistsTaskRequest = TasklistsTaskRequest.builder() \ - .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .build() + # 构造请求对象 + request: TasklistsTaskRequest = TasklistsTaskRequest.builder() \ + .task_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .build() - # 发起请求 - response: TasklistsTaskResponse = await client.task.v2.task.atasklists(request) + # 发起请求 + response: TasklistsTaskResponse = await client.task.v2.task.atasklists(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.task.atasklists failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.task.atasklists failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/tasks_section_sample.py b/samples/api/task/v2/tasks_section_sample.py index 386773bae..e85ad5de5 100644 --- a/samples/api/task/v2/tasks_section_sample.py +++ b/samples/api/task/v2/tasks_section_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasksSectionRequest = TasksSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .created_from("1675742789470") \ - .created_to("1675742789470") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: TasksSectionRequest = TasksSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .created_from("1675742789470") \ + .created_to("1675742789470") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: TasksSectionResponse = client.task.v2.section.tasks(request) + # 发起请求 + response: TasksSectionResponse = client.task.v2.section.tasks(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.tasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.tasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasksSectionRequest = TasksSectionRequest.builder() \ - .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .created_from("1675742789470") \ - .created_to("1675742789470") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: TasksSectionRequest = TasksSectionRequest.builder() \ + .section_guid("9842501a-9f47-4ff5-a622-d319eeecb97f") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .created_from("1675742789470") \ + .created_to("1675742789470") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: TasksSectionResponse = await client.task.v2.section.atasks(request) + # 发起请求 + response: TasksSectionResponse = await client.task.v2.section.atasks(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.section.atasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.section.atasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/tasks_tasklist_sample.py b/samples/api/task/v2/tasks_tasklist_sample.py index b5e7612b7..407c3ed46 100644 --- a/samples/api/task/v2/tasks_tasklist_sample.py +++ b/samples/api/task/v2/tasks_tasklist_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasksTasklistRequest = TasksTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .created_from("1675742789470") \ - .created_to("1675742789470") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: TasksTasklistRequest = TasksTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .created_from("1675742789470") \ + .created_to("1675742789470") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: TasksTasklistResponse = client.task.v2.tasklist.tasks(request) + # 发起请求 + response: TasksTasklistResponse = client.task.v2.tasklist.tasks(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.tasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.tasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TasksTasklistRequest = TasksTasklistRequest.builder() \ - .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ - .page_size(50) \ - .page_token("aWQ9NzEwMjMzMjMxMDE=") \ - .completed(True) \ - .created_from("1675742789470") \ - .created_to("1675742789470") \ - .user_id_type("open_id") \ - .build() + # 构造请求对象 + request: TasksTasklistRequest = TasksTasklistRequest.builder() \ + .tasklist_guid("d300a75f-c56a-4be9-80d1-e47653028ceb") \ + .page_size(50) \ + .page_token("aWQ9NzEwMjMzMjMxMDE=") \ + .completed(True) \ + .created_from("1675742789470") \ + .created_to("1675742789470") \ + .user_id_type("open_id") \ + .build() - # 发起请求 - response: TasksTasklistResponse = await client.task.v2.tasklist.atasks(request) + # 发起请求 + response: TasksTasklistResponse = await client.task.v2.tasklist.atasks(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.tasklist.atasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.tasklist.atasks failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/task/v2/upload_attachment_sample.py b/samples/api/task/v2/upload_attachment_sample.py index 3126c6098..37f3ad980 100644 --- a/samples/api/task/v2/upload_attachment_sample.py +++ b/samples/api/task/v2/upload_attachment_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAttachmentRequest = UploadAttachmentRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputAttachment.builder() - .resource_type("task") - .resource_id("fe96108d-b004-4a47-b2f8-6886e758b3a5") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAttachmentRequest = UploadAttachmentRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputAttachment.builder() + .resource_type("task") + .resource_id("fe96108d-b004-4a47-b2f8-6886e758b3a5") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAttachmentResponse = client.task.v2.attachment.upload(request) + # 发起请求 + response: UploadAttachmentResponse = client.task.v2.attachment.upload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.upload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - file = open("file_path", "rb") - request: UploadAttachmentRequest = UploadAttachmentRequest.builder() \ - .user_id_type("open_id") \ - .request_body(InputAttachment.builder() - .resource_type("task") - .resource_id("fe96108d-b004-4a47-b2f8-6886e758b3a5") - .file(file) - .build()) \ - .build() + # 构造请求对象 + file = open("file_path", "rb") + request: UploadAttachmentRequest = UploadAttachmentRequest.builder() \ + .user_id_type("open_id") \ + .request_body(InputAttachment.builder() + .resource_type("task") + .resource_id("fe96108d-b004-4a47-b2f8-6886e758b3a5") + .file(file) + .build()) \ + .build() - # 发起请求 - response: UploadAttachmentResponse = await client.task.v2.attachment.aupload(request) + # 发起请求 + response: UploadAttachmentResponse = await client.task.v2.attachment.aupload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.task.v2.attachment.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.task.v2.attachment.aupload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/tenant/v2/query_tenant_product_assign_info_sample.py b/samples/api/tenant/v2/query_tenant_product_assign_info_sample.py index c06412515..7a7fc378d 100644 --- a/samples/api/tenant/v2/query_tenant_product_assign_info_sample.py +++ b/samples/api/tenant/v2/query_tenant_product_assign_info_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTenantProductAssignInfoRequest = QueryTenantProductAssignInfoRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTenantProductAssignInfoRequest = QueryTenantProductAssignInfoRequest.builder() \ + .build() - # 发起请求 - response: QueryTenantProductAssignInfoResponse = client.tenant.v2.tenant_product_assign_info.query(request) + # 发起请求 + response: QueryTenantProductAssignInfoResponse = client.tenant.v2.tenant_product_assign_info.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.tenant.v2.tenant_product_assign_info.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.tenant.v2.tenant_product_assign_info.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTenantProductAssignInfoRequest = QueryTenantProductAssignInfoRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTenantProductAssignInfoRequest = QueryTenantProductAssignInfoRequest.builder() \ + .build() - # 发起请求 - response: QueryTenantProductAssignInfoResponse = await client.tenant.v2.tenant_product_assign_info.aquery(request) + # 发起请求 + response: QueryTenantProductAssignInfoResponse = await client.tenant.v2.tenant_product_assign_info.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.tenant.v2.tenant_product_assign_info.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.tenant.v2.tenant_product_assign_info.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/tenant/v2/query_tenant_sample.py b/samples/api/tenant/v2/query_tenant_sample.py index a18e2ac55..ef37c4550 100644 --- a/samples/api/tenant/v2/query_tenant_sample.py +++ b/samples/api/tenant/v2/query_tenant_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTenantRequest = QueryTenantRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTenantRequest = QueryTenantRequest.builder() \ + .build() - # 发起请求 - response: QueryTenantResponse = client.tenant.v2.tenant.query(request) + # 发起请求 + response: QueryTenantResponse = client.tenant.v2.tenant.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.tenant.v2.tenant.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.tenant.v2.tenant.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryTenantRequest = QueryTenantRequest.builder() \ - .build() + # 构造请求对象 + request: QueryTenantRequest = QueryTenantRequest.builder() \ + .build() - # 发起请求 - response: QueryTenantResponse = await client.tenant.v2.tenant.aquery(request) + # 发起请求 + response: QueryTenantResponse = await client.tenant.v2.tenant.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.tenant.v2.tenant.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.tenant.v2.tenant.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/translation/v1/detect_text_sample.py b/samples/api/translation/v1/detect_text_sample.py index 296377922..4dc0b9b86 100644 --- a/samples/api/translation/v1/detect_text_sample.py +++ b/samples/api/translation/v1/detect_text_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DetectTextRequest = DetectTextRequest.builder() \ - .request_body(DetectTextRequestBody.builder() - .text("你好") - .build()) \ - .build() + # 构造请求对象 + request: DetectTextRequest = DetectTextRequest.builder() \ + .request_body(DetectTextRequestBody.builder() + .text("你好") + .build()) \ + .build() - # 发起请求 - response: DetectTextResponse = client.translation.v1.text.detect(request) + # 发起请求 + response: DetectTextResponse = client.translation.v1.text.detect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.translation.v1.text.detect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.translation.v1.text.detect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DetectTextRequest = DetectTextRequest.builder() \ - .request_body(DetectTextRequestBody.builder() - .text("你好") - .build()) \ - .build() + # 构造请求对象 + request: DetectTextRequest = DetectTextRequest.builder() \ + .request_body(DetectTextRequestBody.builder() + .text("你好") + .build()) \ + .build() - # 发起请求 - response: DetectTextResponse = await client.translation.v1.text.adetect(request) + # 发起请求 + response: DetectTextResponse = await client.translation.v1.text.adetect(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.translation.v1.text.adetect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.translation.v1.text.adetect failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/translation/v1/translate_text_sample.py b/samples/api/translation/v1/translate_text_sample.py index 89fbd755e..453b05abd 100644 --- a/samples/api/translation/v1/translate_text_sample.py +++ b/samples/api/translation/v1/translate_text_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TranslateTextRequest = TranslateTextRequest.builder() \ - .request_body(TranslateTextRequestBody.builder() - .source_language("zh") - .text("尝试使用一下飞书吧") - .target_language("en") - .glossary([]) - .build()) \ - .build() + # 构造请求对象 + request: TranslateTextRequest = TranslateTextRequest.builder() \ + .request_body(TranslateTextRequestBody.builder() + .source_language("zh") + .text("尝试使用一下飞书吧") + .target_language("en") + .glossary([]) + .build()) \ + .build() - # 发起请求 - response: TranslateTextResponse = client.translation.v1.text.translate(request) + # 发起请求 + response: TranslateTextResponse = client.translation.v1.text.translate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.translation.v1.text.translate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.translation.v1.text.translate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: TranslateTextRequest = TranslateTextRequest.builder() \ - .request_body(TranslateTextRequestBody.builder() - .source_language("zh") - .text("尝试使用一下飞书吧") - .target_language("en") - .glossary([]) - .build()) \ - .build() + # 构造请求对象 + request: TranslateTextRequest = TranslateTextRequest.builder() \ + .request_body(TranslateTextRequestBody.builder() + .source_language("zh") + .text("尝试使用一下飞书吧") + .target_language("en") + .glossary([]) + .build()) \ + .build() - # 发起请求 - response: TranslateTextResponse = await client.translation.v1.text.atranslate(request) + # 发起请求 + response: TranslateTextResponse = await client.translation.v1.text.atranslate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.translation.v1.text.atranslate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.translation.v1.text.atranslate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/apply_reserve_sample.py b/samples/api/vc/v1/apply_reserve_sample.py index 55f47be60..5d89d4540 100644 --- a/samples/api/vc/v1/apply_reserve_sample.py +++ b/samples/api/vc/v1/apply_reserve_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ApplyReserveRequest = ApplyReserveRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ApplyReserveRequestBody.builder() - .end_time("1608888867") - .owner_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .meeting_settings(ReserveMeetingSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: ApplyReserveRequest = ApplyReserveRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ApplyReserveRequestBody.builder() + .end_time("1608888867") + .owner_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .meeting_settings(ReserveMeetingSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: ApplyReserveResponse = client.vc.v1.reserve.apply(request) + # 发起请求 + response: ApplyReserveResponse = client.vc.v1.reserve.apply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.apply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.apply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ApplyReserveRequest = ApplyReserveRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ApplyReserveRequestBody.builder() - .end_time("1608888867") - .owner_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .meeting_settings(ReserveMeetingSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: ApplyReserveRequest = ApplyReserveRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ApplyReserveRequestBody.builder() + .end_time("1608888867") + .owner_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .meeting_settings(ReserveMeetingSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: ApplyReserveResponse = await client.vc.v1.reserve.aapply(request) + # 发起请求 + response: ApplyReserveResponse = await client.vc.v1.reserve.aapply(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.aapply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.aapply failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/create_room_level_sample.py b/samples/api/vc/v1/create_room_level_sample.py index c7b539ad5..9e5efcc90 100644 --- a/samples/api/vc/v1/create_room_level_sample.py +++ b/samples/api/vc/v1/create_room_level_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRoomLevelRequest = CreateRoomLevelRequest.builder() \ - .request_body(RoomLevel.builder() - .name("测试层级2") - .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") - .custom_group_id("zidingyi") - .build()) \ - .build() + # 构造请求对象 + request: CreateRoomLevelRequest = CreateRoomLevelRequest.builder() \ + .request_body(RoomLevel.builder() + .name("测试层级2") + .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") + .custom_group_id("zidingyi") + .build()) \ + .build() - # 发起请求 - response: CreateRoomLevelResponse = client.vc.v1.room_level.create(request) + # 发起请求 + response: CreateRoomLevelResponse = client.vc.v1.room_level.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRoomLevelRequest = CreateRoomLevelRequest.builder() \ - .request_body(RoomLevel.builder() - .name("测试层级2") - .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") - .custom_group_id("zidingyi") - .build()) \ - .build() + # 构造请求对象 + request: CreateRoomLevelRequest = CreateRoomLevelRequest.builder() \ + .request_body(RoomLevel.builder() + .name("测试层级2") + .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") + .custom_group_id("zidingyi") + .build()) \ + .build() - # 发起请求 - response: CreateRoomLevelResponse = await client.vc.v1.room_level.acreate(request) + # 发起请求 + response: CreateRoomLevelResponse = await client.vc.v1.room_level.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/create_room_sample.py b/samples/api/vc/v1/create_room_sample.py index 9b10c6bf1..16956eef6 100644 --- a/samples/api/vc/v1/create_room_sample.py +++ b/samples/api/vc/v1/create_room_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRoomRequest = CreateRoomRequest.builder() \ - .user_id_type("open_id") \ - .request_body(Room.builder() - .name("测试会议室") - .capacity(10) - .description("测试会议室描述") - .custom_room_id("1234") - .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") - .room_status(RoomStatus.builder().build()) - .device([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateRoomRequest = CreateRoomRequest.builder() \ + .user_id_type("open_id") \ + .request_body(Room.builder() + .name("测试会议室") + .capacity(10) + .description("测试会议室描述") + .custom_room_id("1234") + .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") + .room_status(RoomStatus.builder().build()) + .device([]) + .build()) \ + .build() - # 发起请求 - response: CreateRoomResponse = client.vc.v1.room.create(request) + # 发起请求 + response: CreateRoomResponse = client.vc.v1.room.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateRoomRequest = CreateRoomRequest.builder() \ - .user_id_type("open_id") \ - .request_body(Room.builder() - .name("测试会议室") - .capacity(10) - .description("测试会议室描述") - .custom_room_id("1234") - .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") - .room_status(RoomStatus.builder().build()) - .device([]) - .build()) \ - .build() + # 构造请求对象 + request: CreateRoomRequest = CreateRoomRequest.builder() \ + .user_id_type("open_id") \ + .request_body(Room.builder() + .name("测试会议室") + .capacity(10) + .description("测试会议室描述") + .custom_room_id("1234") + .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") + .room_status(RoomStatus.builder().build()) + .device([]) + .build()) \ + .build() - # 发起请求 - response: CreateRoomResponse = await client.vc.v1.room.acreate(request) + # 发起请求 + response: CreateRoomResponse = await client.vc.v1.room.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/create_scope_config_sample.py b/samples/api/vc/v1/create_scope_config_sample.py index 776727a51..b16c16ccb 100644 --- a/samples/api/vc/v1/create_scope_config_sample.py +++ b/samples/api/vc/v1/create_scope_config_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateScopeConfigRequest = CreateScopeConfigRequest.builder() \ - .user_id_type("open_id") \ - .request_body(ScopeConfig.builder() - .scope_type(1) - .scope_id("omm_608d34d82d531b27fa993902d350a307") - .scope_config(RoomConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateScopeConfigRequest = CreateScopeConfigRequest.builder() \ + .user_id_type("open_id") \ + .request_body(ScopeConfig.builder() + .scope_type(1) + .scope_id("omm_608d34d82d531b27fa993902d350a307") + .scope_config(RoomConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateScopeConfigResponse = client.vc.v1.scope_config.create(request) + # 发起请求 + response: CreateScopeConfigResponse = client.vc.v1.scope_config.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.scope_config.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.scope_config.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateScopeConfigRequest = CreateScopeConfigRequest.builder() \ - .user_id_type("open_id") \ - .request_body(ScopeConfig.builder() - .scope_type(1) - .scope_id("omm_608d34d82d531b27fa993902d350a307") - .scope_config(RoomConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: CreateScopeConfigRequest = CreateScopeConfigRequest.builder() \ + .user_id_type("open_id") \ + .request_body(ScopeConfig.builder() + .scope_type(1) + .scope_id("omm_608d34d82d531b27fa993902d350a307") + .scope_config(RoomConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: CreateScopeConfigResponse = await client.vc.v1.scope_config.acreate(request) + # 发起请求 + response: CreateScopeConfigResponse = await client.vc.v1.scope_config.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.scope_config.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.scope_config.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/del__room_level_sample.py b/samples/api/vc/v1/del__room_level_sample.py index eeda52a4e..8caded410 100644 --- a/samples/api/vc/v1/del__room_level_sample.py +++ b/samples/api/vc/v1/del__room_level_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DelRoomLevelRequest = DelRoomLevelRequest.builder() \ - .request_body(DelRoomLevelRequestBody.builder() - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") - .delete_child(False) - .build()) \ - .build() + # 构造请求对象 + request: DelRoomLevelRequest = DelRoomLevelRequest.builder() \ + .request_body(DelRoomLevelRequestBody.builder() + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") + .delete_child(False) + .build()) \ + .build() - # 发起请求 - response: DelRoomLevelResponse = client.vc.v1.room_level.del_(request) + # 发起请求 + response: DelRoomLevelResponse = client.vc.v1.room_level.del_(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.del_ failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.del_ failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DelRoomLevelRequest = DelRoomLevelRequest.builder() \ - .request_body(DelRoomLevelRequestBody.builder() - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") - .delete_child(False) - .build()) \ - .build() + # 构造请求对象 + request: DelRoomLevelRequest = DelRoomLevelRequest.builder() \ + .request_body(DelRoomLevelRequestBody.builder() + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") + .delete_child(False) + .build()) \ + .build() - # 发起请求 - response: DelRoomLevelResponse = await client.vc.v1.room_level.adel_(request) + # 发起请求 + response: DelRoomLevelResponse = await client.vc.v1.room_level.adel_(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.adel_ failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.adel_ failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/delete_reserve_sample.py b/samples/api/vc/v1/delete_reserve_sample.py index 1325c16e5..1fb0ff347 100644 --- a/samples/api/vc/v1/delete_reserve_sample.py +++ b/samples/api/vc/v1/delete_reserve_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteReserveRequest = DeleteReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: DeleteReserveRequest = DeleteReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .build() - # 发起请求 - response: DeleteReserveResponse = client.vc.v1.reserve.delete(request) + # 发起请求 + response: DeleteReserveResponse = client.vc.v1.reserve.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteReserveRequest = DeleteReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: DeleteReserveRequest = DeleteReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .build() - # 发起请求 - response: DeleteReserveResponse = await client.vc.v1.reserve.adelete(request) + # 发起请求 + response: DeleteReserveResponse = await client.vc.v1.reserve.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/delete_room_sample.py b/samples/api/vc/v1/delete_room_sample.py index ef18edaf2..1f381662c 100644 --- a/samples/api/vc/v1/delete_room_sample.py +++ b/samples/api/vc/v1/delete_room_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteRoomRequest = DeleteRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ - .build() + # 构造请求对象 + request: DeleteRoomRequest = DeleteRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ + .build() - # 发起请求 - response: DeleteRoomResponse = client.vc.v1.room.delete(request) + # 发起请求 + response: DeleteRoomResponse = client.vc.v1.room.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteRoomRequest = DeleteRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ - .build() + # 构造请求对象 + request: DeleteRoomRequest = DeleteRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ + .build() - # 发起请求 - response: DeleteRoomResponse = await client.vc.v1.room.adelete(request) + # 发起请求 + response: DeleteRoomResponse = await client.vc.v1.room.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/download_export_sample.py b/samples/api/vc/v1/download_export_sample.py index fef511796..a03fa334c 100644 --- a/samples/api/vc/v1/download_export_sample.py +++ b/samples/api/vc/v1/download_export_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadExportRequest = DownloadExportRequest.builder() \ - .file_token("6yHu7Igp7Igy62Ez6fLr6IJz7j9i5WMe6fHq5yZeY2Jz6yLqYAMAY46fZfEz64Lr5fYyYQ==") \ - .build() + # 构造请求对象 + request: DownloadExportRequest = DownloadExportRequest.builder() \ + .file_token("6yHu7Igp7Igy62Ez6fLr6IJz7j9i5WMe6fHq5yZeY2Jz6yLqYAMAY46fZfEz64Lr5fYyYQ==") \ + .build() - # 发起请求 - response: DownloadExportResponse = client.vc.v1.export.download(request) + # 发起请求 + response: DownloadExportResponse = client.vc.v1.export.download(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.download failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DownloadExportRequest = DownloadExportRequest.builder() \ - .file_token("6yHu7Igp7Igy62Ez6fLr6IJz7j9i5WMe6fHq5yZeY2Jz6yLqYAMAY46fZfEz64Lr5fYyYQ==") \ - .build() + # 构造请求对象 + request: DownloadExportRequest = DownloadExportRequest.builder() \ + .file_token("6yHu7Igp7Igy62Ez6fLr6IJz7j9i5WMe6fHq5yZeY2Jz6yLqYAMAY46fZfEz64Lr5fYyYQ==") \ + .build() - # 发起请求 - response: DownloadExportResponse = await client.vc.v1.export.adownload(request) + # 发起请求 + response: DownloadExportResponse = await client.vc.v1.export.adownload(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.adownload failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - f = open(f"/file_path/{response.file_name}", "wb") - f.write(response.file.read()) - f.close() + # 处理业务结果 + f = open(f"/file_path/{response.file_name}", "wb") + f.write(response.file.read()) + f.close() if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/end_meeting_sample.py b/samples/api/vc/v1/end_meeting_sample.py index 51b7923a6..31280a870 100644 --- a/samples/api/vc/v1/end_meeting_sample.py +++ b/samples/api/vc/v1/end_meeting_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EndMeetingRequest = EndMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: EndMeetingRequest = EndMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: EndMeetingResponse = client.vc.v1.meeting.end(request) + # 发起请求 + response: EndMeetingResponse = client.vc.v1.meeting.end(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.end failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.end failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: EndMeetingRequest = EndMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: EndMeetingRequest = EndMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: EndMeetingResponse = await client.vc.v1.meeting.aend(request) + # 发起请求 + response: EndMeetingResponse = await client.vc.v1.meeting.aend(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.aend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.aend failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_active_meeting_reserve_sample.py b/samples/api/vc/v1/get_active_meeting_reserve_sample.py index d4e2501ef..6a7bdc9d2 100644 --- a/samples/api/vc/v1/get_active_meeting_reserve_sample.py +++ b/samples/api/vc/v1/get_active_meeting_reserve_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetActiveMeetingReserveRequest = GetActiveMeetingReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .with_participants(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetActiveMeetingReserveRequest = GetActiveMeetingReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .with_participants(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetActiveMeetingReserveResponse = client.vc.v1.reserve.get_active_meeting(request) + # 发起请求 + response: GetActiveMeetingReserveResponse = client.vc.v1.reserve.get_active_meeting(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.get_active_meeting failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.get_active_meeting failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetActiveMeetingReserveRequest = GetActiveMeetingReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .with_participants(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetActiveMeetingReserveRequest = GetActiveMeetingReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .with_participants(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetActiveMeetingReserveResponse = await client.vc.v1.reserve.aget_active_meeting(request) + # 发起请求 + response: GetActiveMeetingReserveResponse = await client.vc.v1.reserve.aget_active_meeting(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.aget_active_meeting failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.aget_active_meeting failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_daily_report_sample.py b/samples/api/vc/v1/get_daily_report_sample.py index a5be43aa4..dd354b853 100644 --- a/samples/api/vc/v1/get_daily_report_sample.py +++ b/samples/api/vc/v1/get_daily_report_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDailyReportRequest = GetDailyReportRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608888966") \ - .unit(0) \ - .build() + # 构造请求对象 + request: GetDailyReportRequest = GetDailyReportRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608888966") \ + .unit(0) \ + .build() - # 发起请求 - response: GetDailyReportResponse = client.vc.v1.report.get_daily(request) + # 发起请求 + response: GetDailyReportResponse = client.vc.v1.report.get_daily(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.report.get_daily failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.report.get_daily failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetDailyReportRequest = GetDailyReportRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608888966") \ - .unit(0) \ - .build() + # 构造请求对象 + request: GetDailyReportRequest = GetDailyReportRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608888966") \ + .unit(0) \ + .build() - # 发起请求 - response: GetDailyReportResponse = await client.vc.v1.report.aget_daily(request) + # 发起请求 + response: GetDailyReportResponse = await client.vc.v1.report.aget_daily(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.report.aget_daily failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.report.aget_daily failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_export_sample.py b/samples/api/vc/v1/get_export_sample.py index b159e88f6..f5216e936 100644 --- a/samples/api/vc/v1/get_export_sample.py +++ b/samples/api/vc/v1/get_export_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExportRequest = GetExportRequest.builder() \ - .task_id("7108646852144136212") \ - .build() + # 构造请求对象 + request: GetExportRequest = GetExportRequest.builder() \ + .task_id("7108646852144136212") \ + .build() - # 发起请求 - response: GetExportResponse = client.vc.v1.export.get(request) + # 发起请求 + response: GetExportResponse = client.vc.v1.export.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetExportRequest = GetExportRequest.builder() \ - .task_id("7108646852144136212") \ - .build() + # 构造请求对象 + request: GetExportRequest = GetExportRequest.builder() \ + .task_id("7108646852144136212") \ + .build() - # 发起请求 - response: GetExportResponse = await client.vc.v1.export.aget(request) + # 发起请求 + response: GetExportResponse = await client.vc.v1.export.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_meeting_list_sample.py b/samples/api/vc/v1/get_meeting_list_sample.py index 4fa20de66..dd1986e59 100644 --- a/samples/api/vc/v1/get_meeting_list_sample.py +++ b/samples/api/vc/v1/get_meeting_list_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingListRequest = GetMeetingListRequest.builder() \ - .start_time("1655276858") \ - .end_time("1655276858") \ - .meeting_status(2) \ - .meeting_no("123456789") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .meeting_type(2) \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetMeetingListRequest = GetMeetingListRequest.builder() \ + .start_time("1655276858") \ + .end_time("1655276858") \ + .meeting_status(2) \ + .meeting_no("123456789") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .meeting_type(2) \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetMeetingListResponse = client.vc.v1.meeting_list.get(request) + # 发起请求 + response: GetMeetingListResponse = client.vc.v1.meeting_list.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingListRequest = GetMeetingListRequest.builder() \ - .start_time("1655276858") \ - .end_time("1655276858") \ - .meeting_status(2) \ - .meeting_no("123456789") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .meeting_type(2) \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetMeetingListRequest = GetMeetingListRequest.builder() \ + .start_time("1655276858") \ + .end_time("1655276858") \ + .meeting_status(2) \ + .meeting_no("123456789") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .meeting_type(2) \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetMeetingListResponse = await client.vc.v1.meeting_list.aget(request) + # 发起请求 + response: GetMeetingListResponse = await client.vc.v1.meeting_list.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_meeting_recording_sample.py b/samples/api/vc/v1/get_meeting_recording_sample.py index 388d39204..c0d2d298c 100644 --- a/samples/api/vc/v1/get_meeting_recording_sample.py +++ b/samples/api/vc/v1/get_meeting_recording_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingRecordingRequest = GetMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: GetMeetingRecordingRequest = GetMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: GetMeetingRecordingResponse = client.vc.v1.meeting_recording.get(request) + # 发起请求 + response: GetMeetingRecordingResponse = client.vc.v1.meeting_recording.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingRecordingRequest = GetMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: GetMeetingRecordingRequest = GetMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: GetMeetingRecordingResponse = await client.vc.v1.meeting_recording.aget(request) + # 发起请求 + response: GetMeetingRecordingResponse = await client.vc.v1.meeting_recording.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_meeting_sample.py b/samples/api/vc/v1/get_meeting_sample.py index 55f81e229..82a4043b9 100644 --- a/samples/api/vc/v1/get_meeting_sample.py +++ b/samples/api/vc/v1/get_meeting_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingRequest = GetMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .with_participants(False) \ - .with_meeting_ability(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetMeetingRequest = GetMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .with_participants(False) \ + .with_meeting_ability(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetMeetingResponse = client.vc.v1.meeting.get(request) + # 发起请求 + response: GetMeetingResponse = client.vc.v1.meeting.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetMeetingRequest = GetMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .with_participants(False) \ - .with_meeting_ability(False) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetMeetingRequest = GetMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .with_participants(False) \ + .with_meeting_ability(False) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetMeetingResponse = await client.vc.v1.meeting.aget(request) + # 发起请求 + response: GetMeetingResponse = await client.vc.v1.meeting.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_participant_list_sample.py b/samples/api/vc/v1/get_participant_list_sample.py index e3c535664..e94b5ea66 100644 --- a/samples/api/vc/v1/get_participant_list_sample.py +++ b/samples/api/vc/v1/get_participant_list_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetParticipantListRequest = GetParticipantListRequest.builder() \ - .meeting_start_time("1655276858") \ - .meeting_end_time("1655276858") \ - .meeting_status(2) \ - .meeting_no("123456789") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetParticipantListRequest = GetParticipantListRequest.builder() \ + .meeting_start_time("1655276858") \ + .meeting_end_time("1655276858") \ + .meeting_status(2) \ + .meeting_no("123456789") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetParticipantListResponse = client.vc.v1.participant_list.get(request) + # 发起请求 + response: GetParticipantListResponse = client.vc.v1.participant_list.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.participant_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.participant_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetParticipantListRequest = GetParticipantListRequest.builder() \ - .meeting_start_time("1655276858") \ - .meeting_end_time("1655276858") \ - .meeting_status(2) \ - .meeting_no("123456789") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetParticipantListRequest = GetParticipantListRequest.builder() \ + .meeting_start_time("1655276858") \ + .meeting_end_time("1655276858") \ + .meeting_status(2) \ + .meeting_no("123456789") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetParticipantListResponse = await client.vc.v1.participant_list.aget(request) + # 发起请求 + response: GetParticipantListResponse = await client.vc.v1.participant_list.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.participant_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.participant_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_participant_quality_list_sample.py b/samples/api/vc/v1/get_participant_quality_list_sample.py index e80dbc603..62d987398 100644 --- a/samples/api/vc/v1/get_participant_quality_list_sample.py +++ b/samples/api/vc/v1/get_participant_quality_list_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetParticipantQualityListRequest = GetParticipantQualityListRequest.builder() \ - .meeting_start_time("1655276858") \ - .meeting_end_time("1655276858") \ - .meeting_no("123456789") \ - .join_time("1655276858") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetParticipantQualityListRequest = GetParticipantQualityListRequest.builder() \ + .meeting_start_time("1655276858") \ + .meeting_end_time("1655276858") \ + .meeting_no("123456789") \ + .join_time("1655276858") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetParticipantQualityListResponse = client.vc.v1.participant_quality_list.get(request) + # 发起请求 + response: GetParticipantQualityListResponse = client.vc.v1.participant_quality_list.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.participant_quality_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.participant_quality_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetParticipantQualityListRequest = GetParticipantQualityListRequest.builder() \ - .meeting_start_time("1655276858") \ - .meeting_end_time("1655276858") \ - .meeting_no("123456789") \ - .join_time("1655276858") \ - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ - .room_id("omm_eada1d61a550955240c28757e7dec3af") \ - .page_size(20) \ - .page_token("str") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetParticipantQualityListRequest = GetParticipantQualityListRequest.builder() \ + .meeting_start_time("1655276858") \ + .meeting_end_time("1655276858") \ + .meeting_no("123456789") \ + .join_time("1655276858") \ + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") \ + .room_id("omm_eada1d61a550955240c28757e7dec3af") \ + .page_size(20) \ + .page_token("str") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetParticipantQualityListResponse = await client.vc.v1.participant_quality_list.aget(request) + # 发起请求 + response: GetParticipantQualityListResponse = await client.vc.v1.participant_quality_list.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.participant_quality_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.participant_quality_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_reserve_config_admin_sample.py b/samples/api/vc/v1/get_reserve_config_admin_sample.py index db31598cf..9778cccb5 100644 --- a/samples/api/vc/v1/get_reserve_config_admin_sample.py +++ b/samples/api/vc/v1/get_reserve_config_admin_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigAdminRequest = GetReserveConfigAdminRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigAdminRequest = GetReserveConfigAdminRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigAdminResponse = client.vc.v1.reserve_config_admin.get(request) + # 发起请求 + response: GetReserveConfigAdminResponse = client.vc.v1.reserve_config_admin.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_admin.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_admin.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigAdminRequest = GetReserveConfigAdminRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigAdminRequest = GetReserveConfigAdminRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigAdminResponse = await client.vc.v1.reserve_config_admin.aget(request) + # 发起请求 + response: GetReserveConfigAdminResponse = await client.vc.v1.reserve_config_admin.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_admin.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_admin.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_reserve_config_disable_inform_sample.py b/samples/api/vc/v1/get_reserve_config_disable_inform_sample.py index 159465356..1d5fbea81 100644 --- a/samples/api/vc/v1/get_reserve_config_disable_inform_sample.py +++ b/samples/api/vc/v1/get_reserve_config_disable_inform_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigDisableInformRequest = GetReserveConfigDisableInformRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigDisableInformRequest = GetReserveConfigDisableInformRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigDisableInformResponse = client.vc.v1.reserve_config_disable_inform.get(request) + # 发起请求 + response: GetReserveConfigDisableInformResponse = client.vc.v1.reserve_config_disable_inform.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_disable_inform.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_disable_inform.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigDisableInformRequest = GetReserveConfigDisableInformRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigDisableInformRequest = GetReserveConfigDisableInformRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigDisableInformResponse = await client.vc.v1.reserve_config_disable_inform.aget(request) + # 发起请求 + response: GetReserveConfigDisableInformResponse = await client.vc.v1.reserve_config_disable_inform.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_disable_inform.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_disable_inform.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_reserve_config_form_sample.py b/samples/api/vc/v1/get_reserve_config_form_sample.py index 7a351785e..41641b94a 100644 --- a/samples/api/vc/v1/get_reserve_config_form_sample.py +++ b/samples/api/vc/v1/get_reserve_config_form_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigFormRequest = GetReserveConfigFormRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigFormRequest = GetReserveConfigFormRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigFormResponse = client.vc.v1.reserve_config_form.get(request) + # 发起请求 + response: GetReserveConfigFormResponse = client.vc.v1.reserve_config_form.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_form.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveConfigFormRequest = GetReserveConfigFormRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type(2) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveConfigFormRequest = GetReserveConfigFormRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type(2) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveConfigFormResponse = await client.vc.v1.reserve_config_form.aget(request) + # 发起请求 + response: GetReserveConfigFormResponse = await client.vc.v1.reserve_config_form.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_form.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_reserve_sample.py b/samples/api/vc/v1/get_reserve_sample.py index 498116b63..6f10252bd 100644 --- a/samples/api/vc/v1/get_reserve_sample.py +++ b/samples/api/vc/v1/get_reserve_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveRequest = GetReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveRequest = GetReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveResponse = client.vc.v1.reserve.get(request) + # 发起请求 + response: GetReserveResponse = client.vc.v1.reserve.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetReserveRequest = GetReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetReserveRequest = GetReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetReserveResponse = await client.vc.v1.reserve.aget(request) + # 发起请求 + response: GetReserveResponse = await client.vc.v1.reserve.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_resource_reservation_list_sample.py b/samples/api/vc/v1/get_resource_reservation_list_sample.py index c069f2992..409c73e46 100644 --- a/samples/api/vc/v1/get_resource_reservation_list_sample.py +++ b/samples/api/vc/v1/get_resource_reservation_list_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetResourceReservationListRequest = GetResourceReservationListRequest.builder() \ - .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ - .need_topic(True) \ - .start_time("1655276858") \ - .end_time("1655276858") \ - .room_ids([]) \ - .is_exclude(False) \ - .page_size(20) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: GetResourceReservationListRequest = GetResourceReservationListRequest.builder() \ + .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ + .need_topic(True) \ + .start_time("1655276858") \ + .end_time("1655276858") \ + .room_ids([]) \ + .is_exclude(False) \ + .page_size(20) \ + .page_token("str") \ + .build() - # 发起请求 - response: GetResourceReservationListResponse = client.vc.v1.resource_reservation_list.get(request) + # 发起请求 + response: GetResourceReservationListResponse = client.vc.v1.resource_reservation_list.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.resource_reservation_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.resource_reservation_list.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetResourceReservationListRequest = GetResourceReservationListRequest.builder() \ - .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ - .need_topic(True) \ - .start_time("1655276858") \ - .end_time("1655276858") \ - .room_ids([]) \ - .is_exclude(False) \ - .page_size(20) \ - .page_token("str") \ - .build() + # 构造请求对象 + request: GetResourceReservationListRequest = GetResourceReservationListRequest.builder() \ + .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ + .need_topic(True) \ + .start_time("1655276858") \ + .end_time("1655276858") \ + .room_ids([]) \ + .is_exclude(False) \ + .page_size(20) \ + .page_token("str") \ + .build() - # 发起请求 - response: GetResourceReservationListResponse = await client.vc.v1.resource_reservation_list.aget(request) + # 发起请求 + response: GetResourceReservationListResponse = await client.vc.v1.resource_reservation_list.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.resource_reservation_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.resource_reservation_list.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_room_level_sample.py b/samples/api/vc/v1/get_room_level_sample.py index a21f9dcfa..4e941a0d1 100644 --- a/samples/api/vc/v1/get_room_level_sample.py +++ b/samples/api/vc/v1/get_room_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoomLevelRequest = GetRoomLevelRequest.builder() \ - .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ - .build() + # 构造请求对象 + request: GetRoomLevelRequest = GetRoomLevelRequest.builder() \ + .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ + .build() - # 发起请求 - response: GetRoomLevelResponse = client.vc.v1.room_level.get(request) + # 发起请求 + response: GetRoomLevelResponse = client.vc.v1.room_level.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoomLevelRequest = GetRoomLevelRequest.builder() \ - .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ - .build() + # 构造请求对象 + request: GetRoomLevelRequest = GetRoomLevelRequest.builder() \ + .room_level_id("omb_57c9cc7d9a81e27e54c8fabfd02759e7") \ + .build() - # 发起请求 - response: GetRoomLevelResponse = await client.vc.v1.room_level.aget(request) + # 发起请求 + response: GetRoomLevelResponse = await client.vc.v1.room_level.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_room_sample.py b/samples/api/vc/v1/get_room_sample.py index 9de36c93b..f8091ccb2 100644 --- a/samples/api/vc/v1/get_room_sample.py +++ b/samples/api/vc/v1/get_room_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoomRequest = GetRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9c") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetRoomRequest = GetRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9c") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetRoomResponse = client.vc.v1.room.get(request) + # 发起请求 + response: GetRoomResponse = client.vc.v1.room.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetRoomRequest = GetRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9c") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetRoomRequest = GetRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9c") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetRoomResponse = await client.vc.v1.room.aget(request) + # 发起请求 + response: GetRoomResponse = await client.vc.v1.room.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_scope_config_sample.py b/samples/api/vc/v1/get_scope_config_sample.py index 34436e1d6..929f02714 100644 --- a/samples/api/vc/v1/get_scope_config_sample.py +++ b/samples/api/vc/v1/get_scope_config_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetScopeConfigRequest = GetScopeConfigRequest.builder() \ - .scope_type(1) \ - .scope_id("omm_608d34d82d531b27fa993902d350a307") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetScopeConfigRequest = GetScopeConfigRequest.builder() \ + .scope_type(1) \ + .scope_id("omm_608d34d82d531b27fa993902d350a307") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetScopeConfigResponse = client.vc.v1.scope_config.get(request) + # 发起请求 + response: GetScopeConfigResponse = client.vc.v1.scope_config.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.scope_config.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.scope_config.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetScopeConfigRequest = GetScopeConfigRequest.builder() \ - .scope_type(1) \ - .scope_id("omm_608d34d82d531b27fa993902d350a307") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetScopeConfigRequest = GetScopeConfigRequest.builder() \ + .scope_type(1) \ + .scope_id("omm_608d34d82d531b27fa993902d350a307") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetScopeConfigResponse = await client.vc.v1.scope_config.aget(request) + # 发起请求 + response: GetScopeConfigResponse = await client.vc.v1.scope_config.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.scope_config.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.scope_config.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/get_top_user_report_sample.py b/samples/api/vc/v1/get_top_user_report_sample.py index 4757106b8..8317c5110 100644 --- a/samples/api/vc/v1/get_top_user_report_sample.py +++ b/samples/api/vc/v1/get_top_user_report_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTopUserReportRequest = GetTopUserReportRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608889966") \ - .limit(10) \ - .order_by(1) \ - .unit(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTopUserReportRequest = GetTopUserReportRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608889966") \ + .limit(10) \ + .order_by(1) \ + .unit(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTopUserReportResponse = client.vc.v1.report.get_top_user(request) + # 发起请求 + response: GetTopUserReportResponse = client.vc.v1.report.get_top_user(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.report.get_top_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.report.get_top_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTopUserReportRequest = GetTopUserReportRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608889966") \ - .limit(10) \ - .order_by(1) \ - .unit(0) \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: GetTopUserReportRequest = GetTopUserReportRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608889966") \ + .limit(10) \ + .order_by(1) \ + .unit(0) \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: GetTopUserReportResponse = await client.vc.v1.report.aget_top_user(request) + # 发起请求 + response: GetTopUserReportResponse = await client.vc.v1.report.aget_top_user(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.report.aget_top_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.report.aget_top_user failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/invite_meeting_sample.py b/samples/api/vc/v1/invite_meeting_sample.py index 4f07f2836..1dd07d80a 100644 --- a/samples/api/vc/v1/invite_meeting_sample.py +++ b/samples/api/vc/v1/invite_meeting_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InviteMeetingRequest = InviteMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(InviteMeetingRequestBody.builder() - .invitees([]) - .build()) \ - .build() + # 构造请求对象 + request: InviteMeetingRequest = InviteMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(InviteMeetingRequestBody.builder() + .invitees([]) + .build()) \ + .build() - # 发起请求 - response: InviteMeetingResponse = client.vc.v1.meeting.invite(request) + # 发起请求 + response: InviteMeetingResponse = client.vc.v1.meeting.invite(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.invite failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.invite failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: InviteMeetingRequest = InviteMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(InviteMeetingRequestBody.builder() - .invitees([]) - .build()) \ - .build() + # 构造请求对象 + request: InviteMeetingRequest = InviteMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(InviteMeetingRequestBody.builder() + .invitees([]) + .build()) \ + .build() - # 发起请求 - response: InviteMeetingResponse = await client.vc.v1.meeting.ainvite(request) + # 发起请求 + response: InviteMeetingResponse = await client.vc.v1.meeting.ainvite(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.ainvite failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.ainvite failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/kickout_meeting_sample.py b/samples/api/vc/v1/kickout_meeting_sample.py index 1a6469df4..29ddaa3f0 100644 --- a/samples/api/vc/v1/kickout_meeting_sample.py +++ b/samples/api/vc/v1/kickout_meeting_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: KickoutMeetingRequest = KickoutMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(KickoutMeetingRequestBody.builder() - .kickout_users([]) - .build()) \ - .build() + # 构造请求对象 + request: KickoutMeetingRequest = KickoutMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(KickoutMeetingRequestBody.builder() + .kickout_users([]) + .build()) \ + .build() - # 发起请求 - response: KickoutMeetingResponse = client.vc.v1.meeting.kickout(request) + # 发起请求 + response: KickoutMeetingResponse = client.vc.v1.meeting.kickout(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.kickout failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.kickout failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: KickoutMeetingRequest = KickoutMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(KickoutMeetingRequestBody.builder() - .kickout_users([]) - .build()) \ - .build() + # 构造请求对象 + request: KickoutMeetingRequest = KickoutMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(KickoutMeetingRequestBody.builder() + .kickout_users([]) + .build()) \ + .build() - # 发起请求 - response: KickoutMeetingResponse = await client.vc.v1.meeting.akickout(request) + # 发起请求 + response: KickoutMeetingResponse = await client.vc.v1.meeting.akickout(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.akickout failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.akickout failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/list_alert_sample.py b/samples/api/vc/v1/list_alert_sample.py index 301990169..83c89a61b 100644 --- a/samples/api/vc/v1/list_alert_sample.py +++ b/samples/api/vc/v1/list_alert_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAlertRequest = ListAlertRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608888867") \ - .query_type(1) \ - .query_value("6911188411932033028") \ - .page_size(100) \ - .page_token("100") \ - .build() + # 构造请求对象 + request: ListAlertRequest = ListAlertRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608888867") \ + .query_type(1) \ + .query_value("6911188411932033028") \ + .page_size(100) \ + .page_token("100") \ + .build() - # 发起请求 - response: ListAlertResponse = client.vc.v1.alert.list(request) + # 发起请求 + response: ListAlertResponse = client.vc.v1.alert.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.alert.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.alert.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListAlertRequest = ListAlertRequest.builder() \ - .start_time("1608888867") \ - .end_time("1608888867") \ - .query_type(1) \ - .query_value("6911188411932033028") \ - .page_size(100) \ - .page_token("100") \ - .build() + # 构造请求对象 + request: ListAlertRequest = ListAlertRequest.builder() \ + .start_time("1608888867") \ + .end_time("1608888867") \ + .query_type(1) \ + .query_value("6911188411932033028") \ + .page_size(100) \ + .page_token("100") \ + .build() - # 发起请求 - response: ListAlertResponse = await client.vc.v1.alert.alist(request) + # 发起请求 + response: ListAlertResponse = await client.vc.v1.alert.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.alert.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.alert.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/list_by_no_meeting_sample.py b/samples/api/vc/v1/list_by_no_meeting_sample.py index 599f8a63e..daaa8fb33 100644 --- a/samples/api/vc/v1/list_by_no_meeting_sample.py +++ b/samples/api/vc/v1/list_by_no_meeting_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListByNoMeetingRequest = ListByNoMeetingRequest.builder() \ - .meeting_no("123456789") \ - .start_time("1608888867") \ - .end_time("1608888867") \ - .page_token("5") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListByNoMeetingRequest = ListByNoMeetingRequest.builder() \ + .meeting_no("123456789") \ + .start_time("1608888867") \ + .end_time("1608888867") \ + .page_token("5") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListByNoMeetingResponse = client.vc.v1.meeting.list_by_no(request) + # 发起请求 + response: ListByNoMeetingResponse = client.vc.v1.meeting.list_by_no(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.list_by_no failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.list_by_no failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListByNoMeetingRequest = ListByNoMeetingRequest.builder() \ - .meeting_no("123456789") \ - .start_time("1608888867") \ - .end_time("1608888867") \ - .page_token("5") \ - .page_size(20) \ - .build() + # 构造请求对象 + request: ListByNoMeetingRequest = ListByNoMeetingRequest.builder() \ + .meeting_no("123456789") \ + .start_time("1608888867") \ + .end_time("1608888867") \ + .page_token("5") \ + .page_size(20) \ + .build() - # 发起请求 - response: ListByNoMeetingResponse = await client.vc.v1.meeting.alist_by_no(request) + # 发起请求 + response: ListByNoMeetingResponse = await client.vc.v1.meeting.alist_by_no(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.alist_by_no failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.alist_by_no failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/list_room_level_sample.py b/samples/api/vc/v1/list_room_level_sample.py index 7b83abbff..2d2dee1df 100644 --- a/samples/api/vc/v1/list_room_level_sample.py +++ b/samples/api/vc/v1/list_room_level_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoomLevelRequest = ListRoomLevelRequest.builder() \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .page_size(10) \ - .page_token(" ") \ - .build() + # 构造请求对象 + request: ListRoomLevelRequest = ListRoomLevelRequest.builder() \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .page_size(10) \ + .page_token(" ") \ + .build() - # 发起请求 - response: ListRoomLevelResponse = client.vc.v1.room_level.list(request) + # 发起请求 + response: ListRoomLevelResponse = client.vc.v1.room_level.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoomLevelRequest = ListRoomLevelRequest.builder() \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .page_size(10) \ - .page_token(" ") \ - .build() + # 构造请求对象 + request: ListRoomLevelRequest = ListRoomLevelRequest.builder() \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .page_size(10) \ + .page_token(" ") \ + .build() - # 发起请求 - response: ListRoomLevelResponse = await client.vc.v1.room_level.alist(request) + # 发起请求 + response: ListRoomLevelResponse = await client.vc.v1.room_level.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/list_room_sample.py b/samples/api/vc/v1/list_room_sample.py index 9c9c6ead4..1c13c0b77 100644 --- a/samples/api/vc/v1/list_room_sample.py +++ b/samples/api/vc/v1/list_room_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoomRequest = ListRoomRequest.builder() \ - .page_size(10) \ - .page_token("10") \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListRoomRequest = ListRoomRequest.builder() \ + .page_size(10) \ + .page_token("10") \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListRoomResponse = client.vc.v1.room.list(request) + # 发起请求 + response: ListRoomResponse = client.vc.v1.room.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListRoomRequest = ListRoomRequest.builder() \ - .page_size(10) \ - .page_token("10") \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ListRoomRequest = ListRoomRequest.builder() \ + .page_size(10) \ + .page_token("10") \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ListRoomResponse = await client.vc.v1.room.alist(request) + # 发起请求 + response: ListRoomResponse = await client.vc.v1.room.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/meeting_list_export_sample.py b/samples/api/vc/v1/meeting_list_export_sample.py index 9e584b66d..6a7d29b21 100644 --- a/samples/api/vc/v1/meeting_list_export_sample.py +++ b/samples/api/vc/v1/meeting_list_export_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MeetingListExportRequest = MeetingListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MeetingListExportRequestBody.builder() - .start_time("1655276858") - .end_time("1655276858") - .meeting_status(2) - .meeting_no("123456789") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .meeting_type(2) - .build()) \ - .build() + # 构造请求对象 + request: MeetingListExportRequest = MeetingListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MeetingListExportRequestBody.builder() + .start_time("1655276858") + .end_time("1655276858") + .meeting_status(2) + .meeting_no("123456789") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .meeting_type(2) + .build()) \ + .build() - # 发起请求 - response: MeetingListExportResponse = client.vc.v1.export.meeting_list(request) + # 发起请求 + response: MeetingListExportResponse = client.vc.v1.export.meeting_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.meeting_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.meeting_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MeetingListExportRequest = MeetingListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MeetingListExportRequestBody.builder() - .start_time("1655276858") - .end_time("1655276858") - .meeting_status(2) - .meeting_no("123456789") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .meeting_type(2) - .build()) \ - .build() + # 构造请求对象 + request: MeetingListExportRequest = MeetingListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MeetingListExportRequestBody.builder() + .start_time("1655276858") + .end_time("1655276858") + .meeting_status(2) + .meeting_no("123456789") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .meeting_type(2) + .build()) \ + .build() - # 发起请求 - response: MeetingListExportResponse = await client.vc.v1.export.ameeting_list(request) + # 发起请求 + response: MeetingListExportResponse = await client.vc.v1.export.ameeting_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.ameeting_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.ameeting_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/mget_room_level_sample.py b/samples/api/vc/v1/mget_room_level_sample.py index 1d76482cd..72c79f367 100644 --- a/samples/api/vc/v1/mget_room_level_sample.py +++ b/samples/api/vc/v1/mget_room_level_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MgetRoomLevelRequest = MgetRoomLevelRequest.builder() \ - .request_body(MgetRoomLevelRequestBody.builder() - .level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: MgetRoomLevelRequest = MgetRoomLevelRequest.builder() \ + .request_body(MgetRoomLevelRequestBody.builder() + .level_ids([]) + .build()) \ + .build() - # 发起请求 - response: MgetRoomLevelResponse = client.vc.v1.room_level.mget(request) + # 发起请求 + response: MgetRoomLevelResponse = client.vc.v1.room_level.mget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.mget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.mget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MgetRoomLevelRequest = MgetRoomLevelRequest.builder() \ - .request_body(MgetRoomLevelRequestBody.builder() - .level_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: MgetRoomLevelRequest = MgetRoomLevelRequest.builder() \ + .request_body(MgetRoomLevelRequestBody.builder() + .level_ids([]) + .build()) \ + .build() - # 发起请求 - response: MgetRoomLevelResponse = await client.vc.v1.room_level.amget(request) + # 发起请求 + response: MgetRoomLevelResponse = await client.vc.v1.room_level.amget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.amget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.amget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/mget_room_sample.py b/samples/api/vc/v1/mget_room_sample.py index 450554b62..a0ad360c3 100644 --- a/samples/api/vc/v1/mget_room_sample.py +++ b/samples/api/vc/v1/mget_room_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MgetRoomRequest = MgetRoomRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MgetRoomRequestBody.builder() - .room_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: MgetRoomRequest = MgetRoomRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MgetRoomRequestBody.builder() + .room_ids([]) + .build()) \ + .build() - # 发起请求 - response: MgetRoomResponse = client.vc.v1.room.mget(request) + # 发起请求 + response: MgetRoomResponse = client.vc.v1.room.mget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.mget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.mget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MgetRoomRequest = MgetRoomRequest.builder() \ - .user_id_type("user_id") \ - .request_body(MgetRoomRequestBody.builder() - .room_ids([]) - .build()) \ - .build() + # 构造请求对象 + request: MgetRoomRequest = MgetRoomRequest.builder() \ + .user_id_type("user_id") \ + .request_body(MgetRoomRequestBody.builder() + .room_ids([]) + .build()) \ + .build() - # 发起请求 - response: MgetRoomResponse = await client.vc.v1.room.amget(request) + # 发起请求 + response: MgetRoomResponse = await client.vc.v1.room.amget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.amget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.amget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/participant_list_export_sample.py b/samples/api/vc/v1/participant_list_export_sample.py index 25a77f010..8b92012a0 100644 --- a/samples/api/vc/v1/participant_list_export_sample.py +++ b/samples/api/vc/v1/participant_list_export_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParticipantListExportRequest = ParticipantListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ParticipantListExportRequestBody.builder() - .meeting_start_time("1655276858") - .meeting_end_time("1655276858") - .meeting_status(2) - .meeting_no("123456789") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .build()) \ - .build() + # 构造请求对象 + request: ParticipantListExportRequest = ParticipantListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ParticipantListExportRequestBody.builder() + .meeting_start_time("1655276858") + .meeting_end_time("1655276858") + .meeting_status(2) + .meeting_no("123456789") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .build()) \ + .build() - # 发起请求 - response: ParticipantListExportResponse = client.vc.v1.export.participant_list(request) + # 发起请求 + response: ParticipantListExportResponse = client.vc.v1.export.participant_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.participant_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.participant_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParticipantListExportRequest = ParticipantListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ParticipantListExportRequestBody.builder() - .meeting_start_time("1655276858") - .meeting_end_time("1655276858") - .meeting_status(2) - .meeting_no("123456789") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .build()) \ - .build() + # 构造请求对象 + request: ParticipantListExportRequest = ParticipantListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ParticipantListExportRequestBody.builder() + .meeting_start_time("1655276858") + .meeting_end_time("1655276858") + .meeting_status(2) + .meeting_no("123456789") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .build()) \ + .build() - # 发起请求 - response: ParticipantListExportResponse = await client.vc.v1.export.aparticipant_list(request) + # 发起请求 + response: ParticipantListExportResponse = await client.vc.v1.export.aparticipant_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.aparticipant_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.aparticipant_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/participant_quality_list_export_sample.py b/samples/api/vc/v1/participant_quality_list_export_sample.py index 90c1455b7..debc5807b 100644 --- a/samples/api/vc/v1/participant_quality_list_export_sample.py +++ b/samples/api/vc/v1/participant_quality_list_export_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParticipantQualityListExportRequest = ParticipantQualityListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ParticipantQualityListExportRequestBody.builder() - .meeting_start_time("1655276858") - .meeting_end_time("1655276858") - .meeting_no("123456789") - .join_time("1655276858") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .build()) \ - .build() + # 构造请求对象 + request: ParticipantQualityListExportRequest = ParticipantQualityListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ParticipantQualityListExportRequestBody.builder() + .meeting_start_time("1655276858") + .meeting_end_time("1655276858") + .meeting_no("123456789") + .join_time("1655276858") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .build()) \ + .build() - # 发起请求 - response: ParticipantQualityListExportResponse = client.vc.v1.export.participant_quality_list(request) + # 发起请求 + response: ParticipantQualityListExportResponse = client.vc.v1.export.participant_quality_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.participant_quality_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.participant_quality_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ParticipantQualityListExportRequest = ParticipantQualityListExportRequest.builder() \ - .user_id_type("user_id") \ - .request_body(ParticipantQualityListExportRequestBody.builder() - .meeting_start_time("1655276858") - .meeting_end_time("1655276858") - .meeting_no("123456789") - .join_time("1655276858") - .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") - .room_id("omm_eada1d61a550955240c28757e7dec3af") - .build()) \ - .build() + # 构造请求对象 + request: ParticipantQualityListExportRequest = ParticipantQualityListExportRequest.builder() \ + .user_id_type("user_id") \ + .request_body(ParticipantQualityListExportRequestBody.builder() + .meeting_start_time("1655276858") + .meeting_end_time("1655276858") + .meeting_no("123456789") + .join_time("1655276858") + .user_id("ou_3ec3f6a28a0d08c45d895276e8e5e19b") + .room_id("omm_eada1d61a550955240c28757e7dec3af") + .build()) \ + .build() - # 发起请求 - response: ParticipantQualityListExportResponse = await client.vc.v1.export.aparticipant_quality_list(request) + # 发起请求 + response: ParticipantQualityListExportResponse = await client.vc.v1.export.aparticipant_quality_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.aparticipant_quality_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.aparticipant_quality_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_reserve_config_admin_sample.py b/samples/api/vc/v1/patch_reserve_config_admin_sample.py index f5d674e1f..d315bbb02 100644 --- a/samples/api/vc/v1/patch_reserve_config_admin_sample.py +++ b/samples/api/vc/v1/patch_reserve_config_admin_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigAdminRequest = PatchReserveConfigAdminRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigAdminRequestBody.builder() - .scope_type(2) - .reserve_admin_config(ReserveAdminConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigAdminRequest = PatchReserveConfigAdminRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigAdminRequestBody.builder() + .scope_type(2) + .reserve_admin_config(ReserveAdminConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigAdminResponse = client.vc.v1.reserve_config_admin.patch(request) + # 发起请求 + response: PatchReserveConfigAdminResponse = client.vc.v1.reserve_config_admin.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_admin.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_admin.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigAdminRequest = PatchReserveConfigAdminRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigAdminRequestBody.builder() - .scope_type(2) - .reserve_admin_config(ReserveAdminConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigAdminRequest = PatchReserveConfigAdminRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigAdminRequestBody.builder() + .scope_type(2) + .reserve_admin_config(ReserveAdminConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigAdminResponse = await client.vc.v1.reserve_config_admin.apatch(request) + # 发起请求 + response: PatchReserveConfigAdminResponse = await client.vc.v1.reserve_config_admin.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_admin.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_admin.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_reserve_config_disable_inform_sample.py b/samples/api/vc/v1/patch_reserve_config_disable_inform_sample.py index 9fe836301..c78f05d2e 100644 --- a/samples/api/vc/v1/patch_reserve_config_disable_inform_sample.py +++ b/samples/api/vc/v1/patch_reserve_config_disable_inform_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigDisableInformRequest = PatchReserveConfigDisableInformRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigDisableInformRequestBody.builder() - .scope_type(2) - .disable_inform(DisableInformConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigDisableInformRequest = PatchReserveConfigDisableInformRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigDisableInformRequestBody.builder() + .scope_type(2) + .disable_inform(DisableInformConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigDisableInformResponse = client.vc.v1.reserve_config_disable_inform.patch(request) + # 发起请求 + response: PatchReserveConfigDisableInformResponse = client.vc.v1.reserve_config_disable_inform.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_disable_inform.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_disable_inform.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigDisableInformRequest = PatchReserveConfigDisableInformRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigDisableInformRequestBody.builder() - .scope_type(2) - .disable_inform(DisableInformConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigDisableInformRequest = PatchReserveConfigDisableInformRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigDisableInformRequestBody.builder() + .scope_type(2) + .disable_inform(DisableInformConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigDisableInformResponse = await client.vc.v1.reserve_config_disable_inform.apatch(request) + # 发起请求 + response: PatchReserveConfigDisableInformResponse = await client.vc.v1.reserve_config_disable_inform.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_disable_inform.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_disable_inform.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_reserve_config_form_sample.py b/samples/api/vc/v1/patch_reserve_config_form_sample.py index 16d548c91..3c48365fe 100644 --- a/samples/api/vc/v1/patch_reserve_config_form_sample.py +++ b/samples/api/vc/v1/patch_reserve_config_form_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigFormRequest = PatchReserveConfigFormRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigFormRequestBody.builder() - .scope_type(2) - .reserve_form_config(ReserveFormConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigFormRequest = PatchReserveConfigFormRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigFormRequestBody.builder() + .scope_type(2) + .reserve_form_config(ReserveFormConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigFormResponse = client.vc.v1.reserve_config_form.patch(request) + # 发起请求 + response: PatchReserveConfigFormResponse = client.vc.v1.reserve_config_form.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_form.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_form.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigFormRequest = PatchReserveConfigFormRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigFormRequestBody.builder() - .scope_type(2) - .reserve_form_config(ReserveFormConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigFormRequest = PatchReserveConfigFormRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigFormRequestBody.builder() + .scope_type(2) + .reserve_form_config(ReserveFormConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigFormResponse = await client.vc.v1.reserve_config_form.apatch(request) + # 发起请求 + response: PatchReserveConfigFormResponse = await client.vc.v1.reserve_config_form.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config_form.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config_form.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_reserve_config_sample.py b/samples/api/vc/v1/patch_reserve_config_sample.py index d5f554215..0a831694e 100644 --- a/samples/api/vc/v1/patch_reserve_config_sample.py +++ b/samples/api/vc/v1/patch_reserve_config_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigRequest = PatchReserveConfigRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigRequestBody.builder() - .scope_type("2") - .approval_config(ApprovalConfig.builder().build()) - .time_config(TimeConfig.builder().build()) - .reserve_scope_config(ReserveScopeConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigRequest = PatchReserveConfigRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigRequestBody.builder() + .scope_type("2") + .approval_config(ApprovalConfig.builder().build()) + .time_config(TimeConfig.builder().build()) + .reserve_scope_config(ReserveScopeConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigResponse = client.vc.v1.reserve_config.patch(request) + # 发起请求 + response: PatchReserveConfigResponse = client.vc.v1.reserve_config.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchReserveConfigRequest = PatchReserveConfigRequest.builder() \ - .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .user_id_type("user_id") \ - .request_body(PatchReserveConfigRequestBody.builder() - .scope_type("2") - .approval_config(ApprovalConfig.builder().build()) - .time_config(TimeConfig.builder().build()) - .reserve_scope_config(ReserveScopeConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: PatchReserveConfigRequest = PatchReserveConfigRequest.builder() \ + .reserve_config_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .user_id_type("user_id") \ + .request_body(PatchReserveConfigRequestBody.builder() + .scope_type("2") + .approval_config(ApprovalConfig.builder().build()) + .time_config(TimeConfig.builder().build()) + .reserve_scope_config(ReserveScopeConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: PatchReserveConfigResponse = await client.vc.v1.reserve_config.apatch(request) + # 发起请求 + response: PatchReserveConfigResponse = await client.vc.v1.reserve_config.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_room_level_sample.py b/samples/api/vc/v1/patch_room_level_sample.py index 35e43b30c..dd0bf592a 100644 --- a/samples/api/vc/v1/patch_room_level_sample.py +++ b/samples/api/vc/v1/patch_room_level_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchRoomLevelRequest = PatchRoomLevelRequest.builder() \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .request_body(RoomLevel.builder() - .name("测试层级2") - .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") - .custom_group_id("zidingyi") - .build()) \ - .build() + # 构造请求对象 + request: PatchRoomLevelRequest = PatchRoomLevelRequest.builder() \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .request_body(RoomLevel.builder() + .name("测试层级2") + .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") + .custom_group_id("zidingyi") + .build()) \ + .build() - # 发起请求 - response: PatchRoomLevelResponse = client.vc.v1.room_level.patch(request) + # 发起请求 + response: PatchRoomLevelResponse = client.vc.v1.room_level.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchRoomLevelRequest = PatchRoomLevelRequest.builder() \ - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ - .request_body(RoomLevel.builder() - .name("测试层级2") - .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") - .custom_group_id("zidingyi") - .build()) \ - .build() + # 构造请求对象 + request: PatchRoomLevelRequest = PatchRoomLevelRequest.builder() \ + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") \ + .request_body(RoomLevel.builder() + .name("测试层级2") + .parent_id("omb_8d020b12fe49e82847c2af3c193d5754") + .custom_group_id("zidingyi") + .build()) \ + .build() - # 发起请求 - response: PatchRoomLevelResponse = await client.vc.v1.room_level.apatch(request) + # 发起请求 + response: PatchRoomLevelResponse = await client.vc.v1.room_level.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/patch_room_sample.py b/samples/api/vc/v1/patch_room_sample.py index ad3eb3bcd..f69a1e890 100644 --- a/samples/api/vc/v1/patch_room_sample.py +++ b/samples/api/vc/v1/patch_room_sample.py @@ -5,78 +5,78 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchRoomRequest = PatchRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ - .user_id_type("open_id") \ - .request_body(Room.builder() - .name("测试会议室") - .capacity(10) - .description("测试会议室描述") - .custom_room_id("1234") - .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") - .room_status(RoomStatus.builder().build()) - .device([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchRoomRequest = PatchRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ + .user_id_type("open_id") \ + .request_body(Room.builder() + .name("测试会议室") + .capacity(10) + .description("测试会议室描述") + .custom_room_id("1234") + .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") + .room_status(RoomStatus.builder().build()) + .device([]) + .build()) \ + .build() - # 发起请求 - response: PatchRoomResponse = client.vc.v1.room.patch(request) + # 发起请求 + response: PatchRoomResponse = client.vc.v1.room.patch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.patch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: PatchRoomRequest = PatchRoomRequest.builder() \ - .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ - .user_id_type("open_id") \ - .request_body(Room.builder() - .name("测试会议室") - .capacity(10) - .description("测试会议室描述") - .custom_room_id("1234") - .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") - .room_status(RoomStatus.builder().build()) - .device([]) - .build()) \ - .build() + # 构造请求对象 + request: PatchRoomRequest = PatchRoomRequest.builder() \ + .room_id("omm_4de32cf10a4358788ff4e09e37ebbf9b") \ + .user_id_type("open_id") \ + .request_body(Room.builder() + .name("测试会议室") + .capacity(10) + .description("测试会议室描述") + .custom_room_id("1234") + .room_level_id("omb_8d020b12fe49e82847c2af3c193d5754") + .room_status(RoomStatus.builder().build()) + .device([]) + .build()) \ + .build() - # 发起请求 - response: PatchRoomResponse = await client.vc.v1.room.apatch(request) + # 发起请求 + response: PatchRoomResponse = await client.vc.v1.room.apatch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.apatch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/query_room_config_sample.py b/samples/api/vc/v1/query_room_config_sample.py index 73f3a76dc..8d7c0291a 100644 --- a/samples/api/vc/v1/query_room_config_sample.py +++ b/samples/api/vc/v1/query_room_config_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryRoomConfigRequest = QueryRoomConfigRequest.builder() \ - .scope(5) \ - .country_id("1") \ - .district_id("2") \ - .building_id("3") \ - .floor_name("4") \ - .room_id("6383786266263") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryRoomConfigRequest = QueryRoomConfigRequest.builder() \ + .scope(5) \ + .country_id("1") \ + .district_id("2") \ + .building_id("3") \ + .floor_name("4") \ + .room_id("6383786266263") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryRoomConfigResponse = client.vc.v1.room_config.query(request) + # 发起请求 + response: QueryRoomConfigResponse = client.vc.v1.room_config.query(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.query failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: QueryRoomConfigRequest = QueryRoomConfigRequest.builder() \ - .scope(5) \ - .country_id("1") \ - .district_id("2") \ - .building_id("3") \ - .floor_name("4") \ - .room_id("6383786266263") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: QueryRoomConfigRequest = QueryRoomConfigRequest.builder() \ + .scope(5) \ + .country_id("1") \ + .district_id("2") \ + .building_id("3") \ + .floor_name("4") \ + .room_id("6383786266263") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: QueryRoomConfigResponse = await client.vc.v1.room_config.aquery(request) + # 发起请求 + response: QueryRoomConfigResponse = await client.vc.v1.room_config.aquery(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.aquery failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/reserve_scope_reserve_config_sample.py b/samples/api/vc/v1/reserve_scope_reserve_config_sample.py index 7d613bd98..ba34fed4b 100644 --- a/samples/api/vc/v1/reserve_scope_reserve_config_sample.py +++ b/samples/api/vc/v1/reserve_scope_reserve_config_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReserveScopeReserveConfigRequest = ReserveScopeReserveConfigRequest.builder() \ - .scope_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type("2") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ReserveScopeReserveConfigRequest = ReserveScopeReserveConfigRequest.builder() \ + .scope_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type("2") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ReserveScopeReserveConfigResponse = client.vc.v1.reserve_config.reserve_scope(request) + # 发起请求 + response: ReserveScopeReserveConfigResponse = client.vc.v1.reserve_config.reserve_scope(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config.reserve_scope failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config.reserve_scope failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ReserveScopeReserveConfigRequest = ReserveScopeReserveConfigRequest.builder() \ - .scope_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ - .scope_type("2") \ - .user_id_type("user_id") \ - .build() + # 构造请求对象 + request: ReserveScopeReserveConfigRequest = ReserveScopeReserveConfigRequest.builder() \ + .scope_id("omm_3c5dd7e09bac0c1758fcf9511bd1a771") \ + .scope_type("2") \ + .user_id_type("user_id") \ + .build() - # 发起请求 - response: ReserveScopeReserveConfigResponse = await client.vc.v1.reserve_config.areserve_scope(request) + # 发起请求 + response: ReserveScopeReserveConfigResponse = await client.vc.v1.reserve_config.areserve_scope(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve_config.areserve_scope failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve_config.areserve_scope failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/resource_reservation_list_export_sample.py b/samples/api/vc/v1/resource_reservation_list_export_sample.py index d29953519..4493176c7 100644 --- a/samples/api/vc/v1/resource_reservation_list_export_sample.py +++ b/samples/api/vc/v1/resource_reservation_list_export_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResourceReservationListExportRequest = ResourceReservationListExportRequest.builder() \ - .request_body(ResourceReservationListExportRequestBody.builder() - .room_level_id("omm_608d34d82d531b27fa993902d350a307") - .need_topic(True) - .start_time("1655276858") - .end_time("1655276858") - .room_ids([]) - .is_exclude(False) - .build()) \ - .build() + # 构造请求对象 + request: ResourceReservationListExportRequest = ResourceReservationListExportRequest.builder() \ + .request_body(ResourceReservationListExportRequestBody.builder() + .room_level_id("omm_608d34d82d531b27fa993902d350a307") + .need_topic(True) + .start_time("1655276858") + .end_time("1655276858") + .room_ids([]) + .is_exclude(False) + .build()) \ + .build() - # 发起请求 - response: ResourceReservationListExportResponse = client.vc.v1.export.resource_reservation_list(request) + # 发起请求 + response: ResourceReservationListExportResponse = client.vc.v1.export.resource_reservation_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.resource_reservation_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.resource_reservation_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ResourceReservationListExportRequest = ResourceReservationListExportRequest.builder() \ - .request_body(ResourceReservationListExportRequestBody.builder() - .room_level_id("omm_608d34d82d531b27fa993902d350a307") - .need_topic(True) - .start_time("1655276858") - .end_time("1655276858") - .room_ids([]) - .is_exclude(False) - .build()) \ - .build() + # 构造请求对象 + request: ResourceReservationListExportRequest = ResourceReservationListExportRequest.builder() \ + .request_body(ResourceReservationListExportRequestBody.builder() + .room_level_id("omm_608d34d82d531b27fa993902d350a307") + .need_topic(True) + .start_time("1655276858") + .end_time("1655276858") + .room_ids([]) + .is_exclude(False) + .build()) \ + .build() - # 发起请求 - response: ResourceReservationListExportResponse = await client.vc.v1.export.aresource_reservation_list(request) + # 发起请求 + response: ResourceReservationListExportResponse = await client.vc.v1.export.aresource_reservation_list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.export.aresource_reservation_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.export.aresource_reservation_list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/search_room_level_sample.py b/samples/api/vc/v1/search_room_level_sample.py index 65050cda3..39dab989a 100644 --- a/samples/api/vc/v1/search_room_level_sample.py +++ b/samples/api/vc/v1/search_room_level_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchRoomLevelRequest = SearchRoomLevelRequest.builder() \ - .custom_level_ids("1000,1001") \ - .build() + # 构造请求对象 + request: SearchRoomLevelRequest = SearchRoomLevelRequest.builder() \ + .custom_level_ids("1000,1001") \ + .build() - # 发起请求 - response: SearchRoomLevelResponse = client.vc.v1.room_level.search(request) + # 发起请求 + response: SearchRoomLevelResponse = client.vc.v1.room_level.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchRoomLevelRequest = SearchRoomLevelRequest.builder() \ - .custom_level_ids("1000,1001") \ - .build() + # 构造请求对象 + request: SearchRoomLevelRequest = SearchRoomLevelRequest.builder() \ + .custom_level_ids("1000,1001") \ + .build() - # 发起请求 - response: SearchRoomLevelResponse = await client.vc.v1.room_level.asearch(request) + # 发起请求 + response: SearchRoomLevelResponse = await client.vc.v1.room_level.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_level.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_level.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/search_room_sample.py b/samples/api/vc/v1/search_room_sample.py index 83de4bede..851c0177a 100644 --- a/samples/api/vc/v1/search_room_sample.py +++ b/samples/api/vc/v1/search_room_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchRoomRequest = SearchRoomRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SearchRoomRequestBody.builder() - .custom_room_ids([]) - .keyword("测试会议室") - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") - .search_level_name(True) - .page_size(10) - .page_token("0") - .build()) \ - .build() + # 构造请求对象 + request: SearchRoomRequest = SearchRoomRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SearchRoomRequestBody.builder() + .custom_room_ids([]) + .keyword("测试会议室") + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") + .search_level_name(True) + .page_size(10) + .page_token("0") + .build()) \ + .build() - # 发起请求 - response: SearchRoomResponse = client.vc.v1.room.search(request) + # 发起请求 + response: SearchRoomResponse = client.vc.v1.room.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchRoomRequest = SearchRoomRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SearchRoomRequestBody.builder() - .custom_room_ids([]) - .keyword("测试会议室") - .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") - .search_level_name(True) - .page_size(10) - .page_token("0") - .build()) \ - .build() + # 构造请求对象 + request: SearchRoomRequest = SearchRoomRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SearchRoomRequestBody.builder() + .custom_room_ids([]) + .keyword("测试会议室") + .room_level_id("omb_4ad1a2c7a2fbc5fc9570f38456931293") + .search_level_name(True) + .page_size(10) + .page_token("0") + .build()) \ + .build() - # 发起请求 - response: SearchRoomResponse = await client.vc.v1.room.asearch(request) + # 发起请求 + response: SearchRoomResponse = await client.vc.v1.room.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/set_checkboard_access_code_room_config_sample.py b/samples/api/vc/v1/set_checkboard_access_code_room_config_sample.py index 21ecdb05c..51d83f2b9 100644 --- a/samples/api/vc/v1/set_checkboard_access_code_room_config_sample.py +++ b/samples/api/vc/v1/set_checkboard_access_code_room_config_sample.py @@ -5,75 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetCheckboardAccessCodeRoomConfigRequest = SetCheckboardAccessCodeRoomConfigRequest.builder() \ - .request_body(SetCheckboardAccessCodeRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .valid_day(1) - .build()) \ - .build() + # 构造请求对象 + request: SetCheckboardAccessCodeRoomConfigRequest = SetCheckboardAccessCodeRoomConfigRequest.builder() \ + .request_body(SetCheckboardAccessCodeRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .valid_day(1) + .build()) \ + .build() - # 发起请求 - response: SetCheckboardAccessCodeRoomConfigResponse = client.vc.v1.room_config.set_checkboard_access_code(request) + # 发起请求 + response: SetCheckboardAccessCodeRoomConfigResponse = client.vc.v1.room_config.set_checkboard_access_code(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.set_checkboard_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.set_checkboard_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetCheckboardAccessCodeRoomConfigRequest = SetCheckboardAccessCodeRoomConfigRequest.builder() \ - .request_body(SetCheckboardAccessCodeRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .valid_day(1) - .build()) \ - .build() + # 构造请求对象 + request: SetCheckboardAccessCodeRoomConfigRequest = SetCheckboardAccessCodeRoomConfigRequest.builder() \ + .request_body(SetCheckboardAccessCodeRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .valid_day(1) + .build()) \ + .build() - # 发起请求 - response: SetCheckboardAccessCodeRoomConfigResponse = await client.vc.v1.room_config.aset_checkboard_access_code( - request) + # 发起请求 + response: SetCheckboardAccessCodeRoomConfigResponse = await client.vc.v1.room_config.aset_checkboard_access_code(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.aset_checkboard_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.aset_checkboard_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/set_host_meeting_sample.py b/samples/api/vc/v1/set_host_meeting_sample.py index 178051b16..f68b8e24c 100644 --- a/samples/api/vc/v1/set_host_meeting_sample.py +++ b/samples/api/vc/v1/set_host_meeting_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetHostMeetingRequest = SetHostMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(SetHostMeetingRequestBody.builder() - .host_user(MeetingUser.builder().build()) - .old_host_user(MeetingUser.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetHostMeetingRequest = SetHostMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(SetHostMeetingRequestBody.builder() + .host_user(MeetingUser.builder().build()) + .old_host_user(MeetingUser.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetHostMeetingResponse = client.vc.v1.meeting.set_host(request) + # 发起请求 + response: SetHostMeetingResponse = client.vc.v1.meeting.set_host(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.set_host failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.set_host failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetHostMeetingRequest = SetHostMeetingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(SetHostMeetingRequestBody.builder() - .host_user(MeetingUser.builder().build()) - .old_host_user(MeetingUser.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetHostMeetingRequest = SetHostMeetingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(SetHostMeetingRequestBody.builder() + .host_user(MeetingUser.builder().build()) + .old_host_user(MeetingUser.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetHostMeetingResponse = await client.vc.v1.meeting.aset_host(request) + # 发起请求 + response: SetHostMeetingResponse = await client.vc.v1.meeting.aset_host(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting.aset_host failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting.aset_host failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/set_permission_meeting_recording_sample.py b/samples/api/vc/v1/set_permission_meeting_recording_sample.py index f031df605..124b8a3cb 100644 --- a/samples/api/vc/v1/set_permission_meeting_recording_sample.py +++ b/samples/api/vc/v1/set_permission_meeting_recording_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetPermissionMeetingRecordingRequest = SetPermissionMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(SetPermissionMeetingRecordingRequestBody.builder() - .permission_objects([]) - .action_type(1) - .build()) \ - .build() + # 构造请求对象 + request: SetPermissionMeetingRecordingRequest = SetPermissionMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(SetPermissionMeetingRecordingRequestBody.builder() + .permission_objects([]) + .action_type(1) + .build()) \ + .build() - # 发起请求 - response: SetPermissionMeetingRecordingResponse = client.vc.v1.meeting_recording.set_permission(request) + # 发起请求 + response: SetPermissionMeetingRecordingResponse = client.vc.v1.meeting_recording.set_permission(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.set_permission failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.set_permission failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetPermissionMeetingRecordingRequest = SetPermissionMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(SetPermissionMeetingRecordingRequestBody.builder() - .permission_objects([]) - .action_type(1) - .build()) \ - .build() + # 构造请求对象 + request: SetPermissionMeetingRecordingRequest = SetPermissionMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(SetPermissionMeetingRecordingRequestBody.builder() + .permission_objects([]) + .action_type(1) + .build()) \ + .build() - # 发起请求 - response: SetPermissionMeetingRecordingResponse = await client.vc.v1.meeting_recording.aset_permission(request) + # 发起请求 + response: SetPermissionMeetingRecordingResponse = await client.vc.v1.meeting_recording.aset_permission(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.aset_permission failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.aset_permission failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/set_room_access_code_room_config_sample.py b/samples/api/vc/v1/set_room_access_code_room_config_sample.py index 5573c592f..2d7543b39 100644 --- a/samples/api/vc/v1/set_room_access_code_room_config_sample.py +++ b/samples/api/vc/v1/set_room_access_code_room_config_sample.py @@ -5,74 +5,74 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetRoomAccessCodeRoomConfigRequest = SetRoomAccessCodeRoomConfigRequest.builder() \ - .request_body(SetRoomAccessCodeRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .valid_day(1) - .build()) \ - .build() + # 构造请求对象 + request: SetRoomAccessCodeRoomConfigRequest = SetRoomAccessCodeRoomConfigRequest.builder() \ + .request_body(SetRoomAccessCodeRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .valid_day(1) + .build()) \ + .build() - # 发起请求 - response: SetRoomAccessCodeRoomConfigResponse = client.vc.v1.room_config.set_room_access_code(request) + # 发起请求 + response: SetRoomAccessCodeRoomConfigResponse = client.vc.v1.room_config.set_room_access_code(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.set_room_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.set_room_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetRoomAccessCodeRoomConfigRequest = SetRoomAccessCodeRoomConfigRequest.builder() \ - .request_body(SetRoomAccessCodeRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .valid_day(1) - .build()) \ - .build() + # 构造请求对象 + request: SetRoomAccessCodeRoomConfigRequest = SetRoomAccessCodeRoomConfigRequest.builder() \ + .request_body(SetRoomAccessCodeRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .valid_day(1) + .build()) \ + .build() - # 发起请求 - response: SetRoomAccessCodeRoomConfigResponse = await client.vc.v1.room_config.aset_room_access_code(request) + # 发起请求 + response: SetRoomAccessCodeRoomConfigResponse = await client.vc.v1.room_config.aset_room_access_code(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.aset_room_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.aset_room_access_code failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/set_room_config_sample.py b/samples/api/vc/v1/set_room_config_sample.py index 58710e232..b49910755 100644 --- a/samples/api/vc/v1/set_room_config_sample.py +++ b/samples/api/vc/v1/set_room_config_sample.py @@ -5,76 +5,76 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetRoomConfigRequest = SetRoomConfigRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SetRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .room_config(RoomConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetRoomConfigRequest = SetRoomConfigRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SetRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .room_config(RoomConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetRoomConfigResponse = client.vc.v1.room_config.set(request) + # 发起请求 + response: SetRoomConfigResponse = client.vc.v1.room_config.set(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.set failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.set failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SetRoomConfigRequest = SetRoomConfigRequest.builder() \ - .user_id_type("user_id") \ - .request_body(SetRoomConfigRequestBody.builder() - .scope(5) - .country_id("1") - .district_id("2") - .building_id("3") - .floor_name("4") - .room_id("67687262867363") - .room_config(RoomConfig.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: SetRoomConfigRequest = SetRoomConfigRequest.builder() \ + .user_id_type("user_id") \ + .request_body(SetRoomConfigRequestBody.builder() + .scope(5) + .country_id("1") + .district_id("2") + .building_id("3") + .floor_name("4") + .room_id("67687262867363") + .room_config(RoomConfig.builder().build()) + .build()) \ + .build() - # 发起请求 - response: SetRoomConfigResponse = await client.vc.v1.room_config.aset(request) + # 发起请求 + response: SetRoomConfigResponse = await client.vc.v1.room_config.aset(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.room_config.aset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.room_config.aset failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/start_meeting_recording_sample.py b/samples/api/vc/v1/start_meeting_recording_sample.py index f7da583fb..32d9183c7 100644 --- a/samples/api/vc/v1/start_meeting_recording_sample.py +++ b/samples/api/vc/v1/start_meeting_recording_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StartMeetingRecordingRequest = StartMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .request_body(StartMeetingRecordingRequestBody.builder() - .timezone(8) - .build()) \ - .build() + # 构造请求对象 + request: StartMeetingRecordingRequest = StartMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .request_body(StartMeetingRecordingRequestBody.builder() + .timezone(8) + .build()) \ + .build() - # 发起请求 - response: StartMeetingRecordingResponse = client.vc.v1.meeting_recording.start(request) + # 发起请求 + response: StartMeetingRecordingResponse = client.vc.v1.meeting_recording.start(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.start failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.start failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StartMeetingRecordingRequest = StartMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .request_body(StartMeetingRecordingRequestBody.builder() - .timezone(8) - .build()) \ - .build() + # 构造请求对象 + request: StartMeetingRecordingRequest = StartMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .request_body(StartMeetingRecordingRequestBody.builder() + .timezone(8) + .build()) \ + .build() - # 发起请求 - response: StartMeetingRecordingResponse = await client.vc.v1.meeting_recording.astart(request) + # 发起请求 + response: StartMeetingRecordingResponse = await client.vc.v1.meeting_recording.astart(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.astart failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.astart failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/stop_meeting_recording_sample.py b/samples/api/vc/v1/stop_meeting_recording_sample.py index 3f396e0a4..b02a04969 100644 --- a/samples/api/vc/v1/stop_meeting_recording_sample.py +++ b/samples/api/vc/v1/stop_meeting_recording_sample.py @@ -5,58 +5,58 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StopMeetingRecordingRequest = StopMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: StopMeetingRecordingRequest = StopMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: StopMeetingRecordingResponse = client.vc.v1.meeting_recording.stop(request) + # 发起请求 + response: StopMeetingRecordingResponse = client.vc.v1.meeting_recording.stop(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.stop failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.stop failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: StopMeetingRecordingRequest = StopMeetingRecordingRequest.builder() \ - .meeting_id("6911188411932033028") \ - .build() + # 构造请求对象 + request: StopMeetingRecordingRequest = StopMeetingRecordingRequest.builder() \ + .meeting_id("6911188411932033028") \ + .build() - # 发起请求 - response: StopMeetingRecordingResponse = await client.vc.v1.meeting_recording.astop(request) + # 发起请求 + response: StopMeetingRecordingResponse = await client.vc.v1.meeting_recording.astop(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.meeting_recording.astop failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.meeting_recording.astop failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/vc/v1/update_reserve_sample.py b/samples/api/vc/v1/update_reserve_sample.py index c02b71248..e3274b824 100644 --- a/samples/api/vc/v1/update_reserve_sample.py +++ b/samples/api/vc/v1/update_reserve_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateReserveRequest = UpdateReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(UpdateReserveRequestBody.builder() - .end_time("1608888867") - .meeting_settings(ReserveMeetingSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateReserveRequest = UpdateReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(UpdateReserveRequestBody.builder() + .end_time("1608888867") + .meeting_settings(ReserveMeetingSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateReserveResponse = client.vc.v1.reserve.update(request) + # 发起请求 + response: UpdateReserveResponse = client.vc.v1.reserve.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateReserveRequest = UpdateReserveRequest.builder() \ - .reserve_id("6911188411932033028") \ - .user_id_type("user_id") \ - .request_body(UpdateReserveRequestBody.builder() - .end_time("1608888867") - .meeting_settings(ReserveMeetingSetting.builder().build()) - .build()) \ - .build() + # 构造请求对象 + request: UpdateReserveRequest = UpdateReserveRequest.builder() \ + .reserve_id("6911188411932033028") \ + .user_id_type("user_id") \ + .request_body(UpdateReserveRequestBody.builder() + .end_time("1608888867") + .meeting_settings(ReserveMeetingSetting.builder().build()) + .build()) \ + .build() - # 发起请求 - response: UpdateReserveResponse = await client.vc.v1.reserve.aupdate(request) + # 发起请求 + response: UpdateReserveResponse = await client.vc.v1.reserve.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.vc.v1.reserve.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.vc.v1.reserve.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/verification/v1/get_verification_sample.py b/samples/api/verification/v1/get_verification_sample.py index de32392d6..640f3255f 100644 --- a/samples/api/verification/v1/get_verification_sample.py +++ b/samples/api/verification/v1/get_verification_sample.py @@ -5,56 +5,56 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetVerificationRequest = GetVerificationRequest.builder() \ - .build() + # 构造请求对象 + request: GetVerificationRequest = GetVerificationRequest.builder() \ + .build() - # 发起请求 - response: GetVerificationResponse = client.verification.v1.verification.get(request) + # 发起请求 + response: GetVerificationResponse = client.verification.v1.verification.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.verification.v1.verification.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.verification.v1.verification.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetVerificationRequest = GetVerificationRequest.builder() \ - .build() + # 构造请求对象 + request: GetVerificationRequest = GetVerificationRequest.builder() \ + .build() - # 发起请求 - response: GetVerificationResponse = await client.verification.v1.verification.aget(request) + # 发起请求 + response: GetVerificationResponse = await client.verification.v1.verification.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.verification.v1.verification.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.verification.v1.verification.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/copy_space_node_sample.py b/samples/api/wiki/v2/copy_space_node_sample.py index 85dc04e2b..841ef8d94 100644 --- a/samples/api/wiki/v2/copy_space_node_sample.py +++ b/samples/api/wiki/v2/copy_space_node_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopySpaceNodeRequest = CopySpaceNodeRequest.builder() \ - .space_id("6946843325487912356") \ - .node_token("wikcnKQ1k3p******8Vabce") \ - .request_body(CopySpaceNodeRequestBody.builder() - .target_parent_token("wikcnKQ1k3p******8Vabce") - .target_space_id("6946843325487912356") - .title("新标题。") - .build()) \ - .build() + # 构造请求对象 + request: CopySpaceNodeRequest = CopySpaceNodeRequest.builder() \ + .space_id("6946843325487912356") \ + .node_token("wikcnKQ1k3p******8Vabce") \ + .request_body(CopySpaceNodeRequestBody.builder() + .target_parent_token("wikcnKQ1k3p******8Vabce") + .target_space_id("6946843325487912356") + .title("新标题。") + .build()) \ + .build() - # 发起请求 - response: CopySpaceNodeResponse = client.wiki.v2.space_node.copy(request) + # 发起请求 + response: CopySpaceNodeResponse = client.wiki.v2.space_node.copy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.copy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CopySpaceNodeRequest = CopySpaceNodeRequest.builder() \ - .space_id("6946843325487912356") \ - .node_token("wikcnKQ1k3p******8Vabce") \ - .request_body(CopySpaceNodeRequestBody.builder() - .target_parent_token("wikcnKQ1k3p******8Vabce") - .target_space_id("6946843325487912356") - .title("新标题。") - .build()) \ - .build() + # 构造请求对象 + request: CopySpaceNodeRequest = CopySpaceNodeRequest.builder() \ + .space_id("6946843325487912356") \ + .node_token("wikcnKQ1k3p******8Vabce") \ + .request_body(CopySpaceNodeRequestBody.builder() + .target_parent_token("wikcnKQ1k3p******8Vabce") + .target_space_id("6946843325487912356") + .title("新标题。") + .build()) \ + .build() - # 发起请求 - response: CopySpaceNodeResponse = await client.wiki.v2.space_node.acopy(request) + # 发起请求 + response: CopySpaceNodeResponse = await client.wiki.v2.space_node.acopy(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.acopy failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/create_space_member_sample.py b/samples/api/wiki/v2/create_space_member_sample.py index c7c6e56b5..4452cc26c 100644 --- a/samples/api/wiki/v2/create_space_member_sample.py +++ b/samples/api/wiki/v2/create_space_member_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceMemberRequest = CreateSpaceMemberRequest.builder() \ - .space_id("1565676577122621") \ - .need_notification(True) \ - .request_body(Member.builder() - .member_type("openid") - .member_id("ou_67e5ecb64ce1c0bd94612c17999db411") - .member_role("admin") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceMemberRequest = CreateSpaceMemberRequest.builder() \ + .space_id("1565676577122621") \ + .need_notification(True) \ + .request_body(Member.builder() + .member_type("openid") + .member_id("ou_67e5ecb64ce1c0bd94612c17999db411") + .member_role("admin") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceMemberResponse = client.wiki.v2.space_member.create(request) + # 发起请求 + response: CreateSpaceMemberResponse = client.wiki.v2.space_member.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceMemberRequest = CreateSpaceMemberRequest.builder() \ - .space_id("1565676577122621") \ - .need_notification(True) \ - .request_body(Member.builder() - .member_type("openid") - .member_id("ou_67e5ecb64ce1c0bd94612c17999db411") - .member_role("admin") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceMemberRequest = CreateSpaceMemberRequest.builder() \ + .space_id("1565676577122621") \ + .need_notification(True) \ + .request_body(Member.builder() + .member_type("openid") + .member_id("ou_67e5ecb64ce1c0bd94612c17999db411") + .member_role("admin") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceMemberResponse = await client.wiki.v2.space_member.acreate(request) + # 发起请求 + response: CreateSpaceMemberResponse = await client.wiki.v2.space_member.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/create_space_node_sample.py b/samples/api/wiki/v2/create_space_node_sample.py index 4b25e91f2..84561fe23 100644 --- a/samples/api/wiki/v2/create_space_node_sample.py +++ b/samples/api/wiki/v2/create_space_node_sample.py @@ -5,72 +5,72 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceNodeRequest = CreateSpaceNodeRequest.builder() \ - .space_id("6704147935988285963") \ - .request_body(Node.builder() - .obj_type("doc") - .parent_node_token("wikcnKQ1k3p******8Vabcef") - .node_type("origin") - .origin_node_token("wikcnKQ1k3p******8Vabcef") - .title("xxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceNodeRequest = CreateSpaceNodeRequest.builder() \ + .space_id("6704147935988285963") \ + .request_body(Node.builder() + .obj_type("doc") + .parent_node_token("wikcnKQ1k3p******8Vabcef") + .node_type("origin") + .origin_node_token("wikcnKQ1k3p******8Vabcef") + .title("xxxx") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceNodeResponse = client.wiki.v2.space_node.create(request) + # 发起请求 + response: CreateSpaceNodeResponse = client.wiki.v2.space_node.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceNodeRequest = CreateSpaceNodeRequest.builder() \ - .space_id("6704147935988285963") \ - .request_body(Node.builder() - .obj_type("doc") - .parent_node_token("wikcnKQ1k3p******8Vabcef") - .node_type("origin") - .origin_node_token("wikcnKQ1k3p******8Vabcef") - .title("xxxx") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceNodeRequest = CreateSpaceNodeRequest.builder() \ + .space_id("6704147935988285963") \ + .request_body(Node.builder() + .obj_type("doc") + .parent_node_token("wikcnKQ1k3p******8Vabcef") + .node_type("origin") + .origin_node_token("wikcnKQ1k3p******8Vabcef") + .title("xxxx") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceNodeResponse = await client.wiki.v2.space_node.acreate(request) + # 发起请求 + response: CreateSpaceNodeResponse = await client.wiki.v2.space_node.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/create_space_sample.py b/samples/api/wiki/v2/create_space_sample.py index 133b020bb..87ccc2cc2 100644 --- a/samples/api/wiki/v2/create_space_sample.py +++ b/samples/api/wiki/v2/create_space_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceRequest = CreateSpaceRequest.builder() \ - .request_body(Space.builder() - .name("测试知识库") - .description("测试知识库") - .open_sharing("open") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceRequest = CreateSpaceRequest.builder() \ + .request_body(Space.builder() + .name("测试知识库") + .description("测试知识库") + .open_sharing("open") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceResponse = client.wiki.v2.space.create(request) + # 发起请求 + response: CreateSpaceResponse = client.wiki.v2.space.create(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.create failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: CreateSpaceRequest = CreateSpaceRequest.builder() \ - .request_body(Space.builder() - .name("测试知识库") - .description("测试知识库") - .open_sharing("open") - .build()) \ - .build() + # 构造请求对象 + request: CreateSpaceRequest = CreateSpaceRequest.builder() \ + .request_body(Space.builder() + .name("测试知识库") + .description("测试知识库") + .open_sharing("open") + .build()) \ + .build() - # 发起请求 - response: CreateSpaceResponse = await client.wiki.v2.space.acreate(request) + # 发起请求 + response: CreateSpaceResponse = await client.wiki.v2.space.acreate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.acreate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/delete_space_member_sample.py b/samples/api/wiki/v2/delete_space_member_sample.py index 2b5fd7fd9..d81e33bd1 100644 --- a/samples/api/wiki/v2/delete_space_member_sample.py +++ b/samples/api/wiki/v2/delete_space_member_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpaceMemberRequest = DeleteSpaceMemberRequest.builder() \ - .space_id("7008061636015554580") \ - .member_id("g64fb7g7") \ - .request_body(Member.builder() - .member_type("openid") - .member_role("admin") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: DeleteSpaceMemberRequest = DeleteSpaceMemberRequest.builder() \ + .space_id("7008061636015554580") \ + .member_id("g64fb7g7") \ + .request_body(Member.builder() + .member_type("openid") + .member_role("admin") + .type("user") + .build()) \ + .build() - # 发起请求 - response: DeleteSpaceMemberResponse = client.wiki.v2.space_member.delete(request) + # 发起请求 + response: DeleteSpaceMemberResponse = client.wiki.v2.space_member.delete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.delete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: DeleteSpaceMemberRequest = DeleteSpaceMemberRequest.builder() \ - .space_id("7008061636015554580") \ - .member_id("g64fb7g7") \ - .request_body(Member.builder() - .member_type("openid") - .member_role("admin") - .type("user") - .build()) \ - .build() + # 构造请求对象 + request: DeleteSpaceMemberRequest = DeleteSpaceMemberRequest.builder() \ + .space_id("7008061636015554580") \ + .member_id("g64fb7g7") \ + .request_body(Member.builder() + .member_type("openid") + .member_role("admin") + .type("user") + .build()) \ + .build() - # 发起请求 - response: DeleteSpaceMemberResponse = await client.wiki.v2.space_member.adelete(request) + # 发起请求 + response: DeleteSpaceMemberResponse = await client.wiki.v2.space_member.adelete(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.adelete failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/get_node_space_sample.py b/samples/api/wiki/v2/get_node_space_sample.py index 7c5dd47ac..9f2cf7f0b 100644 --- a/samples/api/wiki/v2/get_node_space_sample.py +++ b/samples/api/wiki/v2/get_node_space_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNodeSpaceRequest = GetNodeSpaceRequest.builder() \ - .token("wikcnKQ1k3p******8Vabcef") \ - .obj_type("wiki") \ - .build() + # 构造请求对象 + request: GetNodeSpaceRequest = GetNodeSpaceRequest.builder() \ + .token("wikcnKQ1k3p******8Vabcef") \ + .obj_type("wiki") \ + .build() - # 发起请求 - response: GetNodeSpaceResponse = client.wiki.v2.space.get_node(request) + # 发起请求 + response: GetNodeSpaceResponse = client.wiki.v2.space.get_node(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.get_node failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.get_node failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetNodeSpaceRequest = GetNodeSpaceRequest.builder() \ - .token("wikcnKQ1k3p******8Vabcef") \ - .obj_type("wiki") \ - .build() + # 构造请求对象 + request: GetNodeSpaceRequest = GetNodeSpaceRequest.builder() \ + .token("wikcnKQ1k3p******8Vabcef") \ + .obj_type("wiki") \ + .build() - # 发起请求 - response: GetNodeSpaceResponse = await client.wiki.v2.space.aget_node(request) + # 发起请求 + response: GetNodeSpaceResponse = await client.wiki.v2.space.aget_node(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.aget_node failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.aget_node failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/get_space_sample.py b/samples/api/wiki/v2/get_space_sample.py index e517d8a67..28d806469 100644 --- a/samples/api/wiki/v2/get_space_sample.py +++ b/samples/api/wiki/v2/get_space_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpaceRequest = GetSpaceRequest.builder() \ - .space_id("6870403571079249922") \ - .lang("en") \ - .build() + # 构造请求对象 + request: GetSpaceRequest = GetSpaceRequest.builder() \ + .space_id("6870403571079249922") \ + .lang("en") \ + .build() - # 发起请求 - response: GetSpaceResponse = client.wiki.v2.space.get(request) + # 发起请求 + response: GetSpaceResponse = client.wiki.v2.space.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetSpaceRequest = GetSpaceRequest.builder() \ - .space_id("6870403571079249922") \ - .lang("en") \ - .build() + # 构造请求对象 + request: GetSpaceRequest = GetSpaceRequest.builder() \ + .space_id("6870403571079249922") \ + .lang("en") \ + .build() - # 发起请求 - response: GetSpaceResponse = await client.wiki.v2.space.aget(request) + # 发起请求 + response: GetSpaceResponse = await client.wiki.v2.space.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/get_task_sample.py b/samples/api/wiki/v2/get_task_sample.py index 150a58f5d..aee88e546 100644 --- a/samples/api/wiki/v2/get_task_sample.py +++ b/samples/api/wiki/v2/get_task_sample.py @@ -5,60 +5,60 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_id("7037044037068177428-075c9481e6a0007c1df689dfbe5b55a08b6b06f7") \ - .task_type("move") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_id("7037044037068177428-075c9481e6a0007c1df689dfbe5b55a08b6b06f7") \ + .task_type("move") \ + .build() - # 发起请求 - response: GetTaskResponse = client.wiki.v2.task.get(request) + # 发起请求 + response: GetTaskResponse = client.wiki.v2.task.get(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.task.get failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: GetTaskRequest = GetTaskRequest.builder() \ - .task_id("7037044037068177428-075c9481e6a0007c1df689dfbe5b55a08b6b06f7") \ - .task_type("move") \ - .build() + # 构造请求对象 + request: GetTaskRequest = GetTaskRequest.builder() \ + .task_id("7037044037068177428-075c9481e6a0007c1df689dfbe5b55a08b6b06f7") \ + .task_type("move") \ + .build() - # 发起请求 - response: GetTaskResponse = await client.wiki.v2.task.aget(request) + # 发起请求 + response: GetTaskResponse = await client.wiki.v2.task.aget(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.task.aget failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/list_space_member_sample.py b/samples/api/wiki/v2/list_space_member_sample.py index 12d42bca5..0d1dbad99 100644 --- a/samples/api/wiki/v2/list_space_member_sample.py +++ b/samples/api/wiki/v2/list_space_member_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceMemberRequest = ListSpaceMemberRequest.builder() \ - .space_id("7375263209671884820") \ - .page_size(1) \ - .page_token("ou_12345") \ - .build() + # 构造请求对象 + request: ListSpaceMemberRequest = ListSpaceMemberRequest.builder() \ + .space_id("7375263209671884820") \ + .page_size(1) \ + .page_token("ou_12345") \ + .build() - # 发起请求 - response: ListSpaceMemberResponse = client.wiki.v2.space_member.list(request) + # 发起请求 + response: ListSpaceMemberResponse = client.wiki.v2.space_member.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceMemberRequest = ListSpaceMemberRequest.builder() \ - .space_id("7375263209671884820") \ - .page_size(1) \ - .page_token("ou_12345") \ - .build() + # 构造请求对象 + request: ListSpaceMemberRequest = ListSpaceMemberRequest.builder() \ + .space_id("7375263209671884820") \ + .page_size(1) \ + .page_token("ou_12345") \ + .build() - # 发起请求 - response: ListSpaceMemberResponse = await client.wiki.v2.space_member.alist(request) + # 发起请求 + response: ListSpaceMemberResponse = await client.wiki.v2.space_member.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_member.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/list_space_node_sample.py b/samples/api/wiki/v2/list_space_node_sample.py index 0fcff7abf..11f5a807a 100644 --- a/samples/api/wiki/v2/list_space_node_sample.py +++ b/samples/api/wiki/v2/list_space_node_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceNodeRequest = ListSpaceNodeRequest.builder() \ - .space_id("6946843325487906839") \ - .page_size(10) \ - .page_token("6946843325487456878") \ - .parent_node_token("wikcnKQ1k3p******8Vabce") \ - .build() + # 构造请求对象 + request: ListSpaceNodeRequest = ListSpaceNodeRequest.builder() \ + .space_id("6946843325487906839") \ + .page_size(10) \ + .page_token("6946843325487456878") \ + .parent_node_token("wikcnKQ1k3p******8Vabce") \ + .build() - # 发起请求 - response: ListSpaceNodeResponse = client.wiki.v2.space_node.list(request) + # 发起请求 + response: ListSpaceNodeResponse = client.wiki.v2.space_node.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceNodeRequest = ListSpaceNodeRequest.builder() \ - .space_id("6946843325487906839") \ - .page_size(10) \ - .page_token("6946843325487456878") \ - .parent_node_token("wikcnKQ1k3p******8Vabce") \ - .build() + # 构造请求对象 + request: ListSpaceNodeRequest = ListSpaceNodeRequest.builder() \ + .space_id("6946843325487906839") \ + .page_size(10) \ + .page_token("6946843325487456878") \ + .parent_node_token("wikcnKQ1k3p******8Vabce") \ + .build() - # 发起请求 - response: ListSpaceNodeResponse = await client.wiki.v2.space_node.alist(request) + # 发起请求 + response: ListSpaceNodeResponse = await client.wiki.v2.space_node.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/list_space_sample.py b/samples/api/wiki/v2/list_space_sample.py index 63cfcebbb..cf3875694 100644 --- a/samples/api/wiki/v2/list_space_sample.py +++ b/samples/api/wiki/v2/list_space_sample.py @@ -5,62 +5,62 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceRequest = ListSpaceRequest.builder() \ - .page_size(20) \ - .page_token("1565676577122621") \ - .lang("en") \ - .build() + # 构造请求对象 + request: ListSpaceRequest = ListSpaceRequest.builder() \ + .page_size(20) \ + .page_token("1565676577122621") \ + .lang("en") \ + .build() - # 发起请求 - response: ListSpaceResponse = client.wiki.v2.space.list(request) + # 发起请求 + response: ListSpaceResponse = client.wiki.v2.space.list(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: ListSpaceRequest = ListSpaceRequest.builder() \ - .page_size(20) \ - .page_token("1565676577122621") \ - .lang("en") \ - .build() + # 构造请求对象 + request: ListSpaceRequest = ListSpaceRequest.builder() \ + .page_size(20) \ + .page_token("1565676577122621") \ + .lang("en") \ + .build() - # 发起请求 - response: ListSpaceResponse = await client.wiki.v2.space.alist(request) + # 发起请求 + response: ListSpaceResponse = await client.wiki.v2.space.alist(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space.alist failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/move_docs_to_wiki_space_node_sample.py b/samples/api/wiki/v2/move_docs_to_wiki_space_node_sample.py index c11b105ab..14e29135d 100644 --- a/samples/api/wiki/v2/move_docs_to_wiki_space_node_sample.py +++ b/samples/api/wiki/v2/move_docs_to_wiki_space_node_sample.py @@ -5,70 +5,70 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveDocsToWikiSpaceNodeRequest = MoveDocsToWikiSpaceNodeRequest.builder() \ - .space_id("1565676577122621") \ - .request_body(MoveDocsToWikiSpaceNodeRequestBody.builder() - .parent_wiki_token("wikcnKQ1k3p******8Vabce") - .obj_type("doc") - .obj_token("doccnzAaOD******Wabcdef") - .apply(True) - .build()) \ - .build() + # 构造请求对象 + request: MoveDocsToWikiSpaceNodeRequest = MoveDocsToWikiSpaceNodeRequest.builder() \ + .space_id("1565676577122621") \ + .request_body(MoveDocsToWikiSpaceNodeRequestBody.builder() + .parent_wiki_token("wikcnKQ1k3p******8Vabce") + .obj_type("doc") + .obj_token("doccnzAaOD******Wabcdef") + .apply(True) + .build()) \ + .build() - # 发起请求 - response: MoveDocsToWikiSpaceNodeResponse = client.wiki.v2.space_node.move_docs_to_wiki(request) + # 发起请求 + response: MoveDocsToWikiSpaceNodeResponse = client.wiki.v2.space_node.move_docs_to_wiki(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.move_docs_to_wiki failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.move_docs_to_wiki failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveDocsToWikiSpaceNodeRequest = MoveDocsToWikiSpaceNodeRequest.builder() \ - .space_id("1565676577122621") \ - .request_body(MoveDocsToWikiSpaceNodeRequestBody.builder() - .parent_wiki_token("wikcnKQ1k3p******8Vabce") - .obj_type("doc") - .obj_token("doccnzAaOD******Wabcdef") - .apply(True) - .build()) \ - .build() + # 构造请求对象 + request: MoveDocsToWikiSpaceNodeRequest = MoveDocsToWikiSpaceNodeRequest.builder() \ + .space_id("1565676577122621") \ + .request_body(MoveDocsToWikiSpaceNodeRequestBody.builder() + .parent_wiki_token("wikcnKQ1k3p******8Vabce") + .obj_type("doc") + .obj_token("doccnzAaOD******Wabcdef") + .apply(True) + .build()) \ + .build() - # 发起请求 - response: MoveDocsToWikiSpaceNodeResponse = await client.wiki.v2.space_node.amove_docs_to_wiki(request) + # 发起请求 + response: MoveDocsToWikiSpaceNodeResponse = await client.wiki.v2.space_node.amove_docs_to_wiki(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.amove_docs_to_wiki failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.amove_docs_to_wiki failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/move_space_node_sample.py b/samples/api/wiki/v2/move_space_node_sample.py index c863d33b1..99d2b1ea3 100644 --- a/samples/api/wiki/v2/move_space_node_sample.py +++ b/samples/api/wiki/v2/move_space_node_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveSpaceNodeRequest = MoveSpaceNodeRequest.builder() \ - .space_id("7008061636015512345") \ - .node_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") \ - .request_body(MoveSpaceNodeRequestBody.builder() - .target_parent_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") - .target_space_id("7008061636015512345") - .build()) \ - .build() + # 构造请求对象 + request: MoveSpaceNodeRequest = MoveSpaceNodeRequest.builder() \ + .space_id("7008061636015512345") \ + .node_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") \ + .request_body(MoveSpaceNodeRequestBody.builder() + .target_parent_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") + .target_space_id("7008061636015512345") + .build()) \ + .build() - # 发起请求 - response: MoveSpaceNodeResponse = client.wiki.v2.space_node.move(request) + # 发起请求 + response: MoveSpaceNodeResponse = client.wiki.v2.space_node.move(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.move failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.move failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: MoveSpaceNodeRequest = MoveSpaceNodeRequest.builder() \ - .space_id("7008061636015512345") \ - .node_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") \ - .request_body(MoveSpaceNodeRequestBody.builder() - .target_parent_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") - .target_space_id("7008061636015512345") - .build()) \ - .build() + # 构造请求对象 + request: MoveSpaceNodeRequest = MoveSpaceNodeRequest.builder() \ + .space_id("7008061636015512345") \ + .node_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") \ + .request_body(MoveSpaceNodeRequestBody.builder() + .target_parent_token("wikbcd6ydSUyOEzbdlt1BfpA5Yc") + .target_space_id("7008061636015512345") + .build()) \ + .build() - # 发起请求 - response: MoveSpaceNodeResponse = await client.wiki.v2.space_node.amove(request) + # 发起请求 + response: MoveSpaceNodeResponse = await client.wiki.v2.space_node.amove(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.amove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.amove failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/update_space_setting_sample.py b/samples/api/wiki/v2/update_space_setting_sample.py index c198d6b13..19521504e 100644 --- a/samples/api/wiki/v2/update_space_setting_sample.py +++ b/samples/api/wiki/v2/update_space_setting_sample.py @@ -5,68 +5,68 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpaceSettingRequest = UpdateSpaceSettingRequest.builder() \ - .space_id("1565676577122621") \ - .request_body(Setting.builder() - .create_setting("admin") - .security_setting("allow") - .comment_setting("allow") - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpaceSettingRequest = UpdateSpaceSettingRequest.builder() \ + .space_id("1565676577122621") \ + .request_body(Setting.builder() + .create_setting("admin") + .security_setting("allow") + .comment_setting("allow") + .build()) \ + .build() - # 发起请求 - response: UpdateSpaceSettingResponse = client.wiki.v2.space_setting.update(request) + # 发起请求 + response: UpdateSpaceSettingResponse = client.wiki.v2.space_setting.update(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_setting.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_setting.update failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateSpaceSettingRequest = UpdateSpaceSettingRequest.builder() \ - .space_id("1565676577122621") \ - .request_body(Setting.builder() - .create_setting("admin") - .security_setting("allow") - .comment_setting("allow") - .build()) \ - .build() + # 构造请求对象 + request: UpdateSpaceSettingRequest = UpdateSpaceSettingRequest.builder() \ + .space_id("1565676577122621") \ + .request_body(Setting.builder() + .create_setting("admin") + .security_setting("allow") + .comment_setting("allow") + .build()) \ + .build() - # 发起请求 - response: UpdateSpaceSettingResponse = await client.wiki.v2.space_setting.aupdate(request) + # 发起请求 + response: UpdateSpaceSettingResponse = await client.wiki.v2.space_setting.aupdate(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_setting.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_setting.aupdate failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/wiki/v2/update_title_space_node_sample.py b/samples/api/wiki/v2/update_title_space_node_sample.py index 4aa27e902..21c6ead0d 100644 --- a/samples/api/wiki/v2/update_title_space_node_sample.py +++ b/samples/api/wiki/v2/update_title_space_node_sample.py @@ -5,66 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTitleSpaceNodeRequest = UpdateTitleSpaceNodeRequest.builder() \ - .space_id("6946843325487912356") \ - .node_token("wikcnKQ1k3pcuo5uSK4t8Vabcef") \ - .request_body(UpdateTitleSpaceNodeRequestBody.builder() - .title("新标题") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTitleSpaceNodeRequest = UpdateTitleSpaceNodeRequest.builder() \ + .space_id("6946843325487912356") \ + .node_token("wikcnKQ1k3pcuo5uSK4t8Vabcef") \ + .request_body(UpdateTitleSpaceNodeRequestBody.builder() + .title("新标题") + .build()) \ + .build() - # 发起请求 - response: UpdateTitleSpaceNodeResponse = client.wiki.v2.space_node.update_title(request) + # 发起请求 + response: UpdateTitleSpaceNodeResponse = client.wiki.v2.space_node.update_title(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.update_title failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.update_title failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: UpdateTitleSpaceNodeRequest = UpdateTitleSpaceNodeRequest.builder() \ - .space_id("6946843325487912356") \ - .node_token("wikcnKQ1k3pcuo5uSK4t8Vabcef") \ - .request_body(UpdateTitleSpaceNodeRequestBody.builder() - .title("新标题") - .build()) \ - .build() + # 构造请求对象 + request: UpdateTitleSpaceNodeRequest = UpdateTitleSpaceNodeRequest.builder() \ + .space_id("6946843325487912356") \ + .node_token("wikcnKQ1k3pcuo5uSK4t8Vabcef") \ + .request_body(UpdateTitleSpaceNodeRequestBody.builder() + .title("新标题") + .build()) \ + .build() - # 发起请求 - response: UpdateTitleSpaceNodeResponse = await client.wiki.v2.space_node.aupdate_title(request) + # 发起请求 + response: UpdateTitleSpaceNodeResponse = await client.wiki.v2.space_node.aupdate_title(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.wiki.v2.space_node.aupdate_title failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.wiki.v2.space_node.aupdate_title failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/workplace/v1/search_custom_workplace_access_data_sample.py b/samples/api/workplace/v1/search_custom_workplace_access_data_sample.py index f0e2cc08d..d41db61e5 100644 --- a/samples/api/workplace/v1/search_custom_workplace_access_data_sample.py +++ b/samples/api/workplace/v1/search_custom_workplace_access_data_sample.py @@ -5,67 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCustomWorkplaceAccessDataRequest = SearchCustomWorkplaceAccessDataRequest.builder() \ - .from_date("2023-03-01") \ - .to_date("2023-03-22") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .custom_workplace_id("tpl_647184b585400013254c4ea6") \ - .build() + # 构造请求对象 + request: SearchCustomWorkplaceAccessDataRequest = SearchCustomWorkplaceAccessDataRequest.builder() \ + .from_date("2023-03-01") \ + .to_date("2023-03-22") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .custom_workplace_id("tpl_647184b585400013254c4ea6") \ + .build() - # 发起请求 - response: SearchCustomWorkplaceAccessDataResponse = client.workplace.v1.custom_workplace_access_data.search(request) + # 发起请求 + response: SearchCustomWorkplaceAccessDataResponse = client.workplace.v1.custom_workplace_access_data.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.custom_workplace_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.custom_workplace_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchCustomWorkplaceAccessDataRequest = SearchCustomWorkplaceAccessDataRequest.builder() \ - .from_date("2023-03-01") \ - .to_date("2023-03-22") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .custom_workplace_id("tpl_647184b585400013254c4ea6") \ - .build() + # 构造请求对象 + request: SearchCustomWorkplaceAccessDataRequest = SearchCustomWorkplaceAccessDataRequest.builder() \ + .from_date("2023-03-01") \ + .to_date("2023-03-22") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .custom_workplace_id("tpl_647184b585400013254c4ea6") \ + .build() - # 发起请求 - response: SearchCustomWorkplaceAccessDataResponse = await client.workplace.v1.custom_workplace_access_data.asearch( - request) + # 发起请求 + response: SearchCustomWorkplaceAccessDataResponse = await client.workplace.v1.custom_workplace_access_data.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.custom_workplace_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.custom_workplace_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/workplace/v1/search_workplace_access_data_sample.py b/samples/api/workplace/v1/search_workplace_access_data_sample.py index a8607dc3c..cbebf9b03 100644 --- a/samples/api/workplace/v1/search_workplace_access_data_sample.py +++ b/samples/api/workplace/v1/search_workplace_access_data_sample.py @@ -5,64 +5,64 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWorkplaceAccessDataRequest = SearchWorkplaceAccessDataRequest.builder() \ - .from_date("2023-03-01") \ - .to_date("2023-03-22") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .build() + # 构造请求对象 + request: SearchWorkplaceAccessDataRequest = SearchWorkplaceAccessDataRequest.builder() \ + .from_date("2023-03-01") \ + .to_date("2023-03-22") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .build() - # 发起请求 - response: SearchWorkplaceAccessDataResponse = client.workplace.v1.workplace_access_data.search(request) + # 发起请求 + response: SearchWorkplaceAccessDataResponse = client.workplace.v1.workplace_access_data.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.workplace_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.workplace_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWorkplaceAccessDataRequest = SearchWorkplaceAccessDataRequest.builder() \ - .from_date("2023-03-01") \ - .to_date("2023-03-22") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .build() + # 构造请求对象 + request: SearchWorkplaceAccessDataRequest = SearchWorkplaceAccessDataRequest.builder() \ + .from_date("2023-03-01") \ + .to_date("2023-03-22") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .build() - # 发起请求 - response: SearchWorkplaceAccessDataResponse = await client.workplace.v1.workplace_access_data.asearch(request) + # 发起请求 + response: SearchWorkplaceAccessDataResponse = await client.workplace.v1.workplace_access_data.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.workplace_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.workplace_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main() diff --git a/samples/api/workplace/v1/search_workplace_block_access_data_sample.py b/samples/api/workplace/v1/search_workplace_block_access_data_sample.py index 3877c6b41..a79e85fa3 100644 --- a/samples/api/workplace/v1/search_workplace_block_access_data_sample.py +++ b/samples/api/workplace/v1/search_workplace_block_access_data_sample.py @@ -5,67 +5,66 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWorkplaceBlockAccessDataRequest = SearchWorkplaceBlockAccessDataRequest.builder() \ - .from_date("2023-02-01") \ - .to_date("2023-03-02") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .block_id("283438293839422334") \ - .build() + # 构造请求对象 + request: SearchWorkplaceBlockAccessDataRequest = SearchWorkplaceBlockAccessDataRequest.builder() \ + .from_date("2023-02-01") \ + .to_date("2023-03-02") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .block_id("283438293839422334") \ + .build() - # 发起请求 - response: SearchWorkplaceBlockAccessDataResponse = client.workplace.v1.workplace_block_access_data.search(request) + # 发起请求 + response: SearchWorkplaceBlockAccessDataResponse = client.workplace.v1.workplace_block_access_data.search(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.workplace_block_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.workplace_block_access_data.search failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建client + client = lark.Client.builder() \ + .app_id(lark.APP_ID) \ + .app_secret(lark.APP_SECRET) \ + .log_level(lark.LogLevel.DEBUG) \ + .build() - # 构造请求对象 - request: SearchWorkplaceBlockAccessDataRequest = SearchWorkplaceBlockAccessDataRequest.builder() \ - .from_date("2023-02-01") \ - .to_date("2023-03-02") \ - .page_size(20) \ - .page_token("ddowkdkl9w2d") \ - .block_id("283438293839422334") \ - .build() + # 构造请求对象 + request: SearchWorkplaceBlockAccessDataRequest = SearchWorkplaceBlockAccessDataRequest.builder() \ + .from_date("2023-02-01") \ + .to_date("2023-03-02") \ + .page_size(20) \ + .page_token("ddowkdkl9w2d") \ + .block_id("283438293839422334") \ + .build() - # 发起请求 - response: SearchWorkplaceBlockAccessDataResponse = await client.workplace.v1.workplace_block_access_data.asearch( - request) + # 发起请求 + response: SearchWorkplaceBlockAccessDataResponse = await client.workplace.v1.workplace_block_access_data.asearch(request) - # 处理失败返回 - if not response.success(): - lark.logger.error( - f"client.workplace.v1.workplace_block_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") - return + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.workplace.v1.workplace_block_access_data.asearch failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}") + return - # 处理业务结果 - lark.logger.info(lark.JSON.marshal(response.data, indent=4)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) if __name__ == "__main__": - # asyncio.run(amain()) 异步方式 - main() + # asyncio.run(amain()) 异步方式 + main()