diff --git a/lark_oapi/api/__init__.py b/lark_oapi/api/__init__.py index 3bebb8b53..63b6f430a 100644 --- a/lark_oapi/api/__init__.py +++ b/lark_oapi/api/__init__.py @@ -1,46 +1,47 @@ -from . import tenant -from . import translation -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 mdm -from . import attendance from . import bitable -from . import corehr -from . import personal_settings -from . import wiki -from . import vc -from . import acs +from . import drive from . import im -from . import lingo -from . import passport -from . import search +from . import moments +from . import report +from . import security_and_compliance from . import sheets -from . import aily -from . import baike -from . import optical_char_recognition +from . import admin +from . import wiki from . import speech_to_text -from . import workplace -from . import calendar from . import helpdesk +from . import lingo from . import mail -from . import board -from . import gray_test_open_sg -from . import human_authentication +from . import search +from . import task +from . import tenant +from . import application +from . import compensation +from . import authen +from . import attendance +from . import baike +from . import calendar from . import meeting_room +from . import personal_settings from . import verification -from . import admin +from . import acs +from . import document_ai +from . import okr +from . import translation +from . import board +from . import corehr +from . import optical_char_recognition +from . import passport +from . import contact +from . import approval from . import auth -from . import authen +from . import ehr +from . import human_authentication +from . import aily +from . import docx from . import event -from . import security_and_compliance -from . import application -from . import approval -from . import contact +from . import gray_test_open_sg +from . import hire +from . import mdm +from . import vc +from . import workplace +from . import block diff --git a/lark_oapi/api/application/v6/model/__init__.py b/lark_oapi/api/application/v6/model/__init__.py index b847787e6..75e5b93a2 100644 --- a/lark_oapi/api/application/v6/model/__init__.py +++ b/lark_oapi/api/application/v6/model/__init__.py @@ -106,6 +106,8 @@ from .check_white_black_list_application_visibility_request import * from .patch_application_visibility_request_body import * from .patch_application_visibility_request import * +from .apply_scope_request import * +from .list_scope_request import * from .set_app_badge_response import * from .list_app_recommend_rule_response_body import * from .list_app_recommend_rule_response import * @@ -137,6 +139,9 @@ from .check_white_black_list_application_visibility_response_body import * from .check_white_black_list_application_visibility_response import * from .patch_application_visibility_response import * +from .apply_scope_response import * +from .list_scope_response_body import * +from .list_scope_response import * from .p2_application_application_created_v6 import * from .p2_application_application_app_version_audit_v6 import * from .p2_application_application_app_version_publish_apply_v6 import * diff --git a/lark_oapi/api/application/v6/model/apply_scope_request.py b/lark_oapi/api/application/v6/model/apply_scope_request.py new file mode 100644 index 000000000..80b482e0f --- /dev/null +++ b/lark_oapi/api/application/v6/model/apply_scope_request.py @@ -0,0 +1,27 @@ +# 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 + + +class ApplyScopeRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + + @staticmethod + def builder() -> "ApplyScopeRequestBuilder": + return ApplyScopeRequestBuilder() + + +class ApplyScopeRequestBuilder(object): + + def __init__(self) -> None: + apply_scope_request = ApplyScopeRequest() + apply_scope_request.http_method = HttpMethod.POST + apply_scope_request.uri = "/open-apis/application/v6/scopes/apply" + apply_scope_request.token_types = {AccessTokenType.TENANT} + self._apply_scope_request: ApplyScopeRequest = apply_scope_request + + def build(self) -> ApplyScopeRequest: + return self._apply_scope_request diff --git a/lark_oapi/api/application/v6/model/apply_scope_response.py b/lark_oapi/api/application/v6/model/apply_scope_response.py new file mode 100644 index 000000000..177cdcb78 --- /dev/null +++ b/lark_oapi/api/application/v6/model/apply_scope_response.py @@ -0,0 +1,16 @@ +# 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 + + +class ApplyScopeResponse(BaseResponse): + _types = { + + } + + def __init__(self, d=None): + super().__init__(d) + + init(self, d, self._types) diff --git a/lark_oapi/api/application/v6/model/list_scope_request.py b/lark_oapi/api/application/v6/model/list_scope_request.py new file mode 100644 index 000000000..54285f065 --- /dev/null +++ b/lark_oapi/api/application/v6/model/list_scope_request.py @@ -0,0 +1,27 @@ +# 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 + + +class ListScopeRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + + @staticmethod + def builder() -> "ListScopeRequestBuilder": + return ListScopeRequestBuilder() + + +class ListScopeRequestBuilder(object): + + def __init__(self) -> None: + list_scope_request = ListScopeRequest() + list_scope_request.http_method = HttpMethod.GET + list_scope_request.uri = "/open-apis/application/v6/scopes" + list_scope_request.token_types = {AccessTokenType.TENANT} + self._list_scope_request: ListScopeRequest = list_scope_request + + def build(self) -> ListScopeRequest: + return self._list_scope_request diff --git a/lark_oapi/api/application/v6/model/list_scope_response.py b/lark_oapi/api/application/v6/model/list_scope_response.py new file mode 100644 index 000000000..6979ed269 --- /dev/null +++ b/lark_oapi/api/application/v6/model/list_scope_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 .list_scope_response_body import ListScopeResponseBody + + +class ListScopeResponse(BaseResponse): + _types = { + "data": ListScopeResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[ListScopeResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/application/v6/model/list_scope_response_body.py b/lark_oapi/api/application/v6/model/list_scope_response_body.py new file mode 100644 index 000000000..f83c34b03 --- /dev/null +++ b/lark_oapi/api/application/v6/model/list_scope_response_body.py @@ -0,0 +1,31 @@ +# 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 .scope import Scope + + +class ListScopeResponseBody(object): + _types = { + "scopes": List[Scope], + } + + def __init__(self, d=None): + self.scopes: Optional[List[Scope]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ListScopeResponseBodyBuilder": + return ListScopeResponseBodyBuilder() + + +class ListScopeResponseBodyBuilder(object): + def __init__(self) -> None: + self._list_scope_response_body = ListScopeResponseBody() + + def scopes(self, scopes: List[Scope]) -> "ListScopeResponseBodyBuilder": + self._list_scope_response_body.scopes = scopes + return self + + def build(self) -> "ListScopeResponseBody": + return self._list_scope_response_body diff --git a/lark_oapi/api/application/v6/model/scope.py b/lark_oapi/api/application/v6/model/scope.py index 2471ed0a9..091e6507f 100644 --- a/lark_oapi/api/application/v6/model/scope.py +++ b/lark_oapi/api/application/v6/model/scope.py @@ -8,11 +8,13 @@ class Scope(object): _types = { "scope_name": str, "grant_status": int, + "scope_type": str, } def __init__(self, d=None): self.scope_name: Optional[str] = None self.grant_status: Optional[int] = None + self.scope_type: Optional[str] = None init(self, d, self._types) @staticmethod @@ -32,5 +34,9 @@ def grant_status(self, grant_status: int) -> "ScopeBuilder": self._scope.grant_status = grant_status return self + def scope_type(self, scope_type: str) -> "ScopeBuilder": + self._scope.scope_type = scope_type + return self + def build(self) -> "Scope": return self._scope diff --git a/lark_oapi/api/application/v6/resource/__init__.py b/lark_oapi/api/application/v6/resource/__init__.py index 6a875786e..625e4cb08 100644 --- a/lark_oapi/api/application/v6/resource/__init__.py +++ b/lark_oapi/api/application/v6/resource/__init__.py @@ -8,3 +8,4 @@ from .application_management import * from .application_visibility import * from .bot import * +from .scope import * diff --git a/lark_oapi/api/application/v6/resource/scope.py b/lark_oapi/api/application/v6/resource/scope.py new file mode 100644 index 000000000..74fcc8a0c --- /dev/null +++ b/lark_oapi/api/application/v6/resource/scope.py @@ -0,0 +1,92 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.apply_scope_request import ApplyScopeRequest +from ..model.apply_scope_response import ApplyScopeResponse +from ..model.list_scope_request import ListScopeRequest +from ..model.list_scope_response import ListScopeResponse + + +class Scope(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def apply(self, request: ApplyScopeRequest, option: Optional[RequestOption] = None) -> ApplyScopeResponse: + 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: ApplyScopeResponse = JSON.unmarshal(str(resp.content, UTF_8), ApplyScopeResponse) + response.raw = resp + + return response + + async def aapply(self, request: ApplyScopeRequest, option: Optional[RequestOption] = None) -> ApplyScopeResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: ApplyScopeResponse = JSON.unmarshal(str(resp.content, UTF_8), ApplyScopeResponse) + response.raw = resp + + return response + + def list(self, request: ListScopeRequest, option: Optional[RequestOption] = None) -> ListScopeResponse: + 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: ListScopeResponse = JSON.unmarshal(str(resp.content, UTF_8), ListScopeResponse) + response.raw = resp + + return response + + async def alist(self, request: ListScopeRequest, option: Optional[RequestOption] = None) -> ListScopeResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: ListScopeResponse = JSON.unmarshal(str(resp.content, UTF_8), ListScopeResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/application/v6/version.py b/lark_oapi/api/application/v6/version.py index 735eac571..60a6ab9a9 100644 --- a/lark_oapi/api/application/v6/version.py +++ b/lark_oapi/api/application/v6/version.py @@ -13,3 +13,4 @@ def __init__(self, config: Config) -> None: self.application_management: ApplicationManagement = ApplicationManagement(config) self.application_visibility: ApplicationVisibility = ApplicationVisibility(config) self.bot: Bot = Bot(config) + self.scope: Scope = Scope(config) diff --git a/lark_oapi/api/attendance/v1/model/create_shift_request.py b/lark_oapi/api/attendance/v1/model/create_shift_request.py index 636042ead..c2ae78479 100644 --- a/lark_oapi/api/attendance/v1/model/create_shift_request.py +++ b/lark_oapi/api/attendance/v1/model/create_shift_request.py @@ -9,6 +9,7 @@ class CreateShiftRequest(BaseRequest): def __init__(self) -> None: super().__init__() + self.employee_type: Optional[str] = None self.request_body: Optional[Shift] = None @staticmethod @@ -25,6 +26,11 @@ def __init__(self) -> None: create_shift_request.token_types = {AccessTokenType.TENANT} self._create_shift_request: CreateShiftRequest = create_shift_request + def employee_type(self, employee_type: str) -> "CreateShiftRequestBuilder": + self._create_shift_request.employee_type = employee_type + self._create_shift_request.add_query("employee_type", employee_type) + return self + def request_body(self, request_body: Shift) -> "CreateShiftRequestBuilder": self._create_shift_request.request_body = request_body self._create_shift_request.body = request_body diff --git a/lark_oapi/api/attendance/v1/model/user_daily_shift.py b/lark_oapi/api/attendance/v1/model/user_daily_shift.py index b0c193634..4ba8d1461 100644 --- a/lark_oapi/api/attendance/v1/model/user_daily_shift.py +++ b/lark_oapi/api/attendance/v1/model/user_daily_shift.py @@ -11,6 +11,7 @@ class UserDailyShift(object): "month": int, "user_id": str, "day_no": int, + "is_clear_schedule": bool, } def __init__(self, d=None): @@ -19,6 +20,7 @@ def __init__(self, d=None): self.month: Optional[int] = None self.user_id: Optional[str] = None self.day_no: Optional[int] = None + self.is_clear_schedule: Optional[bool] = None init(self, d, self._types) @staticmethod @@ -50,5 +52,9 @@ def day_no(self, day_no: int) -> "UserDailyShiftBuilder": self._user_daily_shift.day_no = day_no return self + def is_clear_schedule(self, is_clear_schedule: bool) -> "UserDailyShiftBuilder": + self._user_daily_shift.is_clear_schedule = is_clear_schedule + return self + def build(self) -> "UserDailyShift": return self._user_daily_shift diff --git a/lark_oapi/api/bitable/v1/model/app_table_record.py b/lark_oapi/api/bitable/v1/model/app_table_record.py index 91a09d46e..25f66524d 100644 --- a/lark_oapi/api/bitable/v1/model/app_table_record.py +++ b/lark_oapi/api/bitable/v1/model/app_table_record.py @@ -14,6 +14,7 @@ class AppTableRecord(object): "created_time": int, "last_modified_by": Person, "last_modified_time": int, + "shared_url": str, "record_url": str, } @@ -24,6 +25,7 @@ def __init__(self, d=None): self.created_time: Optional[int] = None self.last_modified_by: Optional[Person] = None self.last_modified_time: Optional[int] = None + self.shared_url: Optional[str] = None self.record_url: Optional[str] = None init(self, d, self._types) @@ -60,6 +62,10 @@ def last_modified_time(self, last_modified_time: int) -> "AppTableRecordBuilder" self._app_table_record.last_modified_time = last_modified_time return self + def shared_url(self, shared_url: str) -> "AppTableRecordBuilder": + self._app_table_record.shared_url = shared_url + return self + def record_url(self, record_url: str) -> "AppTableRecordBuilder": self._app_table_record.record_url = record_url return self diff --git a/lark_oapi/api/corehr/v1/model/__init__.py b/lark_oapi/api/corehr/v1/model/__init__.py index ae35518ef..a045745c0 100644 --- a/lark_oapi/api/corehr/v1/model/__init__.py +++ b/lark_oapi/api/corehr/v1/model/__init__.py @@ -216,6 +216,7 @@ from .get_job_level_request import * from .list_job_level_request import * from .patch_job_level_request import * +from .calendar_by_scope_leave_request import * from .leave_balances_leave_request import * from .leave_request_history_leave_request import * from .leave_types_leave_request import * @@ -376,6 +377,8 @@ from .list_job_level_response import * from .patch_job_level_response_body import * from .patch_job_level_response import * +from .calendar_by_scope_leave_response_body import * +from .calendar_by_scope_leave_response import * from .leave_balances_leave_response_body import * from .leave_balances_leave_response import * from .leave_request_history_leave_response_body import * @@ -466,7 +469,10 @@ from .p2_corehr_job_updated_v1 import * from .p2_corehr_job_change_updated_v1 import * from .p2_corehr_job_data_changed_v1 import * +from .p2_corehr_job_data_created_v1 import * +from .p2_corehr_job_data_deleted_v1 import * from .p2_corehr_job_data_employed_v1 import * +from .p2_corehr_job_data_updated_v1 import * from .p2_corehr_offboarding_updated_v1 import * from .p2_corehr_org_role_authorization_updated_v1 import * from .p2_corehr_person_created_v1 import * diff --git a/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_request.py b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_request.py new file mode 100644 index 000000000..c43c7a955 --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_request.py @@ -0,0 +1,69 @@ +# 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 + + +class CalendarByScopeLeaveRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.wk_department_id: Optional[str] = None + self.wk_country_region_id: Optional[str] = None + self.wk_employee_type_id: Optional[str] = None + self.wk_work_location_id: Optional[str] = None + self.wk_working_hours_type_id: Optional[str] = None + self.wk_job_family_id: Optional[str] = None + self.wk_company_id: Optional[str] = None + + @staticmethod + def builder() -> "CalendarByScopeLeaveRequestBuilder": + return CalendarByScopeLeaveRequestBuilder() + + +class CalendarByScopeLeaveRequestBuilder(object): + + def __init__(self) -> None: + calendar_by_scope_leave_request = CalendarByScopeLeaveRequest() + calendar_by_scope_leave_request.http_method = HttpMethod.GET + calendar_by_scope_leave_request.uri = "/open-apis/corehr/v1/leaves/calendar_by_scope" + calendar_by_scope_leave_request.token_types = {AccessTokenType.TENANT, AccessTokenType.USER} + self._calendar_by_scope_leave_request: CalendarByScopeLeaveRequest = calendar_by_scope_leave_request + + def wk_department_id(self, wk_department_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_department_id = wk_department_id + self._calendar_by_scope_leave_request.add_query("wk_department_id", wk_department_id) + return self + + def wk_country_region_id(self, wk_country_region_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_country_region_id = wk_country_region_id + self._calendar_by_scope_leave_request.add_query("wk_country_region_id", wk_country_region_id) + return self + + def wk_employee_type_id(self, wk_employee_type_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_employee_type_id = wk_employee_type_id + self._calendar_by_scope_leave_request.add_query("wk_employee_type_id", wk_employee_type_id) + return self + + def wk_work_location_id(self, wk_work_location_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_work_location_id = wk_work_location_id + self._calendar_by_scope_leave_request.add_query("wk_work_location_id", wk_work_location_id) + return self + + def wk_working_hours_type_id(self, wk_working_hours_type_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_working_hours_type_id = wk_working_hours_type_id + self._calendar_by_scope_leave_request.add_query("wk_working_hours_type_id", wk_working_hours_type_id) + return self + + def wk_job_family_id(self, wk_job_family_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_job_family_id = wk_job_family_id + self._calendar_by_scope_leave_request.add_query("wk_job_family_id", wk_job_family_id) + return self + + def wk_company_id(self, wk_company_id: str) -> "CalendarByScopeLeaveRequestBuilder": + self._calendar_by_scope_leave_request.wk_company_id = wk_company_id + self._calendar_by_scope_leave_request.add_query("wk_company_id", wk_company_id) + return self + + def build(self) -> CalendarByScopeLeaveRequest: + return self._calendar_by_scope_leave_request diff --git a/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_response.py b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_response.py new file mode 100644 index 000000000..4c2026f7d --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_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 .calendar_by_scope_leave_response_body import CalendarByScopeLeaveResponseBody + + +class CalendarByScopeLeaveResponse(BaseResponse): + _types = { + "data": CalendarByScopeLeaveResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[CalendarByScopeLeaveResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_response_body.py b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_response_body.py new file mode 100644 index 000000000..a92f3db29 --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/calendar_by_scope_leave_response_body.py @@ -0,0 +1,30 @@ +# 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 CalendarByScopeLeaveResponseBody(object): + _types = { + "calendar_wk_id": str, + } + + def __init__(self, d=None): + self.calendar_wk_id: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "CalendarByScopeLeaveResponseBodyBuilder": + return CalendarByScopeLeaveResponseBodyBuilder() + + +class CalendarByScopeLeaveResponseBodyBuilder(object): + def __init__(self) -> None: + self._calendar_by_scope_leave_response_body = CalendarByScopeLeaveResponseBody() + + def calendar_wk_id(self, calendar_wk_id: str) -> "CalendarByScopeLeaveResponseBodyBuilder": + self._calendar_by_scope_leave_response_body.calendar_wk_id = calendar_wk_id + return self + + def build(self) -> "CalendarByScopeLeaveResponseBody": + return self._calendar_by_scope_leave_response_body diff --git a/lark_oapi/api/corehr/v1/model/delete_job_data_request.py b/lark_oapi/api/corehr/v1/model/delete_job_data_request.py index 35e54c9cf..ff4dca7cf 100644 --- a/lark_oapi/api/corehr/v1/model/delete_job_data_request.py +++ b/lark_oapi/api/corehr/v1/model/delete_job_data_request.py @@ -8,6 +8,7 @@ class DeleteJobDataRequest(BaseRequest): def __init__(self) -> None: super().__init__() + self.version_id: Optional[str] = None self.job_data_id: Optional[str] = None @staticmethod @@ -24,6 +25,11 @@ def __init__(self) -> None: delete_job_data_request.token_types = {AccessTokenType.TENANT} self._delete_job_data_request: DeleteJobDataRequest = delete_job_data_request + def version_id(self, version_id: str) -> "DeleteJobDataRequestBuilder": + self._delete_job_data_request.version_id = version_id + self._delete_job_data_request.add_query("version_id", version_id) + return self + def job_data_id(self, job_data_id: str) -> "DeleteJobDataRequestBuilder": self._delete_job_data_request.job_data_id = job_data_id self._delete_job_data_request.paths["job_data_id"] = str(job_data_id) diff --git a/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_created_v1.py b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_created_v1.py new file mode 100644 index 000000000..37c258135 --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_created_v1.py @@ -0,0 +1,27 @@ +# 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.event.context import EventContext + + +class P2CorehrJobDataCreatedV1Data(object): + _types = { + "job_data_id": str, + } + + def __init__(self, d=None): + self.job_data_id: Optional[str] = None + init(self, d, self._types) + + +class P2CorehrJobDataCreatedV1(EventContext): + _types = { + "event": P2CorehrJobDataCreatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2CorehrJobDataCreatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_deleted_v1.py b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_deleted_v1.py new file mode 100644 index 000000000..c68d01a09 --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_deleted_v1.py @@ -0,0 +1,27 @@ +# 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.event.context import EventContext + + +class P2CorehrJobDataDeletedV1Data(object): + _types = { + "job_data_id": str, + } + + def __init__(self, d=None): + self.job_data_id: Optional[str] = None + init(self, d, self._types) + + +class P2CorehrJobDataDeletedV1(EventContext): + _types = { + "event": P2CorehrJobDataDeletedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2CorehrJobDataDeletedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_updated_v1.py b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_updated_v1.py new file mode 100644 index 000000000..e3408782a --- /dev/null +++ b/lark_oapi/api/corehr/v1/model/p2_corehr_job_data_updated_v1.py @@ -0,0 +1,27 @@ +# 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.event.context import EventContext + + +class P2CorehrJobDataUpdatedV1Data(object): + _types = { + "job_data_id": str, + } + + def __init__(self, d=None): + self.job_data_id: Optional[str] = None + init(self, d, self._types) + + +class P2CorehrJobDataUpdatedV1(EventContext): + _types = { + "event": P2CorehrJobDataUpdatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2CorehrJobDataUpdatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v1/processor.py b/lark_oapi/api/corehr/v1/processor.py index 97a90823d..6eaca678c 100644 --- a/lark_oapi/api/corehr/v1/processor.py +++ b/lark_oapi/api/corehr/v1/processor.py @@ -19,7 +19,10 @@ from .model.p2_corehr_job_updated_v1 import P2CorehrJobUpdatedV1 from .model.p2_corehr_job_change_updated_v1 import P2CorehrJobChangeUpdatedV1 from .model.p2_corehr_job_data_changed_v1 import P2CorehrJobDataChangedV1 +from .model.p2_corehr_job_data_created_v1 import P2CorehrJobDataCreatedV1 +from .model.p2_corehr_job_data_deleted_v1 import P2CorehrJobDataDeletedV1 from .model.p2_corehr_job_data_employed_v1 import P2CorehrJobDataEmployedV1 +from .model.p2_corehr_job_data_updated_v1 import P2CorehrJobDataUpdatedV1 from .model.p2_corehr_offboarding_updated_v1 import P2CorehrOffboardingUpdatedV1 from .model.p2_corehr_org_role_authorization_updated_v1 import P2CorehrOrgRoleAuthorizationUpdatedV1 from .model.p2_corehr_person_created_v1 import P2CorehrPersonCreatedV1 @@ -204,6 +207,28 @@ def do(self, data: P2CorehrJobDataChangedV1) -> None: self.f(data) +class P2CorehrJobDataCreatedV1Processor(IEventProcessor[P2CorehrJobDataCreatedV1]): + def __init__(self, f: Callable[[P2CorehrJobDataCreatedV1], None]): + self.f = f + + def type(self) -> Type[P2CorehrJobDataCreatedV1]: + return P2CorehrJobDataCreatedV1 + + def do(self, data: P2CorehrJobDataCreatedV1) -> None: + self.f(data) + + +class P2CorehrJobDataDeletedV1Processor(IEventProcessor[P2CorehrJobDataDeletedV1]): + def __init__(self, f: Callable[[P2CorehrJobDataDeletedV1], None]): + self.f = f + + def type(self) -> Type[P2CorehrJobDataDeletedV1]: + return P2CorehrJobDataDeletedV1 + + def do(self, data: P2CorehrJobDataDeletedV1) -> None: + self.f(data) + + class P2CorehrJobDataEmployedV1Processor(IEventProcessor[P2CorehrJobDataEmployedV1]): def __init__(self, f: Callable[[P2CorehrJobDataEmployedV1], None]): self.f = f @@ -215,6 +240,17 @@ def do(self, data: P2CorehrJobDataEmployedV1) -> None: self.f(data) +class P2CorehrJobDataUpdatedV1Processor(IEventProcessor[P2CorehrJobDataUpdatedV1]): + def __init__(self, f: Callable[[P2CorehrJobDataUpdatedV1], None]): + self.f = f + + def type(self) -> Type[P2CorehrJobDataUpdatedV1]: + return P2CorehrJobDataUpdatedV1 + + def do(self, data: P2CorehrJobDataUpdatedV1) -> None: + self.f(data) + + class P2CorehrOffboardingUpdatedV1Processor(IEventProcessor[P2CorehrOffboardingUpdatedV1]): def __init__(self, f: Callable[[P2CorehrOffboardingUpdatedV1], None]): self.f = f diff --git a/lark_oapi/api/corehr/v1/resource/leave.py b/lark_oapi/api/corehr/v1/resource/leave.py index b029f7614..9e58c524c 100644 --- a/lark_oapi/api/corehr/v1/resource/leave.py +++ b/lark_oapi/api/corehr/v1/resource/leave.py @@ -9,6 +9,8 @@ from lark_oapi.core.model import Config, RequestOption, RawResponse from lark_oapi.core.utils import Files from requests_toolbelt import MultipartEncoder +from ..model.calendar_by_scope_leave_request import CalendarByScopeLeaveRequest +from ..model.calendar_by_scope_leave_response import CalendarByScopeLeaveResponse from ..model.leave_balances_leave_request import LeaveBalancesLeaveRequest from ..model.leave_balances_leave_response import LeaveBalancesLeaveResponse from ..model.leave_request_history_leave_request import LeaveRequestHistoryLeaveRequest @@ -21,6 +23,44 @@ class Leave(object): def __init__(self, config: Config) -> None: self.config: Config = config + def calendar_by_scope(self, request: CalendarByScopeLeaveRequest, + option: Optional[RequestOption] = None) -> CalendarByScopeLeaveResponse: + 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: CalendarByScopeLeaveResponse = JSON.unmarshal(str(resp.content, UTF_8), CalendarByScopeLeaveResponse) + response.raw = resp + + return response + + async def acalendar_by_scope(self, request: CalendarByScopeLeaveRequest, + option: Optional[RequestOption] = None) -> CalendarByScopeLeaveResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: CalendarByScopeLeaveResponse = JSON.unmarshal(str(resp.content, UTF_8), CalendarByScopeLeaveResponse) + response.raw = resp + + return response + def leave_balances(self, request: LeaveBalancesLeaveRequest, option: Optional[RequestOption] = None) -> LeaveBalancesLeaveResponse: if option is None: diff --git a/lark_oapi/api/corehr/v2/model/__init__.py b/lark_oapi/api/corehr/v2/model/__init__.py index 875f97685..262a17510 100644 --- a/lark_oapi/api/corehr/v2/model/__init__.py +++ b/lark_oapi/api/corehr/v2/model/__init__.py @@ -294,8 +294,10 @@ from .patch_cost_center_version_request import * from .batch_get_department_request_body import * from .batch_get_department_request import * +from .delete_department_request import * from .parents_department_request_body import * from .parents_department_request import * +from .patch_department_request import * from .query_multi_timeline_department_request_body import * from .query_multi_timeline_department_request import * from .query_timeline_department_request_body import * @@ -394,8 +396,10 @@ from .patch_cost_center_version_response import * from .batch_get_department_response_body import * from .batch_get_department_response import * +from .delete_department_response import * from .parents_department_response_body import * from .parents_department_response import * +from .patch_department_response import * from .query_multi_timeline_department_response_body import * from .query_multi_timeline_department_response import * from .query_timeline_department_response_body import * @@ -466,6 +470,7 @@ from .get_process_form_variable_data_response_body import * from .get_process_form_variable_data_response import * from .p2_corehr_employee_domain_event_v2 import * +from .p2_corehr_job_change_status_updated_v2 import * from .p2_corehr_job_change_updated_v2 import * from .p2_corehr_offboarding_checklist_updated_v2 import * from .p2_corehr_offboarding_status_updated_v2 import * diff --git a/lark_oapi/api/corehr/v2/model/basic_department.py b/lark_oapi/api/corehr/v2/model/basic_department.py index 68a5117cc..06c27b9b8 100644 --- a/lark_oapi/api/corehr/v2/model/basic_department.py +++ b/lark_oapi/api/corehr/v2/model/basic_department.py @@ -8,11 +8,13 @@ class BasicDepartment(object): _types = { "id": str, + "id_v2": str, "department_name": List[I18n], } def __init__(self, d=None): self.id: Optional[str] = None + self.id_v2: Optional[str] = None self.department_name: Optional[List[I18n]] = None init(self, d, self._types) @@ -29,6 +31,10 @@ def id(self, id: str) -> "BasicDepartmentBuilder": self._basic_department.id = id return self + def id_v2(self, id_v2: str) -> "BasicDepartmentBuilder": + self._basic_department.id_v2 = id_v2 + return self + def department_name(self, department_name: List[I18n]) -> "BasicDepartmentBuilder": self._basic_department.department_name = department_name return self diff --git a/lark_oapi/api/corehr/v2/model/basic_employee.py b/lark_oapi/api/corehr/v2/model/basic_employee.py index 3c810f110..6fd5cbee7 100644 --- a/lark_oapi/api/corehr/v2/model/basic_employee.py +++ b/lark_oapi/api/corehr/v2/model/basic_employee.py @@ -8,6 +8,7 @@ class BasicEmployee(object): _types = { "employment_id": str, + "employment_id_v2": str, "employee_number": str, "email_address": str, "person_info": BasicPersonInfo, @@ -15,6 +16,7 @@ class BasicEmployee(object): def __init__(self, d=None): self.employment_id: Optional[str] = None + self.employment_id_v2: Optional[str] = None self.employee_number: Optional[str] = None self.email_address: Optional[str] = None self.person_info: Optional[BasicPersonInfo] = None @@ -33,6 +35,10 @@ def employment_id(self, employment_id: str) -> "BasicEmployeeBuilder": self._basic_employee.employment_id = employment_id return self + def employment_id_v2(self, employment_id_v2: str) -> "BasicEmployeeBuilder": + self._basic_employee.employment_id_v2 = employment_id_v2 + return self + def employee_number(self, employee_number: str) -> "BasicEmployeeBuilder": self._basic_employee.employee_number = employee_number return self diff --git a/lark_oapi/api/corehr/v2/model/custom_org.py b/lark_oapi/api/corehr/v2/model/custom_org.py index 9534e25f9..165d224bc 100644 --- a/lark_oapi/api/corehr/v2/model/custom_org.py +++ b/lark_oapi/api/corehr/v2/model/custom_org.py @@ -6,6 +6,7 @@ from .i18n import I18n from .org_role import OrgRole from .match_rules import MatchRules +from .custom_field_data import CustomFieldData class CustomOrg(object): @@ -21,6 +22,7 @@ class CustomOrg(object): "match_rule_groups": List[MatchRules], "active": bool, "org_id": str, + "custom_fields": List[CustomFieldData], } def __init__(self, d=None): @@ -35,6 +37,7 @@ def __init__(self, d=None): self.match_rule_groups: Optional[List[MatchRules]] = None self.active: Optional[bool] = None self.org_id: Optional[str] = None + self.custom_fields: Optional[List[CustomFieldData]] = None init(self, d, self._types) @staticmethod @@ -90,5 +93,9 @@ def org_id(self, org_id: str) -> "CustomOrgBuilder": self._custom_org.org_id = org_id return self + def custom_fields(self, custom_fields: List[CustomFieldData]) -> "CustomOrgBuilder": + self._custom_org.custom_fields = custom_fields + return self + def build(self) -> "CustomOrg": return self._custom_org diff --git a/lark_oapi/api/corehr/v2/model/custom_org_create.py b/lark_oapi/api/corehr/v2/model/custom_org_create.py index 61d56e846..f34da3499 100644 --- a/lark_oapi/api/corehr/v2/model/custom_org_create.py +++ b/lark_oapi/api/corehr/v2/model/custom_org_create.py @@ -6,6 +6,7 @@ from .i18n import I18n from .org_role_update import OrgRoleUpdate from .match_rules import MatchRules +from .custom_field_data import CustomFieldData class CustomOrgCreate(object): @@ -19,6 +20,7 @@ class CustomOrgCreate(object): "effective_time": str, "org_roles": List[OrgRoleUpdate], "match_rule_groups": List[MatchRules], + "custom_fields": List[CustomFieldData], } def __init__(self, d=None): @@ -31,6 +33,7 @@ def __init__(self, d=None): self.effective_time: Optional[str] = None self.org_roles: Optional[List[OrgRoleUpdate]] = None self.match_rule_groups: Optional[List[MatchRules]] = None + self.custom_fields: Optional[List[CustomFieldData]] = None init(self, d, self._types) @staticmethod @@ -78,5 +81,9 @@ def match_rule_groups(self, match_rule_groups: List[MatchRules]) -> "CustomOrgCr self._custom_org_create.match_rule_groups = match_rule_groups return self + def custom_fields(self, custom_fields: List[CustomFieldData]) -> "CustomOrgCreateBuilder": + self._custom_org_create.custom_fields = custom_fields + return self + def build(self) -> "CustomOrgCreate": return self._custom_org_create diff --git a/lark_oapi/api/corehr/v2/model/custom_org_update.py b/lark_oapi/api/corehr/v2/model/custom_org_update.py index 5e5bbeb2d..e41bf4837 100644 --- a/lark_oapi/api/corehr/v2/model/custom_org_update.py +++ b/lark_oapi/api/corehr/v2/model/custom_org_update.py @@ -5,6 +5,7 @@ from .i18n import I18n from .i18n import I18n from .org_role_update import OrgRoleUpdate +from .custom_field_data import CustomFieldData class CustomOrgUpdate(object): @@ -17,6 +18,7 @@ class CustomOrgUpdate(object): "description": List[I18n], "effective_time": str, "org_roles": List[OrgRoleUpdate], + "custom_fields": List[CustomFieldData], } def __init__(self, d=None): @@ -28,6 +30,7 @@ def __init__(self, d=None): self.description: Optional[List[I18n]] = None self.effective_time: Optional[str] = None self.org_roles: Optional[List[OrgRoleUpdate]] = None + self.custom_fields: Optional[List[CustomFieldData]] = None init(self, d, self._types) @staticmethod @@ -71,5 +74,9 @@ def org_roles(self, org_roles: List[OrgRoleUpdate]) -> "CustomOrgUpdateBuilder": self._custom_org_update.org_roles = org_roles return self + def custom_fields(self, custom_fields: List[CustomFieldData]) -> "CustomOrgUpdateBuilder": + self._custom_org_update.custom_fields = custom_fields + return self + def build(self) -> "CustomOrgUpdate": return self._custom_org_update diff --git a/lark_oapi/api/corehr/v2/model/delete_department_request.py b/lark_oapi/api/corehr/v2/model/delete_department_request.py new file mode 100644 index 000000000..4ea5e1e5e --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/delete_department_request.py @@ -0,0 +1,39 @@ +# 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 + + +class DeleteDepartmentRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.department_id_type: Optional[str] = None + self.department_id: Optional[str] = None + + @staticmethod + def builder() -> "DeleteDepartmentRequestBuilder": + return DeleteDepartmentRequestBuilder() + + +class DeleteDepartmentRequestBuilder(object): + + def __init__(self) -> None: + delete_department_request = DeleteDepartmentRequest() + delete_department_request.http_method = HttpMethod.DELETE + delete_department_request.uri = "/open-apis/corehr/v2/departments/:department_id" + delete_department_request.token_types = {AccessTokenType.TENANT} + self._delete_department_request: DeleteDepartmentRequest = delete_department_request + + def department_id_type(self, department_id_type: str) -> "DeleteDepartmentRequestBuilder": + self._delete_department_request.department_id_type = department_id_type + self._delete_department_request.add_query("department_id_type", department_id_type) + return self + + def department_id(self, department_id: str) -> "DeleteDepartmentRequestBuilder": + self._delete_department_request.department_id = department_id + self._delete_department_request.paths["department_id"] = str(department_id) + return self + + def build(self) -> DeleteDepartmentRequest: + return self._delete_department_request diff --git a/lark_oapi/api/corehr/v2/model/delete_department_response.py b/lark_oapi/api/corehr/v2/model/delete_department_response.py new file mode 100644 index 000000000..c9d92f778 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/delete_department_response.py @@ -0,0 +1,16 @@ +# 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 + + +class DeleteDepartmentResponse(BaseResponse): + _types = { + + } + + def __init__(self, d=None): + super().__init__(d) + + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v2/model/employee.py b/lark_oapi/api/corehr/v2/model/employee.py index a3348bf37..739c204ef 100644 --- a/lark_oapi/api/corehr/v2/model/employee.py +++ b/lark_oapi/api/corehr/v2/model/employee.py @@ -27,11 +27,13 @@ class Employee(object): _types = { "employment_id": str, + "employment_id_v2": str, "ats_application_id": str, "prehire_id": str, "employee_number": str, "employee_type_id": str, "department_id": str, + "department_id_v2": str, "job_level_id": str, "job_level": EmployeeJobLevel, "job_grade_id": str, @@ -53,6 +55,8 @@ class Employee(object): "probation_end_date": str, "direct_manager_id": str, "dotted_line_manager_id": str, + "direct_manager_id_v2": str, + "dotted_line_manager_id_v2": str, "employment_type": Enum, "employment_status": Enum, "expiration_date": str, @@ -90,11 +94,13 @@ class Employee(object): def __init__(self, d=None): self.employment_id: Optional[str] = None + self.employment_id_v2: Optional[str] = None self.ats_application_id: Optional[str] = None self.prehire_id: Optional[str] = None self.employee_number: Optional[str] = None self.employee_type_id: Optional[str] = None self.department_id: Optional[str] = None + self.department_id_v2: Optional[str] = None self.job_level_id: Optional[str] = None self.job_level: Optional[EmployeeJobLevel] = None self.job_grade_id: Optional[str] = None @@ -116,6 +122,8 @@ def __init__(self, d=None): self.probation_end_date: Optional[str] = None self.direct_manager_id: Optional[str] = None self.dotted_line_manager_id: Optional[str] = None + self.direct_manager_id_v2: Optional[str] = None + self.dotted_line_manager_id_v2: Optional[str] = None self.employment_type: Optional[Enum] = None self.employment_status: Optional[Enum] = None self.expiration_date: Optional[str] = None @@ -164,6 +172,10 @@ def employment_id(self, employment_id: str) -> "EmployeeBuilder": self._employee.employment_id = employment_id return self + def employment_id_v2(self, employment_id_v2: str) -> "EmployeeBuilder": + self._employee.employment_id_v2 = employment_id_v2 + return self + def ats_application_id(self, ats_application_id: str) -> "EmployeeBuilder": self._employee.ats_application_id = ats_application_id return self @@ -184,6 +196,10 @@ def department_id(self, department_id: str) -> "EmployeeBuilder": self._employee.department_id = department_id return self + def department_id_v2(self, department_id_v2: str) -> "EmployeeBuilder": + self._employee.department_id_v2 = department_id_v2 + return self + def job_level_id(self, job_level_id: str) -> "EmployeeBuilder": self._employee.job_level_id = job_level_id return self @@ -268,6 +284,14 @@ def dotted_line_manager_id(self, dotted_line_manager_id: str) -> "EmployeeBuilde self._employee.dotted_line_manager_id = dotted_line_manager_id return self + def direct_manager_id_v2(self, direct_manager_id_v2: str) -> "EmployeeBuilder": + self._employee.direct_manager_id_v2 = direct_manager_id_v2 + return self + + def dotted_line_manager_id_v2(self, dotted_line_manager_id_v2: str) -> "EmployeeBuilder": + self._employee.dotted_line_manager_id_v2 = dotted_line_manager_id_v2 + return self + def employment_type(self, employment_type: Enum) -> "EmployeeBuilder": self._employee.employment_type = employment_type return self diff --git a/lark_oapi/api/corehr/v2/model/job_change.py b/lark_oapi/api/corehr/v2/model/job_change.py index 8c203dce3..e20de7406 100644 --- a/lark_oapi/api/corehr/v2/model/job_change.py +++ b/lark_oapi/api/corehr/v2/model/job_change.py @@ -3,6 +3,7 @@ from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type from lark_oapi.core.construct import init from .transfer_info import TransferInfo +from .custom_field_data import CustomFieldData class JobChange(object): @@ -17,6 +18,8 @@ class JobChange(object): "created_time": str, "updated_time": str, "transfer_info": TransferInfo, + "is_adjust_salary": bool, + "custom_fields": List[CustomFieldData], } def __init__(self, d=None): @@ -30,6 +33,8 @@ def __init__(self, d=None): self.created_time: Optional[str] = None self.updated_time: Optional[str] = None self.transfer_info: Optional[TransferInfo] = None + self.is_adjust_salary: Optional[bool] = None + self.custom_fields: Optional[List[CustomFieldData]] = None init(self, d, self._types) @staticmethod @@ -81,5 +86,13 @@ def transfer_info(self, transfer_info: TransferInfo) -> "JobChangeBuilder": self._job_change.transfer_info = transfer_info return self + def is_adjust_salary(self, is_adjust_salary: bool) -> "JobChangeBuilder": + self._job_change.is_adjust_salary = is_adjust_salary + return self + + def custom_fields(self, custom_fields: List[CustomFieldData]) -> "JobChangeBuilder": + self._job_change.custom_fields = custom_fields + return self + def build(self) -> "JobChange": return self._job_change diff --git a/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_status_updated_v2.py b/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_status_updated_v2.py new file mode 100644 index 000000000..4ad3d49a2 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_status_updated_v2.py @@ -0,0 +1,46 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2CorehrJobChangeStatusUpdatedV2Data(object): + _types = { + "employment_id": str, + "target_user_id": UserId, + "job_change_id": str, + "transfer_mode": int, + "transfer_type_unique_identifier": str, + "transfer_reason_unique_identifier": str, + "process_id": str, + "effective_date": str, + "status": int, + "transfer_key": str, + } + + def __init__(self, d=None): + self.employment_id: Optional[str] = None + self.target_user_id: Optional[UserId] = None + self.job_change_id: Optional[str] = None + self.transfer_mode: Optional[int] = None + self.transfer_type_unique_identifier: Optional[str] = None + self.transfer_reason_unique_identifier: Optional[str] = None + self.process_id: Optional[str] = None + self.effective_date: Optional[str] = None + self.status: Optional[int] = None + self.transfer_key: Optional[str] = None + init(self, d, self._types) + + +class P2CorehrJobChangeStatusUpdatedV2(EventContext): + _types = { + "event": P2CorehrJobChangeStatusUpdatedV2Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2CorehrJobChangeStatusUpdatedV2Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_updated_v2.py b/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_updated_v2.py index 4f2a6b100..f36dfc40a 100644 --- a/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_updated_v2.py +++ b/lark_oapi/api/corehr/v2/model/p2_corehr_job_change_updated_v2.py @@ -18,6 +18,8 @@ class P2CorehrJobChangeUpdatedV2Data(object): "operate_reason": str, "transfer_type": int, "updated_fields": List[str], + "transform_type": str, + "transform_reason": str, } def __init__(self, d=None): @@ -32,6 +34,8 @@ def __init__(self, d=None): self.operate_reason: Optional[str] = None self.transfer_type: Optional[int] = None self.updated_fields: Optional[List[str]] = None + self.transform_type: Optional[str] = None + self.transform_reason: Optional[str] = None init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v2/model/patch_department_request.py b/lark_oapi/api/corehr/v2/model/patch_department_request.py new file mode 100644 index 000000000..1c2944f12 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/patch_department_request.py @@ -0,0 +1,58 @@ +# 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 .department_for_patch import DepartmentForPatch + + +class PatchDepartmentRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.client_token: Optional[str] = None + self.user_id_type: Optional[str] = None + self.department_id_type: Optional[str] = None + self.department_id: Optional[str] = None + self.request_body: Optional[DepartmentForPatch] = None + + @staticmethod + def builder() -> "PatchDepartmentRequestBuilder": + return PatchDepartmentRequestBuilder() + + +class PatchDepartmentRequestBuilder(object): + + def __init__(self) -> None: + patch_department_request = PatchDepartmentRequest() + patch_department_request.http_method = HttpMethod.PATCH + patch_department_request.uri = "/open-apis/corehr/v2/departments/:department_id" + patch_department_request.token_types = {AccessTokenType.TENANT} + self._patch_department_request: PatchDepartmentRequest = patch_department_request + + def client_token(self, client_token: str) -> "PatchDepartmentRequestBuilder": + self._patch_department_request.client_token = client_token + self._patch_department_request.add_query("client_token", client_token) + return self + + def user_id_type(self, user_id_type: str) -> "PatchDepartmentRequestBuilder": + self._patch_department_request.user_id_type = user_id_type + self._patch_department_request.add_query("user_id_type", user_id_type) + return self + + def department_id_type(self, department_id_type: str) -> "PatchDepartmentRequestBuilder": + self._patch_department_request.department_id_type = department_id_type + self._patch_department_request.add_query("department_id_type", department_id_type) + return self + + def department_id(self, department_id: str) -> "PatchDepartmentRequestBuilder": + self._patch_department_request.department_id = department_id + self._patch_department_request.paths["department_id"] = str(department_id) + return self + + def request_body(self, request_body: DepartmentForPatch) -> "PatchDepartmentRequestBuilder": + self._patch_department_request.request_body = request_body + self._patch_department_request.body = request_body + return self + + def build(self) -> PatchDepartmentRequest: + return self._patch_department_request diff --git a/lark_oapi/api/corehr/v2/model/patch_department_response.py b/lark_oapi/api/corehr/v2/model/patch_department_response.py new file mode 100644 index 000000000..55de94e38 --- /dev/null +++ b/lark_oapi/api/corehr/v2/model/patch_department_response.py @@ -0,0 +1,16 @@ +# 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 + + +class PatchDepartmentResponse(BaseResponse): + _types = { + + } + + def __init__(self, d=None): + super().__init__(d) + + init(self, d, self._types) diff --git a/lark_oapi/api/corehr/v2/model/person_info.py b/lark_oapi/api/corehr/v2/model/person_info.py index 2b9dab851..98030a733 100644 --- a/lark_oapi/api/corehr/v2/model/person_info.py +++ b/lark_oapi/api/corehr/v2/model/person_info.py @@ -40,6 +40,7 @@ class PersonInfo(object): "name_list": List[PersonName], "gender": Enum, "date_of_birth": str, + "nationality_id_v2": str, "race": Enum, "marital_status": Enum, "phone_list": List[Phone], @@ -98,6 +99,7 @@ def __init__(self, d=None): self.name_list: Optional[List[PersonName]] = None self.gender: Optional[Enum] = None self.date_of_birth: Optional[str] = None + self.nationality_id_v2: Optional[str] = None self.race: Optional[Enum] = None self.marital_status: Optional[Enum] = None self.phone_list: Optional[List[Phone]] = None @@ -191,6 +193,10 @@ def date_of_birth(self, date_of_birth: str) -> "PersonInfoBuilder": self._person_info.date_of_birth = date_of_birth return self + def nationality_id_v2(self, nationality_id_v2: str) -> "PersonInfoBuilder": + self._person_info.nationality_id_v2 = nationality_id_v2 + return self + def race(self, race: Enum) -> "PersonInfoBuilder": self._person_info.race = race return self diff --git a/lark_oapi/api/corehr/v2/model/transfer_info.py b/lark_oapi/api/corehr/v2/model/transfer_info.py index 7d53e624c..11981f914 100644 --- a/lark_oapi/api/corehr/v2/model/transfer_info.py +++ b/lark_oapi/api/corehr/v2/model/transfer_info.py @@ -71,6 +71,8 @@ class TransferInfo(object): "target_service_company": str, "original_position": str, "target_position": str, + "original_social_security_city": str, + "target_social_security_city": str, } def __init__(self, d=None): @@ -133,6 +135,8 @@ def __init__(self, d=None): self.target_service_company: Optional[str] = None self.original_position: Optional[str] = None self.target_position: Optional[str] = None + self.original_social_security_city: Optional[str] = None + self.target_social_security_city: Optional[str] = None init(self, d, self._types) @staticmethod @@ -381,5 +385,13 @@ def target_position(self, target_position: str) -> "TransferInfoBuilder": self._transfer_info.target_position = target_position return self + def original_social_security_city(self, original_social_security_city: str) -> "TransferInfoBuilder": + self._transfer_info.original_social_security_city = original_social_security_city + return self + + def target_social_security_city(self, target_social_security_city: str) -> "TransferInfoBuilder": + self._transfer_info.target_social_security_city = target_social_security_city + return self + def build(self) -> "TransferInfo": return self._transfer_info diff --git a/lark_oapi/api/corehr/v2/processor.py b/lark_oapi/api/corehr/v2/processor.py index 51f5cdae8..0522deb04 100644 --- a/lark_oapi/api/corehr/v2/processor.py +++ b/lark_oapi/api/corehr/v2/processor.py @@ -4,6 +4,7 @@ from lark_oapi.event.processor import IEventProcessor from .model.p2_corehr_employee_domain_event_v2 import P2CorehrEmployeeDomainEventV2 +from .model.p2_corehr_job_change_status_updated_v2 import P2CorehrJobChangeStatusUpdatedV2 from .model.p2_corehr_job_change_updated_v2 import P2CorehrJobChangeUpdatedV2 from .model.p2_corehr_offboarding_checklist_updated_v2 import P2CorehrOffboardingChecklistUpdatedV2 from .model.p2_corehr_offboarding_status_updated_v2 import P2CorehrOffboardingStatusUpdatedV2 @@ -26,6 +27,17 @@ def do(self, data: P2CorehrEmployeeDomainEventV2) -> None: self.f(data) +class P2CorehrJobChangeStatusUpdatedV2Processor(IEventProcessor[P2CorehrJobChangeStatusUpdatedV2]): + def __init__(self, f: Callable[[P2CorehrJobChangeStatusUpdatedV2], None]): + self.f = f + + def type(self) -> Type[P2CorehrJobChangeStatusUpdatedV2]: + return P2CorehrJobChangeStatusUpdatedV2 + + def do(self, data: P2CorehrJobChangeStatusUpdatedV2) -> None: + self.f(data) + + class P2CorehrJobChangeUpdatedV2Processor(IEventProcessor[P2CorehrJobChangeUpdatedV2]): def __init__(self, f: Callable[[P2CorehrJobChangeUpdatedV2], None]): self.f = f diff --git a/lark_oapi/api/corehr/v2/resource/department.py b/lark_oapi/api/corehr/v2/resource/department.py index c23670d7c..ac8187abb 100644 --- a/lark_oapi/api/corehr/v2/resource/department.py +++ b/lark_oapi/api/corehr/v2/resource/department.py @@ -11,8 +11,12 @@ from requests_toolbelt import MultipartEncoder from ..model.batch_get_department_request import BatchGetDepartmentRequest from ..model.batch_get_department_response import BatchGetDepartmentResponse +from ..model.delete_department_request import DeleteDepartmentRequest +from ..model.delete_department_response import DeleteDepartmentResponse from ..model.parents_department_request import ParentsDepartmentRequest from ..model.parents_department_response import ParentsDepartmentResponse +from ..model.patch_department_request import PatchDepartmentRequest +from ..model.patch_department_response import PatchDepartmentResponse from ..model.query_multi_timeline_department_request import QueryMultiTimelineDepartmentRequest from ..model.query_multi_timeline_department_response import QueryMultiTimelineDepartmentResponse from ..model.query_timeline_department_request import QueryTimelineDepartmentRequest @@ -65,6 +69,44 @@ async def abatch_get(self, request: BatchGetDepartmentRequest, return response + def delete(self, request: DeleteDepartmentRequest, + option: Optional[RequestOption] = None) -> DeleteDepartmentResponse: + 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: DeleteDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), DeleteDepartmentResponse) + response.raw = resp + + return response + + async def adelete(self, request: DeleteDepartmentRequest, + option: Optional[RequestOption] = None) -> DeleteDepartmentResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: DeleteDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), DeleteDepartmentResponse) + response.raw = resp + + return response + def parents(self, request: ParentsDepartmentRequest, option: Optional[RequestOption] = None) -> ParentsDepartmentResponse: if option is None: @@ -103,6 +145,43 @@ async def aparents(self, request: ParentsDepartmentRequest, return response + def patch(self, request: PatchDepartmentRequest, option: Optional[RequestOption] = None) -> PatchDepartmentResponse: + 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: PatchDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), PatchDepartmentResponse) + response.raw = resp + + return response + + async def apatch(self, request: PatchDepartmentRequest, + option: Optional[RequestOption] = None) -> PatchDepartmentResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: PatchDepartmentResponse = JSON.unmarshal(str(resp.content, UTF_8), PatchDepartmentResponse) + response.raw = resp + + return response + def query_multi_timeline(self, request: QueryMultiTimelineDepartmentRequest, option: Optional[RequestOption] = None) -> QueryMultiTimelineDepartmentResponse: if option is None: diff --git a/lark_oapi/api/hire/v1/model/__init__.py b/lark_oapi/api/hire/v1/model/__init__.py index a55c99cd2..4a9977946 100644 --- a/lark_oapi/api/hire/v1/model/__init__.py +++ b/lark_oapi/api/hire/v1/model/__init__.py @@ -2,9 +2,16 @@ from .acceptance import * from .account import * from .agency import * +from .agency_account import * +from .agency_account_user import * from .agency_basic_info import * from .agency_info import * from .agency_protection import * +from .agency_supplier import * +from .agency_supplier_admin import * +from .agency_supplier_label import * +from .agency_supplier_protect_time import * +from .agency_supplier_talent_protect_time import * from .ambassador_account_info import * from .appli_offer_basic_cust_obj import * from .appli_offer_basic_cust_obj_op_v import * @@ -104,6 +111,7 @@ from .combined_job_result_default_job_post import * from .common_address import * from .common_city_info import * +from .common_filter import * from .common_schema import * from .common_schema_child import * from .common_schema_config import * @@ -546,6 +554,9 @@ from .list_interview_registration_schema_request import * from .list_interview_round_type_request import * from .list_interview_task_request import * +from .list_interviewer_request import * +from .patch_interviewer_request_body import * +from .patch_interviewer_request import * from .close_job_request import * from .combined_create_job_request import * from .combined_update_job_request import * @@ -575,6 +586,7 @@ from .list_location_request import * from .query_location_request_body import * from .query_location_request import * +from .get_minutes_request import * from .create_note_request import * from .delete_note_request import * from .get_note_request import * @@ -641,6 +653,7 @@ from .delete_tripartite_agreement_request import * from .list_tripartite_agreement_request import * from .update_tripartite_agreement_request import * +from .list_user_role_request import * from .list_website_request import * from .create_website_channel_request_body import * from .create_website_channel_request import * @@ -758,6 +771,10 @@ from .list_interview_round_type_response import * from .list_interview_task_response_body import * from .list_interview_task_response import * +from .list_interviewer_response_body import * +from .list_interviewer_response import * +from .patch_interviewer_response_body import * +from .patch_interviewer_response import * from .close_job_response import * from .combined_create_job_response_body import * from .combined_create_job_response import * @@ -802,6 +819,8 @@ from .list_location_response import * from .query_location_response_body import * from .query_location_response import * +from .get_minutes_response_body import * +from .get_minutes_response import * from .create_note_response_body import * from .create_note_response import * from .delete_note_response import * @@ -897,6 +916,8 @@ from .list_tripartite_agreement_response import * from .update_tripartite_agreement_response_body import * from .update_tripartite_agreement_response import * +from .list_user_role_response_body import * +from .list_user_role_response import * from .list_website_response_body import * from .list_website_response import * from .create_website_channel_response_body import * diff --git a/lark_oapi/api/hire/v1/model/agency_account.py b/lark_oapi/api/hire/v1/model/agency_account.py new file mode 100644 index 000000000..69a097397 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_account.py @@ -0,0 +1,61 @@ +# 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 .agency_account_user import AgencyAccountUser + + +class AgencyAccount(object): + _types = { + "id": str, + "reason": str, + "create_time": str, + "status": int, + "user_info": AgencyAccountUser, + "role": int, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.reason: Optional[str] = None + self.create_time: Optional[str] = None + self.status: Optional[int] = None + self.user_info: Optional[AgencyAccountUser] = None + self.role: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencyAccountBuilder": + return AgencyAccountBuilder() + + +class AgencyAccountBuilder(object): + def __init__(self) -> None: + self._agency_account = AgencyAccount() + + def id(self, id: str) -> "AgencyAccountBuilder": + self._agency_account.id = id + return self + + def reason(self, reason: str) -> "AgencyAccountBuilder": + self._agency_account.reason = reason + return self + + def create_time(self, create_time: str) -> "AgencyAccountBuilder": + self._agency_account.create_time = create_time + return self + + def status(self, status: int) -> "AgencyAccountBuilder": + self._agency_account.status = status + return self + + def user_info(self, user_info: AgencyAccountUser) -> "AgencyAccountBuilder": + self._agency_account.user_info = user_info + return self + + def role(self, role: int) -> "AgencyAccountBuilder": + self._agency_account.role = role + return self + + def build(self) -> "AgencyAccount": + return self._agency_account diff --git a/lark_oapi/api/hire/v1/model/agency_account_user.py b/lark_oapi/api/hire/v1/model/agency_account_user.py new file mode 100644 index 000000000..6a73779c4 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_account_user.py @@ -0,0 +1,49 @@ +# 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 AgencyAccountUser(object): + _types = { + "user_id": str, + "name": I18n, + "email": str, + "mobile": str, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.name: Optional[I18n] = None + self.email: Optional[str] = None + self.mobile: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencyAccountUserBuilder": + return AgencyAccountUserBuilder() + + +class AgencyAccountUserBuilder(object): + def __init__(self) -> None: + self._agency_account_user = AgencyAccountUser() + + def user_id(self, user_id: str) -> "AgencyAccountUserBuilder": + self._agency_account_user.user_id = user_id + return self + + def name(self, name: I18n) -> "AgencyAccountUserBuilder": + self._agency_account_user.name = name + return self + + def email(self, email: str) -> "AgencyAccountUserBuilder": + self._agency_account_user.email = email + return self + + def mobile(self, mobile: str) -> "AgencyAccountUserBuilder": + self._agency_account_user.mobile = mobile + return self + + def build(self) -> "AgencyAccountUser": + return self._agency_account_user diff --git a/lark_oapi/api/hire/v1/model/agency_supplier.py b/lark_oapi/api/hire/v1/model/agency_supplier.py new file mode 100644 index 000000000..895b06275 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_supplier.py @@ -0,0 +1,100 @@ +# 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 .agency_supplier_label import AgencySupplierLabel +from .agency_supplier_admin import AgencySupplierAdmin +from .agency_supplier_protect_time import AgencySupplierProtectTime +from .agency_supplier_talent_protect_time import AgencySupplierTalentProtectTime + + +class AgencySupplier(object): + _types = { + "id": str, + "name": str, + "label_list": List[AgencySupplierLabel], + "admin_list": List[AgencySupplierAdmin], + "agency_protect_time": AgencySupplierProtectTime, + "cooperation_create_time": str, + "cooperation_start_time": str, + "cooperation_end_time": str, + "cooperation_status": int, + "invite_email": str, + "supplier_area": int, + "talent_protect_time": AgencySupplierTalentProtectTime, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.name: Optional[str] = None + self.label_list: Optional[List[AgencySupplierLabel]] = None + self.admin_list: Optional[List[AgencySupplierAdmin]] = None + self.agency_protect_time: Optional[AgencySupplierProtectTime] = None + self.cooperation_create_time: Optional[str] = None + self.cooperation_start_time: Optional[str] = None + self.cooperation_end_time: Optional[str] = None + self.cooperation_status: Optional[int] = None + self.invite_email: Optional[str] = None + self.supplier_area: Optional[int] = None + self.talent_protect_time: Optional[AgencySupplierTalentProtectTime] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencySupplierBuilder": + return AgencySupplierBuilder() + + +class AgencySupplierBuilder(object): + def __init__(self) -> None: + self._agency_supplier = AgencySupplier() + + def id(self, id: str) -> "AgencySupplierBuilder": + self._agency_supplier.id = id + return self + + def name(self, name: str) -> "AgencySupplierBuilder": + self._agency_supplier.name = name + return self + + def label_list(self, label_list: List[AgencySupplierLabel]) -> "AgencySupplierBuilder": + self._agency_supplier.label_list = label_list + return self + + def admin_list(self, admin_list: List[AgencySupplierAdmin]) -> "AgencySupplierBuilder": + self._agency_supplier.admin_list = admin_list + return self + + def agency_protect_time(self, agency_protect_time: AgencySupplierProtectTime) -> "AgencySupplierBuilder": + self._agency_supplier.agency_protect_time = agency_protect_time + return self + + def cooperation_create_time(self, cooperation_create_time: str) -> "AgencySupplierBuilder": + self._agency_supplier.cooperation_create_time = cooperation_create_time + return self + + def cooperation_start_time(self, cooperation_start_time: str) -> "AgencySupplierBuilder": + self._agency_supplier.cooperation_start_time = cooperation_start_time + return self + + def cooperation_end_time(self, cooperation_end_time: str) -> "AgencySupplierBuilder": + self._agency_supplier.cooperation_end_time = cooperation_end_time + return self + + def cooperation_status(self, cooperation_status: int) -> "AgencySupplierBuilder": + self._agency_supplier.cooperation_status = cooperation_status + return self + + def invite_email(self, invite_email: str) -> "AgencySupplierBuilder": + self._agency_supplier.invite_email = invite_email + return self + + def supplier_area(self, supplier_area: int) -> "AgencySupplierBuilder": + self._agency_supplier.supplier_area = supplier_area + return self + + def talent_protect_time(self, talent_protect_time: AgencySupplierTalentProtectTime) -> "AgencySupplierBuilder": + self._agency_supplier.talent_protect_time = talent_protect_time + return self + + def build(self) -> "AgencySupplier": + return self._agency_supplier diff --git a/lark_oapi/api/hire/v1/model/agency_supplier_admin.py b/lark_oapi/api/hire/v1/model/agency_supplier_admin.py new file mode 100644 index 000000000..393a6f67c --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_supplier_admin.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 .i18n import I18n + + +class AgencySupplierAdmin(object): + _types = { + "user_id": str, + "name": I18n, + "email": str, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.name: Optional[I18n] = None + self.email: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencySupplierAdminBuilder": + return AgencySupplierAdminBuilder() + + +class AgencySupplierAdminBuilder(object): + def __init__(self) -> None: + self._agency_supplier_admin = AgencySupplierAdmin() + + def user_id(self, user_id: str) -> "AgencySupplierAdminBuilder": + self._agency_supplier_admin.user_id = user_id + return self + + def name(self, name: I18n) -> "AgencySupplierAdminBuilder": + self._agency_supplier_admin.name = name + return self + + def email(self, email: str) -> "AgencySupplierAdminBuilder": + self._agency_supplier_admin.email = email + return self + + def build(self) -> "AgencySupplierAdmin": + return self._agency_supplier_admin diff --git a/lark_oapi/api/hire/v1/model/agency_supplier_label.py b/lark_oapi/api/hire/v1/model/agency_supplier_label.py new file mode 100644 index 000000000..719cb30a3 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_supplier_label.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 .i18n import I18n + + +class AgencySupplierLabel(object): + _types = { + "id": str, + "name": I18n, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.name: Optional[I18n] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencySupplierLabelBuilder": + return AgencySupplierLabelBuilder() + + +class AgencySupplierLabelBuilder(object): + def __init__(self) -> None: + self._agency_supplier_label = AgencySupplierLabel() + + def id(self, id: str) -> "AgencySupplierLabelBuilder": + self._agency_supplier_label.id = id + return self + + def name(self, name: I18n) -> "AgencySupplierLabelBuilder": + self._agency_supplier_label.name = name + return self + + def build(self) -> "AgencySupplierLabel": + return self._agency_supplier_label diff --git a/lark_oapi/api/hire/v1/model/agency_supplier_protect_time.py b/lark_oapi/api/hire/v1/model/agency_supplier_protect_time.py new file mode 100644 index 000000000..25f52dc32 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_supplier_protect_time.py @@ -0,0 +1,36 @@ +# 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 AgencySupplierProtectTime(object): + _types = { + "day": int, + "use_default": bool, + } + + def __init__(self, d=None): + self.day: Optional[int] = None + self.use_default: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencySupplierProtectTimeBuilder": + return AgencySupplierProtectTimeBuilder() + + +class AgencySupplierProtectTimeBuilder(object): + def __init__(self) -> None: + self._agency_supplier_protect_time = AgencySupplierProtectTime() + + def day(self, day: int) -> "AgencySupplierProtectTimeBuilder": + self._agency_supplier_protect_time.day = day + return self + + def use_default(self, use_default: bool) -> "AgencySupplierProtectTimeBuilder": + self._agency_supplier_protect_time.use_default = use_default + return self + + def build(self) -> "AgencySupplierProtectTime": + return self._agency_supplier_protect_time diff --git a/lark_oapi/api/hire/v1/model/agency_supplier_talent_protect_time.py b/lark_oapi/api/hire/v1/model/agency_supplier_talent_protect_time.py new file mode 100644 index 000000000..46e95e2ab --- /dev/null +++ b/lark_oapi/api/hire/v1/model/agency_supplier_talent_protect_time.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 AgencySupplierTalentProtectTime(object): + _types = { + "day": int, + "use_default": bool, + "forever": bool, + } + + def __init__(self, d=None): + self.day: Optional[int] = None + self.use_default: Optional[bool] = None + self.forever: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "AgencySupplierTalentProtectTimeBuilder": + return AgencySupplierTalentProtectTimeBuilder() + + +class AgencySupplierTalentProtectTimeBuilder(object): + def __init__(self) -> None: + self._agency_supplier_talent_protect_time = AgencySupplierTalentProtectTime() + + def day(self, day: int) -> "AgencySupplierTalentProtectTimeBuilder": + self._agency_supplier_talent_protect_time.day = day + return self + + def use_default(self, use_default: bool) -> "AgencySupplierTalentProtectTimeBuilder": + self._agency_supplier_talent_protect_time.use_default = use_default + return self + + def forever(self, forever: bool) -> "AgencySupplierTalentProtectTimeBuilder": + self._agency_supplier_talent_protect_time.forever = forever + return self + + def build(self) -> "AgencySupplierTalentProtectTime": + return self._agency_supplier_talent_protect_time diff --git a/lark_oapi/api/hire/v1/model/common_filter.py b/lark_oapi/api/hire/v1/model/common_filter.py new file mode 100644 index 000000000..371b9a67c --- /dev/null +++ b/lark_oapi/api/hire/v1/model/common_filter.py @@ -0,0 +1,49 @@ +# 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 .range_filter import RangeFilter + + +class CommonFilter(object): + _types = { + "key": str, + "value_type": int, + "value_list": List[str], + "range_filter": RangeFilter, + } + + def __init__(self, d=None): + self.key: Optional[str] = None + self.value_type: Optional[int] = None + self.value_list: Optional[List[str]] = None + self.range_filter: Optional[RangeFilter] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "CommonFilterBuilder": + return CommonFilterBuilder() + + +class CommonFilterBuilder(object): + def __init__(self) -> None: + self._common_filter = CommonFilter() + + def key(self, key: str) -> "CommonFilterBuilder": + self._common_filter.key = key + return self + + def value_type(self, value_type: int) -> "CommonFilterBuilder": + self._common_filter.value_type = value_type + return self + + def value_list(self, value_list: List[str]) -> "CommonFilterBuilder": + self._common_filter.value_list = value_list + return self + + def range_filter(self, range_filter: RangeFilter) -> "CommonFilterBuilder": + self._common_filter.range_filter = range_filter + return self + + def build(self) -> "CommonFilter": + return self._common_filter diff --git a/lark_oapi/api/hire/v1/model/get_minutes_request.py b/lark_oapi/api/hire/v1/model/get_minutes_request.py new file mode 100644 index 000000000..616df796f --- /dev/null +++ b/lark_oapi/api/hire/v1/model/get_minutes_request.py @@ -0,0 +1,45 @@ +# 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 + + +class GetMinutesRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.interview_id: Optional[str] = None + self.page_token: Optional[str] = None + self.page_size: Optional[int] = None + + @staticmethod + def builder() -> "GetMinutesRequestBuilder": + return GetMinutesRequestBuilder() + + +class GetMinutesRequestBuilder(object): + + def __init__(self) -> None: + get_minutes_request = GetMinutesRequest() + get_minutes_request.http_method = HttpMethod.GET + get_minutes_request.uri = "/open-apis/hire/v1/minutes" + get_minutes_request.token_types = {AccessTokenType.TENANT} + self._get_minutes_request: GetMinutesRequest = get_minutes_request + + def interview_id(self, interview_id: str) -> "GetMinutesRequestBuilder": + self._get_minutes_request.interview_id = interview_id + self._get_minutes_request.add_query("interview_id", interview_id) + return self + + def page_token(self, page_token: str) -> "GetMinutesRequestBuilder": + self._get_minutes_request.page_token = page_token + self._get_minutes_request.add_query("page_token", page_token) + return self + + def page_size(self, page_size: int) -> "GetMinutesRequestBuilder": + self._get_minutes_request.page_size = page_size + self._get_minutes_request.add_query("page_size", page_size) + return self + + def build(self) -> GetMinutesRequest: + return self._get_minutes_request diff --git a/lark_oapi/api/hire/v1/model/get_minutes_response.py b/lark_oapi/api/hire/v1/model/get_minutes_response.py new file mode 100644 index 000000000..2841ba559 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/get_minutes_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 .get_minutes_response_body import GetMinutesResponseBody + + +class GetMinutesResponse(BaseResponse): + _types = { + "data": GetMinutesResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[GetMinutesResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/hire/v1/model/get_minutes_response_body.py b/lark_oapi/api/hire/v1/model/get_minutes_response_body.py new file mode 100644 index 000000000..6b73c708a --- /dev/null +++ b/lark_oapi/api/hire/v1/model/get_minutes_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 .minutes import Minutes + + +class GetMinutesResponseBody(object): + _types = { + "minutes": Minutes, + "page_token": str, + "has_more": bool, + } + + def __init__(self, d=None): + self.minutes: Optional[Minutes] = None + self.page_token: Optional[str] = None + self.has_more: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "GetMinutesResponseBodyBuilder": + return GetMinutesResponseBodyBuilder() + + +class GetMinutesResponseBodyBuilder(object): + def __init__(self) -> None: + self._get_minutes_response_body = GetMinutesResponseBody() + + def minutes(self, minutes: Minutes) -> "GetMinutesResponseBodyBuilder": + self._get_minutes_response_body.minutes = minutes + return self + + def page_token(self, page_token: str) -> "GetMinutesResponseBodyBuilder": + self._get_minutes_response_body.page_token = page_token + return self + + def has_more(self, has_more: bool) -> "GetMinutesResponseBodyBuilder": + self._get_minutes_response_body.has_more = has_more + return self + + def build(self) -> "GetMinutesResponseBody": + return self._get_minutes_response_body diff --git a/lark_oapi/api/hire/v1/model/list_interviewer_request.py b/lark_oapi/api/hire/v1/model/list_interviewer_request.py new file mode 100644 index 000000000..e0cd7a5e4 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_interviewer_request.py @@ -0,0 +1,69 @@ +# 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 + + +class ListInterviewerRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.page_size: Optional[int] = None + self.page_token: Optional[str] = None + self.user_ids: Optional[List[str]] = None + self.verify_status: Optional[int] = None + self.earliest_update_time: Optional[str] = None + self.latest_update_time: Optional[str] = None + self.user_id_type: Optional[str] = None + + @staticmethod + def builder() -> "ListInterviewerRequestBuilder": + return ListInterviewerRequestBuilder() + + +class ListInterviewerRequestBuilder(object): + + def __init__(self) -> None: + list_interviewer_request = ListInterviewerRequest() + list_interviewer_request.http_method = HttpMethod.GET + list_interviewer_request.uri = "/open-apis/hire/v1/interviewers" + list_interviewer_request.token_types = {AccessTokenType.TENANT} + self._list_interviewer_request: ListInterviewerRequest = list_interviewer_request + + def page_size(self, page_size: int) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.page_size = page_size + self._list_interviewer_request.add_query("page_size", page_size) + return self + + def page_token(self, page_token: str) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.page_token = page_token + self._list_interviewer_request.add_query("page_token", page_token) + return self + + def user_ids(self, user_ids: List[str]) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.user_ids = user_ids + self._list_interviewer_request.add_query("user_ids", user_ids) + return self + + def verify_status(self, verify_status: int) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.verify_status = verify_status + self._list_interviewer_request.add_query("verify_status", verify_status) + return self + + def earliest_update_time(self, earliest_update_time: str) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.earliest_update_time = earliest_update_time + self._list_interviewer_request.add_query("earliest_update_time", earliest_update_time) + return self + + def latest_update_time(self, latest_update_time: str) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.latest_update_time = latest_update_time + self._list_interviewer_request.add_query("latest_update_time", latest_update_time) + return self + + def user_id_type(self, user_id_type: str) -> "ListInterviewerRequestBuilder": + self._list_interviewer_request.user_id_type = user_id_type + self._list_interviewer_request.add_query("user_id_type", user_id_type) + return self + + def build(self) -> ListInterviewerRequest: + return self._list_interviewer_request diff --git a/lark_oapi/api/hire/v1/model/list_interviewer_response.py b/lark_oapi/api/hire/v1/model/list_interviewer_response.py new file mode 100644 index 000000000..b8c162233 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_interviewer_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 .list_interviewer_response_body import ListInterviewerResponseBody + + +class ListInterviewerResponse(BaseResponse): + _types = { + "data": ListInterviewerResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[ListInterviewerResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/hire/v1/model/list_interviewer_response_body.py b/lark_oapi/api/hire/v1/model/list_interviewer_response_body.py new file mode 100644 index 000000000..e7f3c0080 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_interviewer_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 .interviewer import Interviewer + + +class ListInterviewerResponseBody(object): + _types = { + "items": List[Interviewer], + "page_token": str, + "has_more": bool, + } + + def __init__(self, d=None): + self.items: Optional[List[Interviewer]] = None + self.page_token: Optional[str] = None + self.has_more: Optional[bool] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ListInterviewerResponseBodyBuilder": + return ListInterviewerResponseBodyBuilder() + + +class ListInterviewerResponseBodyBuilder(object): + def __init__(self) -> None: + self._list_interviewer_response_body = ListInterviewerResponseBody() + + def items(self, items: List[Interviewer]) -> "ListInterviewerResponseBodyBuilder": + self._list_interviewer_response_body.items = items + return self + + def page_token(self, page_token: str) -> "ListInterviewerResponseBodyBuilder": + self._list_interviewer_response_body.page_token = page_token + return self + + def has_more(self, has_more: bool) -> "ListInterviewerResponseBodyBuilder": + self._list_interviewer_response_body.has_more = has_more + return self + + def build(self) -> "ListInterviewerResponseBody": + return self._list_interviewer_response_body diff --git a/lark_oapi/api/hire/v1/model/list_user_role_request.py b/lark_oapi/api/hire/v1/model/list_user_role_request.py new file mode 100644 index 000000000..2169e176c --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_user_role_request.py @@ -0,0 +1,69 @@ +# 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 + + +class ListUserRoleRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.page_token: Optional[str] = None + self.page_size: Optional[int] = None + self.user_id: Optional[str] = None + self.role_id: Optional[str] = None + self.update_start_time: Optional[int] = None + self.update_end_time: Optional[int] = None + self.user_id_type: Optional[str] = None + + @staticmethod + def builder() -> "ListUserRoleRequestBuilder": + return ListUserRoleRequestBuilder() + + +class ListUserRoleRequestBuilder(object): + + def __init__(self) -> None: + list_user_role_request = ListUserRoleRequest() + list_user_role_request.http_method = HttpMethod.GET + list_user_role_request.uri = "/open-apis/hire/v1/user_roles" + list_user_role_request.token_types = {AccessTokenType.TENANT} + self._list_user_role_request: ListUserRoleRequest = list_user_role_request + + def page_token(self, page_token: str) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.page_token = page_token + self._list_user_role_request.add_query("page_token", page_token) + return self + + def page_size(self, page_size: int) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.page_size = page_size + self._list_user_role_request.add_query("page_size", page_size) + return self + + def user_id(self, user_id: str) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.user_id = user_id + self._list_user_role_request.add_query("user_id", user_id) + return self + + def role_id(self, role_id: str) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.role_id = role_id + self._list_user_role_request.add_query("role_id", role_id) + return self + + def update_start_time(self, update_start_time: int) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.update_start_time = update_start_time + self._list_user_role_request.add_query("update_start_time", update_start_time) + return self + + def update_end_time(self, update_end_time: int) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.update_end_time = update_end_time + self._list_user_role_request.add_query("update_end_time", update_end_time) + return self + + def user_id_type(self, user_id_type: str) -> "ListUserRoleRequestBuilder": + self._list_user_role_request.user_id_type = user_id_type + self._list_user_role_request.add_query("user_id_type", user_id_type) + return self + + def build(self) -> ListUserRoleRequest: + return self._list_user_role_request diff --git a/lark_oapi/api/hire/v1/model/list_user_role_response.py b/lark_oapi/api/hire/v1/model/list_user_role_response.py new file mode 100644 index 000000000..168205efc --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_user_role_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 .list_user_role_response_body import ListUserRoleResponseBody + + +class ListUserRoleResponse(BaseResponse): + _types = { + "data": ListUserRoleResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[ListUserRoleResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/hire/v1/model/list_user_role_response_body.py b/lark_oapi/api/hire/v1/model/list_user_role_response_body.py new file mode 100644 index 000000000..e689f29ac --- /dev/null +++ b/lark_oapi/api/hire/v1/model/list_user_role_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 .user_role import UserRole + + +class ListUserRoleResponseBody(object): + _types = { + "items": List[UserRole], + "has_more": bool, + "page_token": str, + } + + def __init__(self, d=None): + self.items: Optional[List[UserRole]] = None + self.has_more: Optional[bool] = None + self.page_token: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ListUserRoleResponseBodyBuilder": + return ListUserRoleResponseBodyBuilder() + + +class ListUserRoleResponseBodyBuilder(object): + def __init__(self) -> None: + self._list_user_role_response_body = ListUserRoleResponseBody() + + def items(self, items: List[UserRole]) -> "ListUserRoleResponseBodyBuilder": + self._list_user_role_response_body.items = items + return self + + def has_more(self, has_more: bool) -> "ListUserRoleResponseBodyBuilder": + self._list_user_role_response_body.has_more = has_more + return self + + def page_token(self, page_token: str) -> "ListUserRoleResponseBodyBuilder": + self._list_user_role_response_body.page_token = page_token + return self + + def build(self) -> "ListUserRoleResponseBody": + return self._list_user_role_response_body diff --git a/lark_oapi/api/hire/v1/model/patch_interviewer_request.py b/lark_oapi/api/hire/v1/model/patch_interviewer_request.py new file mode 100644 index 000000000..f4c97ee08 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/patch_interviewer_request.py @@ -0,0 +1,46 @@ +# 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 .patch_interviewer_request_body import PatchInterviewerRequestBody + + +class PatchInterviewerRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.user_id_type: Optional[str] = None + self.interviewer_id: Optional[str] = None + self.request_body: Optional[PatchInterviewerRequestBody] = None + + @staticmethod + def builder() -> "PatchInterviewerRequestBuilder": + return PatchInterviewerRequestBuilder() + + +class PatchInterviewerRequestBuilder(object): + + def __init__(self) -> None: + patch_interviewer_request = PatchInterviewerRequest() + patch_interviewer_request.http_method = HttpMethod.PATCH + patch_interviewer_request.uri = "/open-apis/hire/v1/interviewers/:interviewer_id" + patch_interviewer_request.token_types = {AccessTokenType.TENANT} + self._patch_interviewer_request: PatchInterviewerRequest = patch_interviewer_request + + def user_id_type(self, user_id_type: str) -> "PatchInterviewerRequestBuilder": + self._patch_interviewer_request.user_id_type = user_id_type + self._patch_interviewer_request.add_query("user_id_type", user_id_type) + return self + + def interviewer_id(self, interviewer_id: str) -> "PatchInterviewerRequestBuilder": + self._patch_interviewer_request.interviewer_id = interviewer_id + self._patch_interviewer_request.paths["interviewer_id"] = str(interviewer_id) + return self + + def request_body(self, request_body: PatchInterviewerRequestBody) -> "PatchInterviewerRequestBuilder": + self._patch_interviewer_request.request_body = request_body + self._patch_interviewer_request.body = request_body + return self + + def build(self) -> PatchInterviewerRequest: + return self._patch_interviewer_request diff --git a/lark_oapi/api/hire/v1/model/patch_interviewer_request_body.py b/lark_oapi/api/hire/v1/model/patch_interviewer_request_body.py new file mode 100644 index 000000000..6e55d6a61 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/patch_interviewer_request_body.py @@ -0,0 +1,31 @@ +# 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 .interviewer import Interviewer + + +class PatchInterviewerRequestBody(object): + _types = { + "interviewer": Interviewer, + } + + def __init__(self, d=None): + self.interviewer: Optional[Interviewer] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "PatchInterviewerRequestBodyBuilder": + return PatchInterviewerRequestBodyBuilder() + + +class PatchInterviewerRequestBodyBuilder(object): + def __init__(self) -> None: + self._patch_interviewer_request_body = PatchInterviewerRequestBody() + + def interviewer(self, interviewer: Interviewer) -> "PatchInterviewerRequestBodyBuilder": + self._patch_interviewer_request_body.interviewer = interviewer + return self + + def build(self) -> "PatchInterviewerRequestBody": + return self._patch_interviewer_request_body diff --git a/lark_oapi/api/hire/v1/model/patch_interviewer_response.py b/lark_oapi/api/hire/v1/model/patch_interviewer_response.py new file mode 100644 index 000000000..2f46d2525 --- /dev/null +++ b/lark_oapi/api/hire/v1/model/patch_interviewer_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 .patch_interviewer_response_body import PatchInterviewerResponseBody + + +class PatchInterviewerResponse(BaseResponse): + _types = { + "data": PatchInterviewerResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[PatchInterviewerResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/hire/v1/model/patch_interviewer_response_body.py b/lark_oapi/api/hire/v1/model/patch_interviewer_response_body.py new file mode 100644 index 000000000..2a0a2c42f --- /dev/null +++ b/lark_oapi/api/hire/v1/model/patch_interviewer_response_body.py @@ -0,0 +1,31 @@ +# 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 .interviewer import Interviewer + + +class PatchInterviewerResponseBody(object): + _types = { + "interviewer": Interviewer, + } + + def __init__(self, d=None): + self.interviewer: Optional[Interviewer] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "PatchInterviewerResponseBodyBuilder": + return PatchInterviewerResponseBodyBuilder() + + +class PatchInterviewerResponseBodyBuilder(object): + def __init__(self) -> None: + self._patch_interviewer_response_body = PatchInterviewerResponseBody() + + def interviewer(self, interviewer: Interviewer) -> "PatchInterviewerResponseBodyBuilder": + self._patch_interviewer_response_body.interviewer = interviewer + return self + + def build(self) -> "PatchInterviewerResponseBody": + return self._patch_interviewer_response_body diff --git a/lark_oapi/api/hire/v1/model/talent_batch_info.py b/lark_oapi/api/hire/v1/model/talent_batch_info.py index 1129fecf1..5ec6ab079 100644 --- a/lark_oapi/api/hire/v1/model/talent_batch_info.py +++ b/lark_oapi/api/hire/v1/model/talent_batch_info.py @@ -12,6 +12,7 @@ class TalentBatchInfo(object): "email": str, "identification_type": int, "identification_number": str, + "is_onboarded": bool, } def __init__(self, d=None): @@ -21,6 +22,7 @@ def __init__(self, d=None): self.email: Optional[str] = None self.identification_type: Optional[int] = None self.identification_number: Optional[str] = None + self.is_onboarded: Optional[bool] = None init(self, d, self._types) @staticmethod @@ -56,5 +58,9 @@ def identification_number(self, identification_number: str) -> "TalentBatchInfoB self._talent_batch_info.identification_number = identification_number return self + def is_onboarded(self, is_onboarded: bool) -> "TalentBatchInfoBuilder": + self._talent_batch_info.is_onboarded = is_onboarded + return self + def build(self) -> "TalentBatchInfo": return self._talent_batch_info diff --git a/lark_oapi/api/hire/v1/resource/__init__.py b/lark_oapi/api/hire/v1/resource/__init__.py index b5d9592d0..99682b1f7 100644 --- a/lark_oapi/api/hire/v1/resource/__init__.py +++ b/lark_oapi/api/hire/v1/resource/__init__.py @@ -31,6 +31,7 @@ from .interview_registration_schema import * from .interview_round_type import * from .interview_task import * +from .interviewer import * from .job import * from .job_manager import * from .job_function import * @@ -41,6 +42,7 @@ from .job_schema import * from .job_type import * from .location import * +from .minutes import * from .note import * from .offer import * from .offer_application_form import * @@ -64,6 +66,7 @@ from .test import * from .todo import * from .tripartite_agreement import * +from .user_role import * from .website import * from .website_channel import * from .website_delivery import * diff --git a/lark_oapi/api/hire/v1/resource/interviewer.py b/lark_oapi/api/hire/v1/resource/interviewer.py new file mode 100644 index 000000000..cf1c7c003 --- /dev/null +++ b/lark_oapi/api/hire/v1/resource/interviewer.py @@ -0,0 +1,95 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.list_interviewer_request import ListInterviewerRequest +from ..model.list_interviewer_response import ListInterviewerResponse +from ..model.patch_interviewer_request import PatchInterviewerRequest +from ..model.patch_interviewer_response import PatchInterviewerResponse + + +class Interviewer(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def list(self, request: ListInterviewerRequest, option: Optional[RequestOption] = None) -> ListInterviewerResponse: + 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: ListInterviewerResponse = JSON.unmarshal(str(resp.content, UTF_8), ListInterviewerResponse) + response.raw = resp + + return response + + async def alist(self, request: ListInterviewerRequest, + option: Optional[RequestOption] = None) -> ListInterviewerResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: ListInterviewerResponse = JSON.unmarshal(str(resp.content, UTF_8), ListInterviewerResponse) + response.raw = resp + + return response + + def patch(self, request: PatchInterviewerRequest, + option: Optional[RequestOption] = None) -> PatchInterviewerResponse: + 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: PatchInterviewerResponse = JSON.unmarshal(str(resp.content, UTF_8), PatchInterviewerResponse) + response.raw = resp + + return response + + async def apatch(self, request: PatchInterviewerRequest, + option: Optional[RequestOption] = None) -> PatchInterviewerResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: PatchInterviewerResponse = JSON.unmarshal(str(resp.content, UTF_8), PatchInterviewerResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/hire/v1/resource/minutes.py b/lark_oapi/api/hire/v1/resource/minutes.py new file mode 100644 index 000000000..f4e8a4394 --- /dev/null +++ b/lark_oapi/api/hire/v1/resource/minutes.py @@ -0,0 +1,54 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.get_minutes_request import GetMinutesRequest +from ..model.get_minutes_response import GetMinutesResponse + + +class Minutes(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def get(self, request: GetMinutesRequest, option: Optional[RequestOption] = None) -> GetMinutesResponse: + 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: GetMinutesResponse = JSON.unmarshal(str(resp.content, UTF_8), GetMinutesResponse) + response.raw = resp + + return response + + async def aget(self, request: GetMinutesRequest, option: Optional[RequestOption] = None) -> GetMinutesResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: GetMinutesResponse = JSON.unmarshal(str(resp.content, UTF_8), GetMinutesResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/hire/v1/resource/user_role.py b/lark_oapi/api/hire/v1/resource/user_role.py new file mode 100644 index 000000000..c7b99c6be --- /dev/null +++ b/lark_oapi/api/hire/v1/resource/user_role.py @@ -0,0 +1,54 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.list_user_role_request import ListUserRoleRequest +from ..model.list_user_role_response import ListUserRoleResponse + + +class UserRole(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def list(self, request: ListUserRoleRequest, option: Optional[RequestOption] = None) -> ListUserRoleResponse: + 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: ListUserRoleResponse = JSON.unmarshal(str(resp.content, UTF_8), ListUserRoleResponse) + response.raw = resp + + return response + + async def alist(self, request: ListUserRoleRequest, option: Optional[RequestOption] = None) -> ListUserRoleResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: ListUserRoleResponse = JSON.unmarshal(str(resp.content, UTF_8), ListUserRoleResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/hire/v1/version.py b/lark_oapi/api/hire/v1/version.py index feaca4f26..ac436d717 100644 --- a/lark_oapi/api/hire/v1/version.py +++ b/lark_oapi/api/hire/v1/version.py @@ -37,6 +37,7 @@ def __init__(self, config: Config) -> None: self.interview_registration_schema: InterviewRegistrationSchema = InterviewRegistrationSchema(config) self.interview_round_type: InterviewRoundType = InterviewRoundType(config) self.interview_task: InterviewTask = InterviewTask(config) + self.interviewer: Interviewer = Interviewer(config) self.job: Job = Job(config) self.job_manager: JobManager = JobManager(config) self.job_function: JobFunction = JobFunction(config) @@ -47,6 +48,7 @@ def __init__(self, config: Config) -> None: self.job_schema: JobSchema = JobSchema(config) self.job_type: JobType = JobType(config) self.location: Location = Location(config) + self.minutes: Minutes = Minutes(config) self.note: Note = Note(config) self.offer: Offer = Offer(config) self.offer_application_form: OfferApplicationForm = OfferApplicationForm(config) @@ -70,6 +72,7 @@ def __init__(self, config: Config) -> None: self.test: Test = Test(config) self.todo: Todo = Todo(config) self.tripartite_agreement: TripartiteAgreement = TripartiteAgreement(config) + self.user_role: UserRole = UserRole(config) self.website: Website = Website(config) self.website_channel: WebsiteChannel = WebsiteChannel(config) self.website_delivery: WebsiteDelivery = WebsiteDelivery(config) diff --git a/lark_oapi/api/im/v2/model/__init__.py b/lark_oapi/api/im/v2/model/__init__.py index e75a2e7d4..b10b057bf 100644 --- a/lark_oapi/api/im/v2/model/__init__.py +++ b/lark_oapi/api/im/v2/model/__init__.py @@ -59,6 +59,8 @@ from .update_biz_entity_tag_relation_request import * from .update_chat_button_request_body import * from .update_chat_button_request import * +from .bot_time_sentive_feed_card_request_body import * +from .bot_time_sentive_feed_card_request import * from .patch_feed_card_request_body import * from .patch_feed_card_request import * from .create_tag_request_body import * @@ -79,6 +81,8 @@ from .update_biz_entity_tag_relation_response import * from .update_chat_button_response_body import * from .update_chat_button_response import * +from .bot_time_sentive_feed_card_response_body import * +from .bot_time_sentive_feed_card_response import * from .patch_feed_card_response_body import * from .patch_feed_card_response import * from .create_tag_response_body import * diff --git a/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request.py b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request.py new file mode 100644 index 000000000..8045ee478 --- /dev/null +++ b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request.py @@ -0,0 +1,40 @@ +# 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 .bot_time_sentive_feed_card_request_body import BotTimeSentiveFeedCardRequestBody + + +class BotTimeSentiveFeedCardRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.user_id_type: Optional[str] = None + self.request_body: Optional[BotTimeSentiveFeedCardRequestBody] = None + + @staticmethod + def builder() -> "BotTimeSentiveFeedCardRequestBuilder": + return BotTimeSentiveFeedCardRequestBuilder() + + +class BotTimeSentiveFeedCardRequestBuilder(object): + + def __init__(self) -> None: + bot_time_sentive_feed_card_request = BotTimeSentiveFeedCardRequest() + bot_time_sentive_feed_card_request.http_method = HttpMethod.PATCH + bot_time_sentive_feed_card_request.uri = "/open-apis/im/v2/feed_cards/bot_time_sentive" + bot_time_sentive_feed_card_request.token_types = {AccessTokenType.TENANT} + self._bot_time_sentive_feed_card_request: BotTimeSentiveFeedCardRequest = bot_time_sentive_feed_card_request + + def user_id_type(self, user_id_type: str) -> "BotTimeSentiveFeedCardRequestBuilder": + self._bot_time_sentive_feed_card_request.user_id_type = user_id_type + self._bot_time_sentive_feed_card_request.add_query("user_id_type", user_id_type) + return self + + def request_body(self, request_body: BotTimeSentiveFeedCardRequestBody) -> "BotTimeSentiveFeedCardRequestBuilder": + self._bot_time_sentive_feed_card_request.request_body = request_body + self._bot_time_sentive_feed_card_request.body = request_body + return self + + def build(self) -> BotTimeSentiveFeedCardRequest: + return self._bot_time_sentive_feed_card_request diff --git a/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request_body.py b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request_body.py new file mode 100644 index 000000000..16f83170d --- /dev/null +++ b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_request_body.py @@ -0,0 +1,36 @@ +# 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 BotTimeSentiveFeedCardRequestBody(object): + _types = { + "time_sensitive": bool, + "user_ids": List[str], + } + + def __init__(self, d=None): + self.time_sensitive: Optional[bool] = None + self.user_ids: Optional[List[str]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "BotTimeSentiveFeedCardRequestBodyBuilder": + return BotTimeSentiveFeedCardRequestBodyBuilder() + + +class BotTimeSentiveFeedCardRequestBodyBuilder(object): + def __init__(self) -> None: + self._bot_time_sentive_feed_card_request_body = BotTimeSentiveFeedCardRequestBody() + + def time_sensitive(self, time_sensitive: bool) -> "BotTimeSentiveFeedCardRequestBodyBuilder": + self._bot_time_sentive_feed_card_request_body.time_sensitive = time_sensitive + return self + + def user_ids(self, user_ids: List[str]) -> "BotTimeSentiveFeedCardRequestBodyBuilder": + self._bot_time_sentive_feed_card_request_body.user_ids = user_ids + return self + + def build(self) -> "BotTimeSentiveFeedCardRequestBody": + return self._bot_time_sentive_feed_card_request_body diff --git a/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_response.py b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_response.py new file mode 100644 index 000000000..fcbf0362a --- /dev/null +++ b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_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 .bot_time_sentive_feed_card_response_body import BotTimeSentiveFeedCardResponseBody + + +class BotTimeSentiveFeedCardResponse(BaseResponse): + _types = { + "data": BotTimeSentiveFeedCardResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[BotTimeSentiveFeedCardResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_response_body.py b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_response_body.py new file mode 100644 index 000000000..40dddb96e --- /dev/null +++ b/lark_oapi/api/im/v2/model/bot_time_sentive_feed_card_response_body.py @@ -0,0 +1,32 @@ +# 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 .failed_reason import FailedReason + + +class BotTimeSentiveFeedCardResponseBody(object): + _types = { + "failed_user_reasons": List[FailedReason], + } + + def __init__(self, d=None): + self.failed_user_reasons: Optional[List[FailedReason]] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "BotTimeSentiveFeedCardResponseBodyBuilder": + return BotTimeSentiveFeedCardResponseBodyBuilder() + + +class BotTimeSentiveFeedCardResponseBodyBuilder(object): + def __init__(self) -> None: + self._bot_time_sentive_feed_card_response_body = BotTimeSentiveFeedCardResponseBody() + + def failed_user_reasons(self, + failed_user_reasons: List[FailedReason]) -> "BotTimeSentiveFeedCardResponseBodyBuilder": + self._bot_time_sentive_feed_card_response_body.failed_user_reasons = failed_user_reasons + return self + + def build(self) -> "BotTimeSentiveFeedCardResponseBody": + return self._bot_time_sentive_feed_card_response_body diff --git a/lark_oapi/api/im/v2/resource/feed_card.py b/lark_oapi/api/im/v2/resource/feed_card.py index 9488a20d4..6493656c9 100644 --- a/lark_oapi/api/im/v2/resource/feed_card.py +++ b/lark_oapi/api/im/v2/resource/feed_card.py @@ -9,6 +9,8 @@ from lark_oapi.core.model import Config, RequestOption, RawResponse from lark_oapi.core.utils import Files from requests_toolbelt import MultipartEncoder +from ..model.bot_time_sentive_feed_card_request import BotTimeSentiveFeedCardRequest +from ..model.bot_time_sentive_feed_card_response import BotTimeSentiveFeedCardResponse from ..model.patch_feed_card_request import PatchFeedCardRequest from ..model.patch_feed_card_response import PatchFeedCardResponse @@ -17,6 +19,46 @@ class FeedCard(object): def __init__(self, config: Config) -> None: self.config: Config = config + def bot_time_sentive(self, request: BotTimeSentiveFeedCardRequest, + option: Optional[RequestOption] = None) -> BotTimeSentiveFeedCardResponse: + 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: BotTimeSentiveFeedCardResponse = JSON.unmarshal(str(resp.content, UTF_8), + BotTimeSentiveFeedCardResponse) + response.raw = resp + + return response + + async def abot_time_sentive(self, request: BotTimeSentiveFeedCardRequest, + option: Optional[RequestOption] = None) -> BotTimeSentiveFeedCardResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: BotTimeSentiveFeedCardResponse = JSON.unmarshal(str(resp.content, UTF_8), + BotTimeSentiveFeedCardResponse) + response.raw = resp + + return response + def patch(self, request: PatchFeedCardRequest, option: Optional[RequestOption] = None) -> PatchFeedCardResponse: if option is None: option = RequestOption() diff --git a/lark_oapi/api/mail/v1/model/__init__.py b/lark_oapi/api/mail/v1/model/__init__.py index c2c5b5412..0b440cf99 100644 --- a/lark_oapi/api/mail/v1/model/__init__.py +++ b/lark_oapi/api/mail/v1/model/__init__.py @@ -75,6 +75,7 @@ from .create_user_mailbox_alias_request import * from .delete_user_mailbox_alias_request import * from .list_user_mailbox_alias_request import * +from .send_user_mailbox_message_request import * from .create_mailgroup_response_body import * from .create_mailgroup_response import * from .delete_mailgroup_response import * @@ -150,3 +151,4 @@ from .delete_user_mailbox_alias_response import * from .list_user_mailbox_alias_response_body import * from .list_user_mailbox_alias_response import * +from .send_user_mailbox_message_response import * diff --git a/lark_oapi/api/mail/v1/model/send_user_mailbox_message_request.py b/lark_oapi/api/mail/v1/model/send_user_mailbox_message_request.py new file mode 100644 index 000000000..e4e4e6b9a --- /dev/null +++ b/lark_oapi/api/mail/v1/model/send_user_mailbox_message_request.py @@ -0,0 +1,40 @@ +# 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 .message import Message + + +class SendUserMailboxMessageRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.user_mailbox_id: Optional[str] = None + self.request_body: Optional[Message] = None + + @staticmethod + def builder() -> "SendUserMailboxMessageRequestBuilder": + return SendUserMailboxMessageRequestBuilder() + + +class SendUserMailboxMessageRequestBuilder(object): + + def __init__(self) -> None: + send_user_mailbox_message_request = SendUserMailboxMessageRequest() + send_user_mailbox_message_request.http_method = HttpMethod.POST + send_user_mailbox_message_request.uri = "/open-apis/mail/v1/user_mailboxes/:user_mailbox_id/messages/send" + send_user_mailbox_message_request.token_types = {AccessTokenType.USER} + self._send_user_mailbox_message_request: SendUserMailboxMessageRequest = send_user_mailbox_message_request + + def user_mailbox_id(self, user_mailbox_id: str) -> "SendUserMailboxMessageRequestBuilder": + self._send_user_mailbox_message_request.user_mailbox_id = user_mailbox_id + self._send_user_mailbox_message_request.paths["user_mailbox_id"] = str(user_mailbox_id) + return self + + def request_body(self, request_body: Message) -> "SendUserMailboxMessageRequestBuilder": + self._send_user_mailbox_message_request.request_body = request_body + self._send_user_mailbox_message_request.body = request_body + return self + + def build(self) -> SendUserMailboxMessageRequest: + return self._send_user_mailbox_message_request diff --git a/lark_oapi/api/mail/v1/model/send_user_mailbox_message_response.py b/lark_oapi/api/mail/v1/model/send_user_mailbox_message_response.py new file mode 100644 index 000000000..535254e40 --- /dev/null +++ b/lark_oapi/api/mail/v1/model/send_user_mailbox_message_response.py @@ -0,0 +1,16 @@ +# 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 + + +class SendUserMailboxMessageResponse(BaseResponse): + _types = { + + } + + def __init__(self, d=None): + super().__init__(d) + + init(self, d, self._types) diff --git a/lark_oapi/api/mail/v1/resource/__init__.py b/lark_oapi/api/mail/v1/resource/__init__.py index 886052185..1db7d8686 100644 --- a/lark_oapi/api/mail/v1/resource/__init__.py +++ b/lark_oapi/api/mail/v1/resource/__init__.py @@ -9,3 +9,4 @@ from .user import * from .user_mailbox import * from .user_mailbox_alias import * +from .user_mailbox_message import * diff --git a/lark_oapi/api/mail/v1/resource/user_mailbox_message.py b/lark_oapi/api/mail/v1/resource/user_mailbox_message.py new file mode 100644 index 000000000..c8d2e3898 --- /dev/null +++ b/lark_oapi/api/mail/v1/resource/user_mailbox_message.py @@ -0,0 +1,58 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.send_user_mailbox_message_request import SendUserMailboxMessageRequest +from ..model.send_user_mailbox_message_response import SendUserMailboxMessageResponse + + +class UserMailboxMessage(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def send(self, request: SendUserMailboxMessageRequest, + option: Optional[RequestOption] = None) -> SendUserMailboxMessageResponse: + 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: SendUserMailboxMessageResponse = JSON.unmarshal(str(resp.content, UTF_8), + SendUserMailboxMessageResponse) + response.raw = resp + + return response + + async def asend(self, request: SendUserMailboxMessageRequest, + option: Optional[RequestOption] = None) -> SendUserMailboxMessageResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: SendUserMailboxMessageResponse = JSON.unmarshal(str(resp.content, UTF_8), + SendUserMailboxMessageResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/mail/v1/version.py b/lark_oapi/api/mail/v1/version.py index 3fc5f1695..8ec2b8d84 100644 --- a/lark_oapi/api/mail/v1/version.py +++ b/lark_oapi/api/mail/v1/version.py @@ -14,3 +14,4 @@ def __init__(self, config: Config) -> None: self.user: User = User(config) self.user_mailbox: UserMailbox = UserMailbox(config) self.user_mailbox_alias: UserMailboxAlias = UserMailboxAlias(config) + self.user_mailbox_message: UserMailboxMessage = UserMailboxMessage(config) diff --git a/lark_oapi/api/moments/__init__.py b/lark_oapi/api/moments/__init__.py new file mode 100644 index 000000000..326cdf49b --- /dev/null +++ b/lark_oapi/api/moments/__init__.py @@ -0,0 +1 @@ +from . import v1 diff --git a/lark_oapi/api/moments/service.py b/lark_oapi/api/moments/service.py new file mode 100644 index 000000000..51ddf9a39 --- /dev/null +++ b/lark_oapi/api/moments/service.py @@ -0,0 +1,9 @@ +# Code generated by Lark OpenAPI. + +from lark_oapi.core.model import Config +from .v1.version import V1 + + +class MomentsService(object): + def __init__(self, config: Config) -> None: + self.v1: V1 = V1(config) diff --git a/lark_oapi/api/moments/v1/__init__.py b/lark_oapi/api/moments/v1/__init__.py new file mode 100644 index 000000000..87cb7367b --- /dev/null +++ b/lark_oapi/api/moments/v1/__init__.py @@ -0,0 +1 @@ +from .model import * diff --git a/lark_oapi/api/moments/v1/model/__init__.py b/lark_oapi/api/moments/v1/model/__init__.py new file mode 100644 index 000000000..71f678304 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/__init__.py @@ -0,0 +1,22 @@ +from .category import * +from .comment import * +from .department_id import * +from .dislike import * +from .post import * +from .post_statistics import * +from .reaction import * +from .reaction_list import * +from .reaction_set import * +from .user_id import * +from .get_post_request import * +from .get_post_response_body import * +from .get_post_response import * +from .p2_moments_comment_created_v1 import * +from .p2_moments_comment_deleted_v1 import * +from .p2_moments_dislike_created_v1 import * +from .p2_moments_dislike_deleted_v1 import * +from .p2_moments_post_created_v1 import * +from .p2_moments_post_deleted_v1 import * +from .p2_moments_post_statistics_updated_v1 import * +from .p2_moments_reaction_created_v1 import * +from .p2_moments_reaction_deleted_v1 import * diff --git a/lark_oapi/api/moments/v1/model/category.py b/lark_oapi/api/moments/v1/model/category.py new file mode 100644 index 000000000..25a164e11 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/category.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 Category(object): + _types = { + "id": str, + "name": str, + "description": str, + "create_time": str, + "post_count": int, + "participant_count": int, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.name: Optional[str] = None + self.description: Optional[str] = None + self.create_time: Optional[str] = None + self.post_count: Optional[int] = None + self.participant_count: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "CategoryBuilder": + return CategoryBuilder() + + +class CategoryBuilder(object): + def __init__(self) -> None: + self._category = Category() + + def id(self, id: str) -> "CategoryBuilder": + self._category.id = id + return self + + def name(self, name: str) -> "CategoryBuilder": + self._category.name = name + return self + + def description(self, description: str) -> "CategoryBuilder": + self._category.description = description + return self + + def create_time(self, create_time: str) -> "CategoryBuilder": + self._category.create_time = create_time + return self + + def post_count(self, post_count: int) -> "CategoryBuilder": + self._category.post_count = post_count + return self + + def participant_count(self, participant_count: int) -> "CategoryBuilder": + self._category.participant_count = participant_count + return self + + def build(self) -> "Category": + return self._category diff --git a/lark_oapi/api/moments/v1/model/comment.py b/lark_oapi/api/moments/v1/model/comment.py new file mode 100644 index 000000000..2de276e5a --- /dev/null +++ b/lark_oapi/api/moments/v1/model/comment.py @@ -0,0 +1,97 @@ +# 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 .reaction_set import ReactionSet + + +class Comment(object): + _types = { + "user_id": str, + "content": str, + "image_key": str, + "is_hot": bool, + "reaction_set": ReactionSet, + "id": str, + "create_time": str, + "post_id": str, + "reply_comment_id": str, + "root_comment_id": str, + "cid": str, + "user_type": int, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.content: Optional[str] = None + self.image_key: Optional[str] = None + self.is_hot: Optional[bool] = None + self.reaction_set: Optional[ReactionSet] = None + self.id: Optional[str] = None + self.create_time: Optional[str] = None + self.post_id: Optional[str] = None + self.reply_comment_id: Optional[str] = None + self.root_comment_id: Optional[str] = None + self.cid: Optional[str] = None + self.user_type: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "CommentBuilder": + return CommentBuilder() + + +class CommentBuilder(object): + def __init__(self) -> None: + self._comment = Comment() + + def user_id(self, user_id: str) -> "CommentBuilder": + self._comment.user_id = user_id + return self + + def content(self, content: str) -> "CommentBuilder": + self._comment.content = content + return self + + def image_key(self, image_key: str) -> "CommentBuilder": + self._comment.image_key = image_key + return self + + def is_hot(self, is_hot: bool) -> "CommentBuilder": + self._comment.is_hot = is_hot + return self + + def reaction_set(self, reaction_set: ReactionSet) -> "CommentBuilder": + self._comment.reaction_set = reaction_set + return self + + def id(self, id: str) -> "CommentBuilder": + self._comment.id = id + return self + + def create_time(self, create_time: str) -> "CommentBuilder": + self._comment.create_time = create_time + return self + + def post_id(self, post_id: str) -> "CommentBuilder": + self._comment.post_id = post_id + return self + + def reply_comment_id(self, reply_comment_id: str) -> "CommentBuilder": + self._comment.reply_comment_id = reply_comment_id + return self + + def root_comment_id(self, root_comment_id: str) -> "CommentBuilder": + self._comment.root_comment_id = root_comment_id + return self + + def cid(self, cid: str) -> "CommentBuilder": + self._comment.cid = cid + return self + + def user_type(self, user_type: int) -> "CommentBuilder": + self._comment.user_type = user_type + return self + + def build(self) -> "Comment": + return self._comment diff --git a/lark_oapi/api/moments/v1/model/department_id.py b/lark_oapi/api/moments/v1/model/department_id.py new file mode 100644 index 000000000..1e895d217 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/department_id.py @@ -0,0 +1,36 @@ +# 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 DepartmentId(object): + _types = { + "department_id": str, + "open_department_id": str, + } + + def __init__(self, d=None): + self.department_id: Optional[str] = None + self.open_department_id: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "DepartmentIdBuilder": + return DepartmentIdBuilder() + + +class DepartmentIdBuilder(object): + def __init__(self) -> None: + self._department_id = DepartmentId() + + def department_id(self, department_id: str) -> "DepartmentIdBuilder": + self._department_id.department_id = department_id + return self + + def open_department_id(self, open_department_id: str) -> "DepartmentIdBuilder": + self._department_id.open_department_id = open_department_id + return self + + def build(self) -> "DepartmentId": + return self._department_id diff --git a/lark_oapi/api/moments/v1/model/dislike.py b/lark_oapi/api/moments/v1/model/dislike.py new file mode 100644 index 000000000..fbbdec998 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/dislike.py @@ -0,0 +1,54 @@ +# 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 Dislike(object): + _types = { + "entity_type": int, + "entity_id": str, + "create_time": str, + "user_id": str, + "id": str, + } + + def __init__(self, d=None): + self.entity_type: Optional[int] = None + self.entity_id: Optional[str] = None + self.create_time: Optional[str] = None + self.user_id: Optional[str] = None + self.id: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "DislikeBuilder": + return DislikeBuilder() + + +class DislikeBuilder(object): + def __init__(self) -> None: + self._dislike = Dislike() + + def entity_type(self, entity_type: int) -> "DislikeBuilder": + self._dislike.entity_type = entity_type + return self + + def entity_id(self, entity_id: str) -> "DislikeBuilder": + self._dislike.entity_id = entity_id + return self + + def create_time(self, create_time: str) -> "DislikeBuilder": + self._dislike.create_time = create_time + return self + + def user_id(self, user_id: str) -> "DislikeBuilder": + self._dislike.user_id = user_id + return self + + def id(self, id: str) -> "DislikeBuilder": + self._dislike.id = id + return self + + def build(self) -> "Dislike": + return self._dislike diff --git a/lark_oapi/api/moments/v1/model/get_post_request.py b/lark_oapi/api/moments/v1/model/get_post_request.py new file mode 100644 index 000000000..11b4b4d63 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/get_post_request.py @@ -0,0 +1,39 @@ +# 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 + + +class GetPostRequest(BaseRequest): + def __init__(self) -> None: + super().__init__() + self.user_id_type: Optional[str] = None + self.post_id: Optional[str] = None + + @staticmethod + def builder() -> "GetPostRequestBuilder": + return GetPostRequestBuilder() + + +class GetPostRequestBuilder(object): + + def __init__(self) -> None: + get_post_request = GetPostRequest() + get_post_request.http_method = HttpMethod.GET + get_post_request.uri = "/open-apis/moments/v1/posts/:post_id" + get_post_request.token_types = {AccessTokenType.TENANT, AccessTokenType.USER} + self._get_post_request: GetPostRequest = get_post_request + + def user_id_type(self, user_id_type: str) -> "GetPostRequestBuilder": + self._get_post_request.user_id_type = user_id_type + self._get_post_request.add_query("user_id_type", user_id_type) + return self + + def post_id(self, post_id: str) -> "GetPostRequestBuilder": + self._get_post_request.post_id = post_id + self._get_post_request.paths["post_id"] = str(post_id) + return self + + def build(self) -> GetPostRequest: + return self._get_post_request diff --git a/lark_oapi/api/moments/v1/model/get_post_response.py b/lark_oapi/api/moments/v1/model/get_post_response.py new file mode 100644 index 000000000..1c2ddf505 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/get_post_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 .get_post_response_body import GetPostResponseBody + + +class GetPostResponse(BaseResponse): + _types = { + "data": GetPostResponseBody + } + + def __init__(self, d=None): + super().__init__(d) + self.data: Optional[GetPostResponseBody] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/get_post_response_body.py b/lark_oapi/api/moments/v1/model/get_post_response_body.py new file mode 100644 index 000000000..775e35b3b --- /dev/null +++ b/lark_oapi/api/moments/v1/model/get_post_response_body.py @@ -0,0 +1,31 @@ +# 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 .post import Post + + +class GetPostResponseBody(object): + _types = { + "post": Post, + } + + def __init__(self, d=None): + self.post: Optional[Post] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "GetPostResponseBodyBuilder": + return GetPostResponseBodyBuilder() + + +class GetPostResponseBodyBuilder(object): + def __init__(self) -> None: + self._get_post_response_body = GetPostResponseBody() + + def post(self, post: Post) -> "GetPostResponseBodyBuilder": + self._get_post_response_body.post = post + return self + + def build(self) -> "GetPostResponseBody": + return self._get_post_response_body diff --git a/lark_oapi/api/moments/v1/model/p2_moments_comment_created_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_comment_created_v1.py new file mode 100644 index 000000000..7a01e0d06 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_comment_created_v1.py @@ -0,0 +1,40 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsCommentCreatedV1Data(object): + _types = { + "user_id": UserId, + "id": str, + "create_time": str, + "post_id": str, + "reply_comment_id": str, + "root_comment_id": str, + "user_type": int, + } + + def __init__(self, d=None): + self.user_id: Optional[UserId] = None + self.id: Optional[str] = None + self.create_time: Optional[str] = None + self.post_id: Optional[str] = None + self.reply_comment_id: Optional[str] = None + self.root_comment_id: Optional[str] = None + self.user_type: Optional[int] = None + init(self, d, self._types) + + +class P2MomentsCommentCreatedV1(EventContext): + _types = { + "event": P2MomentsCommentCreatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsCommentCreatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_comment_deleted_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_comment_deleted_v1.py new file mode 100644 index 000000000..b7f02e194 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_comment_deleted_v1.py @@ -0,0 +1,29 @@ +# 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.event.context import EventContext + + +class P2MomentsCommentDeletedV1Data(object): + _types = { + "id": str, + "post_id": str, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.post_id: Optional[str] = None + init(self, d, self._types) + + +class P2MomentsCommentDeletedV1(EventContext): + _types = { + "event": P2MomentsCommentDeletedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsCommentDeletedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_dislike_created_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_dislike_created_v1.py new file mode 100644 index 000000000..df6328f57 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_dislike_created_v1.py @@ -0,0 +1,36 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsDislikeCreatedV1Data(object): + _types = { + "entity_type": int, + "entity_id": str, + "create_time": str, + "user_id": UserId, + "id": str, + } + + def __init__(self, d=None): + self.entity_type: Optional[int] = None + self.entity_id: Optional[str] = None + self.create_time: Optional[str] = None + self.user_id: Optional[UserId] = None + self.id: Optional[str] = None + init(self, d, self._types) + + +class P2MomentsDislikeCreatedV1(EventContext): + _types = { + "event": P2MomentsDislikeCreatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsDislikeCreatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_dislike_deleted_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_dislike_deleted_v1.py new file mode 100644 index 000000000..2aa01a539 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_dislike_deleted_v1.py @@ -0,0 +1,34 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsDislikeDeletedV1Data(object): + _types = { + "entity_type": int, + "entity_id": str, + "user_id": UserId, + "id": str, + } + + def __init__(self, d=None): + self.entity_type: Optional[int] = None + self.entity_id: Optional[str] = None + self.user_id: Optional[UserId] = None + self.id: Optional[str] = None + init(self, d, self._types) + + +class P2MomentsDislikeDeletedV1(EventContext): + _types = { + "event": P2MomentsDislikeDeletedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsDislikeDeletedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_post_created_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_post_created_v1.py new file mode 100644 index 000000000..84edb9c96 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_post_created_v1.py @@ -0,0 +1,38 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsPostCreatedV1Data(object): + _types = { + "id": str, + "user_id": UserId, + "create_time": str, + "category_ids": List[str], + "link": str, + "user_type": int, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + self.user_id: Optional[UserId] = None + self.create_time: Optional[str] = None + self.category_ids: Optional[List[str]] = None + self.link: Optional[str] = None + self.user_type: Optional[int] = None + init(self, d, self._types) + + +class P2MomentsPostCreatedV1(EventContext): + _types = { + "event": P2MomentsPostCreatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsPostCreatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_post_deleted_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_post_deleted_v1.py new file mode 100644 index 000000000..3a7f7399c --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_post_deleted_v1.py @@ -0,0 +1,27 @@ +# 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.event.context import EventContext + + +class P2MomentsPostDeletedV1Data(object): + _types = { + "id": str, + } + + def __init__(self, d=None): + self.id: Optional[str] = None + init(self, d, self._types) + + +class P2MomentsPostDeletedV1(EventContext): + _types = { + "event": P2MomentsPostDeletedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsPostDeletedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_post_statistics_updated_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_post_statistics_updated_v1.py new file mode 100644 index 000000000..15d1112b3 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_post_statistics_updated_v1.py @@ -0,0 +1,32 @@ +# 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.event.context import EventContext +from .post_statistics import PostStatistics + + +class P2MomentsPostStatisticsUpdatedV1Data(object): + _types = { + "post_id": str, + "statistics_type": int, + "statistics": PostStatistics, + } + + def __init__(self, d=None): + self.post_id: Optional[str] = None + self.statistics_type: Optional[int] = None + self.statistics: Optional[PostStatistics] = None + init(self, d, self._types) + + +class P2MomentsPostStatisticsUpdatedV1(EventContext): + _types = { + "event": P2MomentsPostStatisticsUpdatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsPostStatisticsUpdatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_reaction_created_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_reaction_created_v1.py new file mode 100644 index 000000000..738a26205 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_reaction_created_v1.py @@ -0,0 +1,40 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsReactionCreatedV1Data(object): + _types = { + "type": str, + "user_id": UserId, + "entity_id": str, + "id": str, + "entity_type": int, + "user_type": int, + "create_time": str, + } + + def __init__(self, d=None): + self.type: Optional[str] = None + self.user_id: Optional[UserId] = None + self.entity_id: Optional[str] = None + self.id: Optional[str] = None + self.entity_type: Optional[int] = None + self.user_type: Optional[int] = None + self.create_time: Optional[str] = None + init(self, d, self._types) + + +class P2MomentsReactionCreatedV1(EventContext): + _types = { + "event": P2MomentsReactionCreatedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsReactionCreatedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/p2_moments_reaction_deleted_v1.py b/lark_oapi/api/moments/v1/model/p2_moments_reaction_deleted_v1.py new file mode 100644 index 000000000..cb40db8ee --- /dev/null +++ b/lark_oapi/api/moments/v1/model/p2_moments_reaction_deleted_v1.py @@ -0,0 +1,38 @@ +# 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.event.context import EventContext +from .user_id import UserId + + +class P2MomentsReactionDeletedV1Data(object): + _types = { + "type": str, + "user_id": UserId, + "entity_id": str, + "id": str, + "entity_type": int, + "user_type": int, + } + + def __init__(self, d=None): + self.type: Optional[str] = None + self.user_id: Optional[UserId] = None + self.entity_id: Optional[str] = None + self.id: Optional[str] = None + self.entity_type: Optional[int] = None + self.user_type: Optional[int] = None + init(self, d, self._types) + + +class P2MomentsReactionDeletedV1(EventContext): + _types = { + "event": P2MomentsReactionDeletedV1Data + } + + def __init__(self, d=None): + super().__init__(d) + self._types.update(super()._types) + self.event: Optional[P2MomentsReactionDeletedV1Data] = None + init(self, d, self._types) diff --git a/lark_oapi/api/moments/v1/model/post.py b/lark_oapi/api/moments/v1/model/post.py new file mode 100644 index 000000000..7c6b4e14a --- /dev/null +++ b/lark_oapi/api/moments/v1/model/post.py @@ -0,0 +1,109 @@ +# 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 .reaction_set import ReactionSet + + +class Post(object): + _types = { + "user_id": str, + "content": str, + "image_key_list": List[str], + "media_file_token": str, + "comment_count": int, + "reaction_set": ReactionSet, + "id": str, + "create_time": str, + "media_cover_image_key": str, + "cid": str, + "category_ids": List[str], + "link": str, + "user_type": int, + "dislike_count": int, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.content: Optional[str] = None + self.image_key_list: Optional[List[str]] = None + self.media_file_token: Optional[str] = None + self.comment_count: Optional[int] = None + self.reaction_set: Optional[ReactionSet] = None + self.id: Optional[str] = None + self.create_time: Optional[str] = None + self.media_cover_image_key: Optional[str] = None + self.cid: Optional[str] = None + self.category_ids: Optional[List[str]] = None + self.link: Optional[str] = None + self.user_type: Optional[int] = None + self.dislike_count: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "PostBuilder": + return PostBuilder() + + +class PostBuilder(object): + def __init__(self) -> None: + self._post = Post() + + def user_id(self, user_id: str) -> "PostBuilder": + self._post.user_id = user_id + return self + + def content(self, content: str) -> "PostBuilder": + self._post.content = content + return self + + def image_key_list(self, image_key_list: List[str]) -> "PostBuilder": + self._post.image_key_list = image_key_list + return self + + def media_file_token(self, media_file_token: str) -> "PostBuilder": + self._post.media_file_token = media_file_token + return self + + def comment_count(self, comment_count: int) -> "PostBuilder": + self._post.comment_count = comment_count + return self + + def reaction_set(self, reaction_set: ReactionSet) -> "PostBuilder": + self._post.reaction_set = reaction_set + return self + + def id(self, id: str) -> "PostBuilder": + self._post.id = id + return self + + def create_time(self, create_time: str) -> "PostBuilder": + self._post.create_time = create_time + return self + + def media_cover_image_key(self, media_cover_image_key: str) -> "PostBuilder": + self._post.media_cover_image_key = media_cover_image_key + return self + + def cid(self, cid: str) -> "PostBuilder": + self._post.cid = cid + return self + + def category_ids(self, category_ids: List[str]) -> "PostBuilder": + self._post.category_ids = category_ids + return self + + def link(self, link: str) -> "PostBuilder": + self._post.link = link + return self + + def user_type(self, user_type: int) -> "PostBuilder": + self._post.user_type = user_type + return self + + def dislike_count(self, dislike_count: int) -> "PostBuilder": + self._post.dislike_count = dislike_count + return self + + def build(self) -> "Post": + return self._post diff --git a/lark_oapi/api/moments/v1/model/post_statistics.py b/lark_oapi/api/moments/v1/model/post_statistics.py new file mode 100644 index 000000000..d30fe4f8e --- /dev/null +++ b/lark_oapi/api/moments/v1/model/post_statistics.py @@ -0,0 +1,30 @@ +# 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 PostStatistics(object): + _types = { + "share_count": int, + } + + def __init__(self, d=None): + self.share_count: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "PostStatisticsBuilder": + return PostStatisticsBuilder() + + +class PostStatisticsBuilder(object): + def __init__(self) -> None: + self._post_statistics = PostStatistics() + + def share_count(self, share_count: int) -> "PostStatisticsBuilder": + self._post_statistics.share_count = share_count + return self + + def build(self) -> "PostStatistics": + return self._post_statistics diff --git a/lark_oapi/api/moments/v1/model/reaction.py b/lark_oapi/api/moments/v1/model/reaction.py new file mode 100644 index 000000000..2246378db --- /dev/null +++ b/lark_oapi/api/moments/v1/model/reaction.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 Reaction(object): + _types = { + "type": str, + "user_id": str, + "entity_id": str, + "id": str, + "create_time": str, + "entity_type": int, + "user_type": int, + } + + def __init__(self, d=None): + self.type: Optional[str] = None + self.user_id: Optional[str] = None + self.entity_id: Optional[str] = None + self.id: Optional[str] = None + self.create_time: Optional[str] = None + self.entity_type: Optional[int] = None + self.user_type: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ReactionBuilder": + return ReactionBuilder() + + +class ReactionBuilder(object): + def __init__(self) -> None: + self._reaction = Reaction() + + def type(self, type: str) -> "ReactionBuilder": + self._reaction.type = type + return self + + def user_id(self, user_id: str) -> "ReactionBuilder": + self._reaction.user_id = user_id + return self + + def entity_id(self, entity_id: str) -> "ReactionBuilder": + self._reaction.entity_id = entity_id + return self + + def id(self, id: str) -> "ReactionBuilder": + self._reaction.id = id + return self + + def create_time(self, create_time: str) -> "ReactionBuilder": + self._reaction.create_time = create_time + return self + + def entity_type(self, entity_type: int) -> "ReactionBuilder": + self._reaction.entity_type = entity_type + return self + + def user_type(self, user_type: int) -> "ReactionBuilder": + self._reaction.user_type = user_type + return self + + def build(self) -> "Reaction": + return self._reaction diff --git a/lark_oapi/api/moments/v1/model/reaction_list.py b/lark_oapi/api/moments/v1/model/reaction_list.py new file mode 100644 index 000000000..2fe9b603b --- /dev/null +++ b/lark_oapi/api/moments/v1/model/reaction_list.py @@ -0,0 +1,36 @@ +# 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 ReactionList(object): + _types = { + "type": str, + "count": int, + } + + def __init__(self, d=None): + self.type: Optional[str] = None + self.count: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ReactionListBuilder": + return ReactionListBuilder() + + +class ReactionListBuilder(object): + def __init__(self) -> None: + self._reaction_list = ReactionList() + + def type(self, type: str) -> "ReactionListBuilder": + self._reaction_list.type = type + return self + + def count(self, count: int) -> "ReactionListBuilder": + self._reaction_list.count = count + return self + + def build(self) -> "ReactionList": + return self._reaction_list diff --git a/lark_oapi/api/moments/v1/model/reaction_set.py b/lark_oapi/api/moments/v1/model/reaction_set.py new file mode 100644 index 000000000..777456355 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/reaction_set.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 .reaction_list import ReactionList + + +class ReactionSet(object): + _types = { + "reactions": List[ReactionList], + "total_count": int, + } + + def __init__(self, d=None): + self.reactions: Optional[List[ReactionList]] = None + self.total_count: Optional[int] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "ReactionSetBuilder": + return ReactionSetBuilder() + + +class ReactionSetBuilder(object): + def __init__(self) -> None: + self._reaction_set = ReactionSet() + + def reactions(self, reactions: List[ReactionList]) -> "ReactionSetBuilder": + self._reaction_set.reactions = reactions + return self + + def total_count(self, total_count: int) -> "ReactionSetBuilder": + self._reaction_set.total_count = total_count + return self + + def build(self) -> "ReactionSet": + return self._reaction_set diff --git a/lark_oapi/api/moments/v1/model/user_id.py b/lark_oapi/api/moments/v1/model/user_id.py new file mode 100644 index 000000000..63a419fd8 --- /dev/null +++ b/lark_oapi/api/moments/v1/model/user_id.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 UserId(object): + _types = { + "user_id": str, + "open_id": str, + "union_id": str, + } + + def __init__(self, d=None): + self.user_id: Optional[str] = None + self.open_id: Optional[str] = None + self.union_id: Optional[str] = None + init(self, d, self._types) + + @staticmethod + def builder() -> "UserIdBuilder": + return UserIdBuilder() + + +class UserIdBuilder(object): + def __init__(self) -> None: + self._user_id = UserId() + + def user_id(self, user_id: str) -> "UserIdBuilder": + self._user_id.user_id = user_id + return self + + def open_id(self, open_id: str) -> "UserIdBuilder": + self._user_id.open_id = open_id + return self + + def union_id(self, union_id: str) -> "UserIdBuilder": + self._user_id.union_id = union_id + return self + + def build(self) -> "UserId": + return self._user_id diff --git a/lark_oapi/api/moments/v1/processor.py b/lark_oapi/api/moments/v1/processor.py new file mode 100644 index 000000000..bc9c48c3f --- /dev/null +++ b/lark_oapi/api/moments/v1/processor.py @@ -0,0 +1,113 @@ +# Code generated by Lark OpenAPI. + +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type + +from lark_oapi.event.processor import IEventProcessor +from .model.p2_moments_comment_created_v1 import P2MomentsCommentCreatedV1 +from .model.p2_moments_comment_deleted_v1 import P2MomentsCommentDeletedV1 +from .model.p2_moments_dislike_created_v1 import P2MomentsDislikeCreatedV1 +from .model.p2_moments_dislike_deleted_v1 import P2MomentsDislikeDeletedV1 +from .model.p2_moments_post_created_v1 import P2MomentsPostCreatedV1 +from .model.p2_moments_post_deleted_v1 import P2MomentsPostDeletedV1 +from .model.p2_moments_post_statistics_updated_v1 import P2MomentsPostStatisticsUpdatedV1 +from .model.p2_moments_reaction_created_v1 import P2MomentsReactionCreatedV1 +from .model.p2_moments_reaction_deleted_v1 import P2MomentsReactionDeletedV1 + + +class P2MomentsCommentCreatedV1Processor(IEventProcessor[P2MomentsCommentCreatedV1]): + def __init__(self, f: Callable[[P2MomentsCommentCreatedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsCommentCreatedV1]: + return P2MomentsCommentCreatedV1 + + def do(self, data: P2MomentsCommentCreatedV1) -> None: + self.f(data) + + +class P2MomentsCommentDeletedV1Processor(IEventProcessor[P2MomentsCommentDeletedV1]): + def __init__(self, f: Callable[[P2MomentsCommentDeletedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsCommentDeletedV1]: + return P2MomentsCommentDeletedV1 + + def do(self, data: P2MomentsCommentDeletedV1) -> None: + self.f(data) + + +class P2MomentsDislikeCreatedV1Processor(IEventProcessor[P2MomentsDislikeCreatedV1]): + def __init__(self, f: Callable[[P2MomentsDislikeCreatedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsDislikeCreatedV1]: + return P2MomentsDislikeCreatedV1 + + def do(self, data: P2MomentsDislikeCreatedV1) -> None: + self.f(data) + + +class P2MomentsDislikeDeletedV1Processor(IEventProcessor[P2MomentsDislikeDeletedV1]): + def __init__(self, f: Callable[[P2MomentsDislikeDeletedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsDislikeDeletedV1]: + return P2MomentsDislikeDeletedV1 + + def do(self, data: P2MomentsDislikeDeletedV1) -> None: + self.f(data) + + +class P2MomentsPostCreatedV1Processor(IEventProcessor[P2MomentsPostCreatedV1]): + def __init__(self, f: Callable[[P2MomentsPostCreatedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsPostCreatedV1]: + return P2MomentsPostCreatedV1 + + def do(self, data: P2MomentsPostCreatedV1) -> None: + self.f(data) + + +class P2MomentsPostDeletedV1Processor(IEventProcessor[P2MomentsPostDeletedV1]): + def __init__(self, f: Callable[[P2MomentsPostDeletedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsPostDeletedV1]: + return P2MomentsPostDeletedV1 + + def do(self, data: P2MomentsPostDeletedV1) -> None: + self.f(data) + + +class P2MomentsPostStatisticsUpdatedV1Processor(IEventProcessor[P2MomentsPostStatisticsUpdatedV1]): + def __init__(self, f: Callable[[P2MomentsPostStatisticsUpdatedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsPostStatisticsUpdatedV1]: + return P2MomentsPostStatisticsUpdatedV1 + + def do(self, data: P2MomentsPostStatisticsUpdatedV1) -> None: + self.f(data) + + +class P2MomentsReactionCreatedV1Processor(IEventProcessor[P2MomentsReactionCreatedV1]): + def __init__(self, f: Callable[[P2MomentsReactionCreatedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsReactionCreatedV1]: + return P2MomentsReactionCreatedV1 + + def do(self, data: P2MomentsReactionCreatedV1) -> None: + self.f(data) + + +class P2MomentsReactionDeletedV1Processor(IEventProcessor[P2MomentsReactionDeletedV1]): + def __init__(self, f: Callable[[P2MomentsReactionDeletedV1], None]): + self.f = f + + def type(self) -> Type[P2MomentsReactionDeletedV1]: + return P2MomentsReactionDeletedV1 + + def do(self, data: P2MomentsReactionDeletedV1) -> None: + self.f(data) diff --git a/lark_oapi/api/moments/v1/resource/__init__.py b/lark_oapi/api/moments/v1/resource/__init__.py new file mode 100644 index 000000000..84dba83fd --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/__init__.py @@ -0,0 +1,5 @@ +from .comment import * +from .dislike import * +from .post import * +from .post_statistics import * +from .reaction import * diff --git a/lark_oapi/api/moments/v1/resource/comment.py b/lark_oapi/api/moments/v1/resource/comment.py new file mode 100644 index 000000000..27884eaca --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/comment.py @@ -0,0 +1,16 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder + + +class Comment(object): + def __init__(self, config: Config) -> None: + self.config: Config = config diff --git a/lark_oapi/api/moments/v1/resource/dislike.py b/lark_oapi/api/moments/v1/resource/dislike.py new file mode 100644 index 000000000..5b4c09cba --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/dislike.py @@ -0,0 +1,16 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder + + +class Dislike(object): + def __init__(self, config: Config) -> None: + self.config: Config = config diff --git a/lark_oapi/api/moments/v1/resource/post.py b/lark_oapi/api/moments/v1/resource/post.py new file mode 100644 index 000000000..4cf86fca6 --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/post.py @@ -0,0 +1,54 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder +from ..model.get_post_request import GetPostRequest +from ..model.get_post_response import GetPostResponse + + +class Post(object): + def __init__(self, config: Config) -> None: + self.config: Config = config + + def get(self, request: GetPostRequest, option: Optional[RequestOption] = None) -> GetPostResponse: + 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: GetPostResponse = JSON.unmarshal(str(resp.content, UTF_8), GetPostResponse) + response.raw = resp + + return response + + async def aget(self, request: GetPostRequest, option: Optional[RequestOption] = None) -> GetPostResponse: + if option is None: + option = RequestOption() + + # 鉴权、获取 token + verify(self.config, request, option) + + # 发起请求 + resp: RawResponse = await Transport.aexecute(self.config, request, option) + + # 反序列化 + response: GetPostResponse = JSON.unmarshal(str(resp.content, UTF_8), GetPostResponse) + response.raw = resp + + return response diff --git a/lark_oapi/api/moments/v1/resource/post_statistics.py b/lark_oapi/api/moments/v1/resource/post_statistics.py new file mode 100644 index 000000000..d1d5fe77d --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/post_statistics.py @@ -0,0 +1,16 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder + + +class PostStatistics(object): + def __init__(self, config: Config) -> None: + self.config: Config = config diff --git a/lark_oapi/api/moments/v1/resource/reaction.py b/lark_oapi/api/moments/v1/resource/reaction.py new file mode 100644 index 000000000..e5d008a06 --- /dev/null +++ b/lark_oapi/api/moments/v1/resource/reaction.py @@ -0,0 +1,16 @@ +# Code generated by Lark OpenAPI. + +import io +from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type +from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON +from lark_oapi.core import JSON +from lark_oapi.core.token import verify +from lark_oapi.core.http import Transport +from lark_oapi.core.model import Config, RequestOption, RawResponse +from lark_oapi.core.utils import Files +from requests_toolbelt import MultipartEncoder + + +class Reaction(object): + def __init__(self, config: Config) -> None: + self.config: Config = config diff --git a/lark_oapi/api/moments/v1/version.py b/lark_oapi/api/moments/v1/version.py new file mode 100644 index 000000000..3adb890f4 --- /dev/null +++ b/lark_oapi/api/moments/v1/version.py @@ -0,0 +1,10 @@ +from .resource import * + + +class V1(object): + def __init__(self, config: Config) -> None: + self.comment: Comment = Comment(config) + self.dislike: Dislike = Dislike(config) + self.post: Post = Post(config) + self.post_statistics: PostStatistics = PostStatistics(config) + self.reaction: Reaction = Reaction(config) diff --git a/lark_oapi/client.py b/lark_oapi/client.py index afed16c5a..bcfbe3ba1 100644 --- a/lark_oapi/client.py +++ b/lark_oapi/client.py @@ -8,102 +8,104 @@ from .core.model import * from .core.token import TokenManager, verify from .core.http import Transport -from .api.meeting_room.service import MeetingRoomService -from .api.verification.service import VerificationService from .api.admin.service import AdminService -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.event.service import EventService +from .api.bitable.service import BitableService +from .api.drive.service import DriveService +from .api.im.service import ImService +from .api.moments.service import MomentsService +from .api.report.service import ReportService from .api.security_and_compliance.service import SecurityAndComplianceService -from .api.compensation.service import CompensationService -from .api.ehr.service import EhrService +from .api.sheets.service import SheetsService +from .api.speech_to_text.service import SpeechToTextService +from .api.wiki.service import WikiService +from .api.application.service import ApplicationService +from .api.helpdesk.service import HelpdeskService +from .api.lingo.service import LingoService +from .api.mail.service import MailService +from .api.search.service import SearchService from .api.task.service import TaskService from .api.tenant.service import TenantService +from .api.authen.service import AuthenService +from .api.compensation.service import CompensationService +from .api.acs.service import AcsService +from .api.attendance.service import AttendanceService +from .api.baike.service import BaikeService +from .api.calendar.service import CalendarService +from .api.meeting_room.service import MeetingRoomService +from .api.personal_settings.service import PersonalSettingsService +from .api.verification.service import VerificationService +from .api.board.service import BoardService +from .api.document_ai.service import DocumentAiService +from .api.okr.service import OkrService from .api.translation.service import TranslationService +from .api.contact.service import ContactService +from .api.corehr.service import CorehrService +from .api.optical_char_recognition.service import OpticalCharRecognitionService +from .api.passport.service import PassportService +from .api.aily.service import AilyService +from .api.approval.service import ApprovalService +from .api.auth.service import AuthService +from .api.ehr.service import EhrService +from .api.human_authentication.service import HumanAuthenticationService from .api.block.service import BlockService -from .api.okr.service import OkrService -from .api.report.service import ReportService +from .api.docx.service import DocxService +from .api.event.service import EventService +from .api.gray_test_open_sg.service import GrayTestOpenSgService from .api.hire.service import HireService 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.meeting_room: Optional[MeetingRoomService] = None - self.verification: Optional[VerificationService] = None self.admin: Optional[AdminService] = 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.event: Optional[EventService] = None + self.bitable: Optional[BitableService] = None + self.drive: Optional[DriveService] = None + self.im: Optional[ImService] = None + self.moments: Optional[MomentsService] = None + self.report: Optional[ReportService] = None self.security_and_compliance: Optional[SecurityAndComplianceService] = None - self.compensation: Optional[CompensationService] = None - self.ehr: Optional[EhrService] = None + self.sheets: Optional[SheetsService] = None + self.speech_to_text: Optional[SpeechToTextService] = None + self.wiki: Optional[WikiService] = None + self.application: Optional[ApplicationService] = None + self.helpdesk: Optional[HelpdeskService] = None + self.lingo: Optional[LingoService] = None + self.mail: Optional[MailService] = None + self.search: Optional[SearchService] = None self.task: Optional[TaskService] = None self.tenant: Optional[TenantService] = None + self.authen: Optional[AuthenService] = None + self.compensation: Optional[CompensationService] = None + self.acs: Optional[AcsService] = None + self.attendance: Optional[AttendanceService] = None + self.baike: Optional[BaikeService] = None + self.calendar: Optional[CalendarService] = None + self.meeting_room: Optional[MeetingRoomService] = None + self.personal_settings: Optional[PersonalSettingsService] = None + self.verification: Optional[VerificationService] = None + self.board: Optional[BoardService] = None + self.document_ai: Optional[DocumentAiService] = None + self.okr: Optional[OkrService] = None self.translation: Optional[TranslationService] = None + self.contact: Optional[ContactService] = None + self.corehr: Optional[CorehrService] = None + self.optical_char_recognition: Optional[OpticalCharRecognitionService] = None + self.passport: Optional[PassportService] = None + self.aily: Optional[AilyService] = None + self.approval: Optional[ApprovalService] = None + self.auth: Optional[AuthService] = None + self.ehr: Optional[EhrService] = None + self.human_authentication: Optional[HumanAuthenticationService] = None self.block: Optional[BlockService] = None - self.okr: Optional[OkrService] = None - self.report: Optional[ReportService] = None + self.docx: Optional[DocxService] = None + self.event: Optional[EventService] = None + self.gray_test_open_sg: Optional[GrayTestOpenSgService] = None self.hire: Optional[HireService] = 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 +209,52 @@ def build(self) -> Client: self._init_logger() # 初始化 服务 - client.meeting_room = MeetingRoomService(self._config) - client.verification = VerificationService(self._config) client.admin = AdminService(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.event = EventService(self._config) + client.bitable = BitableService(self._config) + client.drive = DriveService(self._config) + client.im = ImService(self._config) + client.moments = MomentsService(self._config) + client.report = ReportService(self._config) client.security_and_compliance = SecurityAndComplianceService(self._config) - client.compensation = CompensationService(self._config) - client.ehr = EhrService(self._config) + client.sheets = SheetsService(self._config) + client.speech_to_text = SpeechToTextService(self._config) + client.wiki = WikiService(self._config) + client.application = ApplicationService(self._config) + client.helpdesk = HelpdeskService(self._config) + client.lingo = LingoService(self._config) + client.mail = MailService(self._config) + client.search = SearchService(self._config) client.task = TaskService(self._config) client.tenant = TenantService(self._config) + client.authen = AuthenService(self._config) + client.compensation = CompensationService(self._config) + client.acs = AcsService(self._config) + client.attendance = AttendanceService(self._config) + client.baike = BaikeService(self._config) + client.calendar = CalendarService(self._config) + client.meeting_room = MeetingRoomService(self._config) + client.personal_settings = PersonalSettingsService(self._config) + client.verification = VerificationService(self._config) + client.board = BoardService(self._config) + client.document_ai = DocumentAiService(self._config) + client.okr = OkrService(self._config) client.translation = TranslationService(self._config) + client.contact = ContactService(self._config) + client.corehr = CorehrService(self._config) + client.optical_char_recognition = OpticalCharRecognitionService(self._config) + client.passport = PassportService(self._config) + client.aily = AilyService(self._config) + client.approval = ApprovalService(self._config) + client.auth = AuthService(self._config) + client.ehr = EhrService(self._config) + client.human_authentication = HumanAuthenticationService(self._config) client.block = BlockService(self._config) - client.okr = OkrService(self._config) - client.report = ReportService(self._config) + client.docx = DocxService(self._config) + client.event = EventService(self._config) + client.gray_test_open_sg = GrayTestOpenSgService(self._config) client.hire = HireService(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 fa15b3087..2c3cc35fa 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.2" +VERSION = "1.3.3" # Domain FEISHU_DOMAIN = "https://open.feishu.cn" diff --git a/lark_oapi/core/model/base_response.py b/lark_oapi/core/model/base_response.py index 19da47e2d..4b71a747d 100644 --- a/lark_oapi/core/model/base_response.py +++ b/lark_oapi/core/model/base_response.py @@ -3,6 +3,7 @@ from lark_oapi.core.const import X_TT_LOGID from lark_oapi.core.construct import init from .raw_response import RawResponse +from .error import Error class BaseResponse(object): @@ -12,6 +13,7 @@ def __init__(self, d=None): self.raw: Optional[RawResponse] = None self.code: Optional[int] = None self.msg: Optional[str] = None + self.error: Optional[Error] = None init(self, d, self._types) def success(self): @@ -21,3 +23,6 @@ def get_log_id(self) -> Optional[str]: if self.raw is None or self.raw.headers is None: return None return self.raw.headers.get(X_TT_LOGID) + + def get_troubleshooter(self) -> Optional[str]: + return self.error.troubleshooter if self.error is not None else None diff --git a/lark_oapi/core/model/error.py b/lark_oapi/core/model/error.py new file mode 100644 index 000000000..470a7cb31 --- /dev/null +++ b/lark_oapi/core/model/error.py @@ -0,0 +1,77 @@ +from typing import * + +from lark_oapi.core.const import X_TT_LOGID +from lark_oapi.core.construct import init +from .raw_response import RawResponse + + +class ErrorDetail(object): + _types = { + "key": str, + "value": str, + } + + def __init__(self, d=None): + self.key: Optional[str] = None + self.value: Optional[str] = None + init(self, d, self._types) + + +class ErrorPermissionViolation(object): + _types = { + "type": str, + "subject": str, + "description": str, + } + + def __init__(self, d=None): + self.type: Optional[str] = None + self.subject: Optional[str] = None + self.description: Optional[str] = None + init(self, d, self._types) + + +class ErrorFieldViolation(object): + _types = { + "field": str, + "value": str, + "description": str, + } + + def __init__(self, d=None): + self.field: Optional[str] = None + self.value: Optional[str] = None + self.description: Optional[str] = None + init(self, d, self._types) + + +class ErrorHelp(object): + _types = { + "url": str, + "description": str, + } + + def __init__(self, d=None): + self.url: Optional[str] = None + self.description: Optional[str] = None + init(self, d, self._types) + + +class Error(object): + _types = { + "log_id": str, + "troubleshooter": str, + "details": List[ErrorDetail], + "permission_violations": List[ErrorPermissionViolation], + "field_violations": List[ErrorFieldViolation], + "helps": List[ErrorHelp], + } + + def __init__(self, d=None): + self.log_id: Optional[str] = None + self.troubleshooter: Optional[str] = None + self.details: Optional[List[ErrorDetail]] = None + self.permission_violations: Optional[List[ErrorPermissionViolation]] = None + self.field_violations: Optional[List[ErrorFieldViolation]] = None + self.helps: Optional[List[ErrorHelp]] = None + init(self, d, self._types) diff --git a/lark_oapi/event/dispatcher_handler.py b/lark_oapi/event/dispatcher_handler.py index 68ddef4a7..6a5caea45 100644 --- a/lark_oapi/event/dispatcher_handler.py +++ b/lark_oapi/event/dispatcher_handler.py @@ -15,6 +15,7 @@ from lark_oapi.api.hire.v1.processor import * from lark_oapi.api.im.v1.processor import * from lark_oapi.api.meeting_room.v1.processor import * +from lark_oapi.api.moments.v1.processor import * from lark_oapi.api.task.v1.processor import * from lark_oapi.api.vc.v1.processor import * from lark_oapi.core.const import * @@ -488,6 +489,20 @@ def register_p2_corehr_job_data_changed_v1(self, f: Callable[ self._processorMap["p2.corehr.job_data.changed_v1"] = P2CorehrJobDataChangedV1Processor(f) return self + def register_p2_corehr_job_data_created_v1(self, f: Callable[ + [P2CorehrJobDataCreatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.corehr.job_data.created_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.corehr.job_data.created_v1") + self._processorMap["p2.corehr.job_data.created_v1"] = P2CorehrJobDataCreatedV1Processor(f) + return self + + def register_p2_corehr_job_data_deleted_v1(self, f: Callable[ + [P2CorehrJobDataDeletedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.corehr.job_data.deleted_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.corehr.job_data.deleted_v1") + self._processorMap["p2.corehr.job_data.deleted_v1"] = P2CorehrJobDataDeletedV1Processor(f) + return self + def register_p2_corehr_job_data_employed_v1(self, f: Callable[ [P2CorehrJobDataEmployedV1], None]) -> "EventDispatcherHandlerBuilder": if "p2.corehr.job_data.employed_v1" in self._processorMap: @@ -495,6 +510,13 @@ def register_p2_corehr_job_data_employed_v1(self, f: Callable[ self._processorMap["p2.corehr.job_data.employed_v1"] = P2CorehrJobDataEmployedV1Processor(f) return self + def register_p2_corehr_job_data_updated_v1(self, f: Callable[ + [P2CorehrJobDataUpdatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.corehr.job_data.updated_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.corehr.job_data.updated_v1") + self._processorMap["p2.corehr.job_data.updated_v1"] = P2CorehrJobDataUpdatedV1Processor(f) + return self + def register_p2_corehr_offboarding_updated_v1(self, f: Callable[ [P2CorehrOffboardingUpdatedV1], None]) -> "EventDispatcherHandlerBuilder": if "p2.corehr.offboarding.updated_v1" in self._processorMap: @@ -545,6 +567,13 @@ def register_p2_corehr_employee_domain_event_v2(self, f: Callable[ self._processorMap["p2.corehr.employee.domain_event_v2"] = P2CorehrEmployeeDomainEventV2Processor(f) return self + def register_p2_corehr_job_change_status_updated_v2(self, f: Callable[ + [P2CorehrJobChangeStatusUpdatedV2], None]) -> "EventDispatcherHandlerBuilder": + if "p2.corehr.job_change.status_updated_v2" in self._processorMap: + raise EventException("processor already registered, type: p2.corehr.job_change.status_updated_v2") + self._processorMap["p2.corehr.job_change.status_updated_v2"] = P2CorehrJobChangeStatusUpdatedV2Processor(f) + return self + def register_p2_corehr_job_change_updated_v2(self, f: Callable[ [P2CorehrJobChangeUpdatedV2], None]) -> "EventDispatcherHandlerBuilder": if "p2.corehr.job_change.updated_v2" in self._processorMap: @@ -900,6 +929,69 @@ def register_p2_meeting_room_meeting_room_updated_v1(self, f: Callable[ self._processorMap["p2.meeting_room.meeting_room.updated_v1"] = P2MeetingRoomMeetingRoomUpdatedV1Processor(f) return self + def register_p2_moments_comment_created_v1(self, f: Callable[ + [P2MomentsCommentCreatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.comment.created_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.comment.created_v1") + self._processorMap["p2.moments.comment.created_v1"] = P2MomentsCommentCreatedV1Processor(f) + return self + + def register_p2_moments_comment_deleted_v1(self, f: Callable[ + [P2MomentsCommentDeletedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.comment.deleted_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.comment.deleted_v1") + self._processorMap["p2.moments.comment.deleted_v1"] = P2MomentsCommentDeletedV1Processor(f) + return self + + def register_p2_moments_dislike_created_v1(self, f: Callable[ + [P2MomentsDislikeCreatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.dislike.created_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.dislike.created_v1") + self._processorMap["p2.moments.dislike.created_v1"] = P2MomentsDislikeCreatedV1Processor(f) + return self + + def register_p2_moments_dislike_deleted_v1(self, f: Callable[ + [P2MomentsDislikeDeletedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.dislike.deleted_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.dislike.deleted_v1") + self._processorMap["p2.moments.dislike.deleted_v1"] = P2MomentsDislikeDeletedV1Processor(f) + return self + + def register_p2_moments_post_created_v1(self, f: Callable[ + [P2MomentsPostCreatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.post.created_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.post.created_v1") + self._processorMap["p2.moments.post.created_v1"] = P2MomentsPostCreatedV1Processor(f) + return self + + def register_p2_moments_post_deleted_v1(self, f: Callable[ + [P2MomentsPostDeletedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.post.deleted_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.post.deleted_v1") + self._processorMap["p2.moments.post.deleted_v1"] = P2MomentsPostDeletedV1Processor(f) + return self + + def register_p2_moments_post_statistics_updated_v1(self, f: Callable[ + [P2MomentsPostStatisticsUpdatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.post_statistics.updated_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.post_statistics.updated_v1") + self._processorMap["p2.moments.post_statistics.updated_v1"] = P2MomentsPostStatisticsUpdatedV1Processor(f) + return self + + def register_p2_moments_reaction_created_v1(self, f: Callable[ + [P2MomentsReactionCreatedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.reaction.created_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.reaction.created_v1") + self._processorMap["p2.moments.reaction.created_v1"] = P2MomentsReactionCreatedV1Processor(f) + return self + + def register_p2_moments_reaction_deleted_v1(self, f: Callable[ + [P2MomentsReactionDeletedV1], None]) -> "EventDispatcherHandlerBuilder": + if "p2.moments.reaction.deleted_v1" in self._processorMap: + raise EventException("processor already registered, type: p2.moments.reaction.deleted_v1") + self._processorMap["p2.moments.reaction.deleted_v1"] = P2MomentsReactionDeletedV1Processor(f) + return self + def register_p2_task_task_update_tenant_v1(self, f: Callable[ [P2TaskTaskUpdateTenantV1], None]) -> "EventDispatcherHandlerBuilder": if "p2.task.task.update_tenant_v1" in self._processorMap: diff --git a/samples/api/acs/v1/create_rule_external_sample.py b/samples/api/acs/v1/create_rule_external_sample.py index 44f95c52e..e26531616 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 1011c8017..2cc274510 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 80b72bf8c..f7e145c07 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 e395d145e..ec34ea9b6 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 6fc98b5da..a81082e8d 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 bdb236357..25cd50891 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 5a5699cea..fca8cc961 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 1422dadef..80dc72f4e 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 3d6357e6c..21e4903fe 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 b2da3f376..f60c09a21 100644 --- a/samples/api/acs/v1/list_access_record_sample.py +++ b/samples/api/acs/v1/list_access_record_sample.py @@ -5,68 +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: 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 a1959fa40..e175b2eb0 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 7c822f90b..6b3b79ade 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 c2ac6eb3d..64eeef950 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 026d0c84e..8a9053c19 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 1f2b5ac55..d65507fcc 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 6152873d0..47ab117d8 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 daec6f0a0..09cf9dbaf 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 81ae11049..fda2e74d5 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 47cc8fb1c..d1eca3b11 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 f98b038f2..eff9634a4 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 eaa88cb02..8bdac3493 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 675fcfed3..b1031d749 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 b7fe517e2..e1386123b 100644 --- a/samples/api/admin/v1/list_audit_info_sample.py +++ b/samples/api/admin/v1/list_audit_info_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: 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 5ed898c0d..0461d7291 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 085259d31..5c612317b 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 763c7fa23..3e8724df0 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 3698c60ec..3b057ae02 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 032cd2aa8..562af01ec 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 ac888b1f9..c52f4f83b 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 7d54abda3..bbd45425d 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 21fb3484e..13e77dda2 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 6a30f87e5..3c6acc281 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 28bd22c0e..9f6704ca6 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 23c23a99f..3c53aa88f 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 b42c5ea9f..a1cbc5041 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 c3f6a14a6..d9bd49722 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 e79540d29..c6be9a633 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 f466b8137..0cf73c547 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 e60077e2f..30c188915 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/apply_scope_sample.py b/samples/api/application/v6/apply_scope_sample.py new file mode 100644 index 000000000..1d3e0ac88 --- /dev/null +++ b/samples/api/application/v6/apply_scope_sample.py @@ -0,0 +1,60 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.application.v6 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: ApplyScopeRequest = ApplyScopeRequest.builder() \ + .build() + + # 发起请求 + response: ApplyScopeResponse = client.application.v6.scope.apply(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.scope.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)) + + +# 异步方式 +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: ApplyScopeRequest = ApplyScopeRequest.builder() \ + .build() + + # 发起请求 + response: ApplyScopeResponse = await client.application.v6.scope.aapply(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.scope.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)) + + +if __name__ == "__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 b83fd3f17..dab68f774 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,72 +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: 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 1fce212c2..07a9da338 100644 --- a/samples/api/application/v6/contacts_range_configuration_application_sample.py +++ b/samples/api/application/v6/contacts_range_configuration_application_sample.py @@ -5,66 +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: 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 19640e583..d86f54917 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,64 +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: 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 49a9c41f4..795e6b0c1 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,76 +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: 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 21da2653f..821708022 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 11ae9f68c..3d5119749 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 d0d89e63f..540c60127 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 2ef4ee172..c8f131c4c 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 0a8fd4ed7..0be9991e9 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/list_scope_sample.py b/samples/api/application/v6/list_scope_sample.py new file mode 100644 index 000000000..7e8cd0379 --- /dev/null +++ b/samples/api/application/v6/list_scope_sample.py @@ -0,0 +1,60 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.application.v6 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: ListScopeRequest = ListScopeRequest.builder() \ + .build() + + # 发起请求 + response: ListScopeResponse = client.application.v6.scope.list(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.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)) + + +# 异步方式 +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: ListScopeRequest = ListScopeRequest.builder() \ + .build() + + # 发起请求 + response: ListScopeResponse = await client.application.v6.scope.alist(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.application.v6.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)) + + +if __name__ == "__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 5a95b5abe..d90158fac 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,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: 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 76d641e91..61544b235 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 c1268a468..8a96f859c 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 00967637d..0c78af6ba 100644 --- a/samples/api/application/v6/patch_application_contacts_range_sample.py +++ b/samples/api/application/v6/patch_application_contacts_range_sample.py @@ -5,72 +5,73 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 199396788..6f44d2db2 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 1ba74794b..093b519cf 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 262ad0e45..afa508def 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 557af3d00..ad29954d2 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 951f015e2..879302830 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 1a1cb6ed2..726211d6f 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 8cf7cf6a8..e6b113ab7 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 532387255..1c6a6cf3c 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 b07c3a6d2..cb5f9bd83 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 97e88c83a..b63bb4fd3 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 b80cbafe2..37c64e7fe 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 c24783c72..f93b9083e 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 a22889ff6..12dfd6722 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 a11801e4c..11d6f9bdf 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 110a4b451..b0e413fc2 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 302e49119..98a2ed661 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 abf3ddae7..dc3c3961a 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 ccf702987..e8e776449 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 126b75135..34557791b 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 93b542d9c..1f7a828bd 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 0582c3f77..8c6b031d0 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 1ee9e1b69..f29ac0897 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 b81a57ce7..7f46f6c73 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 8c24bd246..4acd28ce9 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 9596ace2b..688aa44b4 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 d458da89e..6c2353c6b 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 593617a3a..806a25e36 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 0027c43ab..e40a7f4b9 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 9fdcbdd92..b32973054 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 f995f09c8..bf0856e96 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 bca433767..320250601 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 01d7f9e0a..df2e31f47 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 cb636e8d8..8d966ded2 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 2fdd4dcce..5d13b98da 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 eaea16f1b..30b2d5c1a 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 b47202c89..3e7137dc9 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 5a643c151..1cabc9a02 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 0b3d13a53..a8e2e1768 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 a01be5dc9..a1a7dc966 100644 --- a/samples/api/attendance/v1/create_shift_sample.py +++ b/samples/api/attendance/v1/create_shift_sample.py @@ -5,92 +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: 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() \ + .employee_type("employee_id") \ + .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() \ + .employee_type("employee_id") \ + .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 8ba58c47a..0a1886037 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 0f03f75a5..95134e202 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 3bfddbd0e..e0c109c7f 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 a26080950..a12b4e3a5 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 332ea6257..c223a7d86 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 201e4083f..86127436e 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 0c8d7af3a..69046ff27 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 212e4c51b..40f68d592 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 f5c18ba76..8adf20d7c 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 60b43a62f..62a063add 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 41e5a5a65..f5f687d46 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 a6a0831e6..2b10e8f7d 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 9c2e9205b..2211ad0f4 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 088da3ff5..4b5c907d4 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 8ec2b761a..662980caa 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 65b1d1fd8..328d21556 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 7b092358e..c20ff457b 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 39d4d9d41..f4c397b86 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,66 +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: 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 96c7ad128..639aeabea 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 2f3932de7..86bfd74df 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 c6ee9ac0a..2a8b7db83 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 f3c39fcdb..cc099214f 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 15094c2e0..4e1fe8c49 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 441d2a03c..5a2b8cf20 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 7ab58713a..d2f6b871e 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 17c4ce7dc..d716fbeac 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 05d063bc4..4996636a3 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 da761abc1..36e29e3d0 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 e8611a6b7..71af7c657 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 b4ee26c91..56ac79008 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 3762ef982..1e1c30d24 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 1fa96ceec..55c98a226 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,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: 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 4a63da9d2..3bd7a3b7f 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 183405212..3b0361f92 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 83f5020e3..a70f5bb26 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 ea4ee4151..fd243d84e 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 3a0454706..e29a687bb 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 2fd4262fd..4714c033d 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 3e4caa75c..26729a441 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 b4d77b2c1..da3533bf6 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,64 +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: 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 d389e6ea3..501b21a34 100644 --- a/samples/api/authen/v1/create_refresh_access_token_sample.py +++ b/samples/api/authen/v1/create_refresh_access_token_sample.py @@ -5,64 +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: 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 2bb36bf1e..2c0c59526 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 f60d02427..96715d8cf 100644 --- a/samples/api/baike/v1/create_draft_sample.py +++ b/samples/api/baike/v1/create_draft_sample.py @@ -5,76 +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: 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 fbd7d02dd..d286b9a3c 100644 --- a/samples/api/baike/v1/create_entity_sample.py +++ b/samples/api/baike/v1/create_entity_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: 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 97acf19ba..fbb0231fb 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 4c6bb35f9..fa4157ca6 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 dfce33f75..a5fdc057a 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 9699d50a1..5d8581ce2 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 4b787381a..ebc9c1e8d 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 7653f3d4b..0e9ce51d3 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 ec9a49081..9e58ac80b 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 a140b128e..da2155cc7 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 12b5eaf02..692eab633 100644 --- a/samples/api/baike/v1/update_draft_sample.py +++ b/samples/api/baike/v1/update_draft_sample.py @@ -5,76 +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("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 69bdfde52..f6a1ef466 100644 --- a/samples/api/baike/v1/update_entity_sample.py +++ b/samples/api/baike/v1/update_entity_sample.py @@ -5,76 +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("") - .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 e2bc86864..954672fad 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 87d19cb0b..ce56ab550 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 e921bc33f..b8e20572f 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 759d34400..796ab791d 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 5740ef89e..e781a45c9 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 e8e46b99c..142415d63 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 f147bc1de..84db3fbe9 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 25a1dfc18..533e79e93 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 1044e404e..67cc43a3a 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 59ea521a8..2811c1985 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 ca844ef6a..91c068eb8 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 9af172acb..96e84db77 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 90159fd1f..9e98db7f1 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 0d58d14c5..b27417e74 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 415f5f332..c714c7419 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 7be5c11a1..426896c79 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 602b3423a..70691dc26 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 da9893a98..245c76040 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 23ab17390..1fb21dfaf 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 1de954171..5ccedca29 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 209df5b6c..8c96f418a 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 6ad1b7908..70d1b0a6b 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 26d11f1b6..74b3fcb1a 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 5748338ff..c3417f4ad 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 a633ed5a9..315e78342 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 9c2531933..e7b2b3e94 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 e1ceacf2d..2af1822a4 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 0f28af4d8..c9ef86805 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 2a25c9292..227216fc6 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 65af9fd80..7819ed566 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 efbf3ad73..e2630dc90 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 948a22d55..c267fc9a0 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 21a05c057..3af54e646 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 dffc86db4..b100d4d2c 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 2995dab46..a25b3754c 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 4decd12e6..0902b5338 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 4356c1027..b270840f2 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 1370b527e..6f6134108 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 bb33e3524..8ca8a46dc 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 1e87e3098..8607a3670 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 74e1d6365..d5b246956 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 347db68f4..93228ac93 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 ba5769737..b48795cc1 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 914823699..ddbda2290 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 49b04d4d8..4ed1fe8e0 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 990246895..f5e19ae49 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 3ab68343d..d5d270cbd 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 91883de4a..1de82377c 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 08fa0bd45..47721ea9a 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 b0c031fce..080819b5c 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 ec9e62cbe..72bb442d8 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,76 +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: 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 ded9581f0..b22ff9c6e 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 e52aa45ab..77e93d830 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 a53be0ddb..273d6f61e 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,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 40876632b..ba964a12e 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,60 +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: 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 7875e38f4..b91138877 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 781c2b84c..2e10cf70b 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 02fb8f08d..ec8c7245b 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 c433ae5be..2d18535c9 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 f017f0fb6..2abcf88c8 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 ab8cd7ee3..aab799d10 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,62 +5,63 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 908f1eae8..d42f2828a 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 8a0f2fa3e..75ad33085 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 23521b0b9..f9f5c7f09 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 cba9e3e83..174c7d04e 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 7f9791d29..5fa82b064 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 a38ef9565..4fa8a8c13 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 138963b87..3d7854931 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 92594a754..d05f0cf68 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 982b1e654..c722ed78e 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 dd61d5fc8..78b061227 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 4404a2d0e..628cf2fe6 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 a8d86a1c3..2c2f88eff 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,68 +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: 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 c8ca63b49..124749d20 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 84c9530be..126590070 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 39e476cf0..d2d8d23db 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 3f92bf648..c023b06ea 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 a26d5b249..795994f34 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 b85b799b6..77479cebb 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 b685e4cfe..60f7d97b8 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 7668e3212..fd31e4ae9 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 fe8e9cfa3..a0c9a60ab 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 1fe9872d6..5919f6f51 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 1699cc131..e5f72c5e7 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 fb9d048e2..8ef0475d3 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 e4234f516..50d1f2a01 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 5766c5ff9..b61233b48 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 b06cbea6a..0123da4c1 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 7ac2b3b8b..46d3d6ef1 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 3e47f4ccb..8e027f77a 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 bd3df98ad..e0411508f 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 c528ca151..73f487d32 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 be023f614..8ce3d22b3 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 cd5492b16..4f98c0182 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 e6dbd7a32..8672ff956 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 fb07e9c32..34d71f2d8 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 d1ca7e448..b3e3d2cee 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 bfeaad12f..cb83adfbc 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 66413788e..5165ec0a3 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 b02676c60..eeb77e3c6 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,66 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 683e2f8df..01d2ed9e1 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,66 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 b5df30875..f45aef3f8 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 92a071371..7542ed492 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 4081cf3c2..23709ddaf 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 27597c60a..604146a97 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 98b77c35b..3cc42b025 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 408a745ce..d9d367657 100644 --- a/samples/api/contact/v3/children_department_sample.py +++ b/samples/api/contact/v3/children_department_sample.py @@ -5,68 +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: 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 446a2895b..1ffb8fd4f 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 7588f29c6..2bf114e10 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 21d56c465..b6011efc6 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 956fe5dce..34412dfa1 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 6f527f2d8..79daa9644 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 8fa6dbafc..2d7437ae4 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 03c878b98..2f803d318 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 59361215d..f353e2942 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 dfe130bdb..4b3c57135 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 101336df0..ad345207a 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 459f9fcf5..44984dec1 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 94f8948fa..e141c5a7d 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 b0b438597..985927000 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 c2251f05b..9dc39de3b 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 6f8319385..d64a8f6d4 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 42c3966a7..a56fe2bae 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 c425a2d0f..3d04c614e 100644 --- a/samples/api/contact/v3/find_by_department_user_sample.py +++ b/samples/api/contact/v3/find_by_department_user_sample.py @@ -5,66 +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: 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 d07872d84..609ced0f1 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 89889024b..6cac3b140 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 1ac465e0e..2a63bda95 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 127de530e..1c89a29d1 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 a85c3108c..e8cd6b869 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 b27a15ae7..01a561624 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 8a0258cf9..96894170f 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 1ff83ba73..e2c58c25f 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 d2cb61c4f..9a8ed4bdc 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 bedeec85d..a4c753fea 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 626f35ed2..9df479150 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 0d6543139..63a50c7f5 100644 --- a/samples/api/contact/v3/list_department_unit_sample.py +++ b/samples/api/contact/v3/list_department_unit_sample.py @@ -5,64 +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: 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 36ed0f923..0aa100191 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 9a9a5c85d..91a86104f 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 1f635d73f..f38230b08 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 31451a7a7..72bd60869 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 f315742ca..e30102b71 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 7dde0c041..672e31c7e 100644 --- a/samples/api/contact/v3/list_scope_sample.py +++ b/samples/api/contact/v3/list_scope_sample.py @@ -5,64 +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: 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 735daff8d..2219cdf6e 100644 --- a/samples/api/contact/v3/list_unit_sample.py +++ b/samples/api/contact/v3/list_unit_sample.py @@ -5,60 +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: 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 b7d99e1e7..1d6e43e2f 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 3b0e709c9..713032913 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 e2d93930a..0843b6561 100644 --- a/samples/api/contact/v3/member_belong_group_sample.py +++ b/samples/api/contact/v3/member_belong_group_sample.py @@ -5,66 +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: 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 4965afb90..3448644aa 100644 --- a/samples/api/contact/v3/parent_department_sample.py +++ b/samples/api/contact/v3/parent_department_sample.py @@ -5,66 +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: 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 aa8d36073..a347e6251 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 332374565..47a47bc19 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 75dffd74f..3f6e1629e 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 ed79815d6..cd570422d 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 b7a754877..6f73557e7 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 fca60dd12..8a01ba7ac 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 bd7f8dc62..0a544b4a7 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 d03658925..8dcd4b774 100644 --- a/samples/api/contact/v3/search_department_sample.py +++ b/samples/api/contact/v3/search_department_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: 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 4b441f9a4..0b2ebff42 100644 --- a/samples/api/contact/v3/simplelist_group_member_sample.py +++ b/samples/api/contact/v3/simplelist_group_member_sample.py @@ -5,66 +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: 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 606657362..060d0f3e8 100644 --- a/samples/api/contact/v3/simplelist_group_sample.py +++ b/samples/api/contact/v3/simplelist_group_sample.py @@ -5,62 +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: 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 37f1a945f..b47d7e261 100644 --- a/samples/api/contact/v3/unbind_department_chat_department_sample.py +++ b/samples/api/contact/v3/unbind_department_chat_department_sample.py @@ -5,64 +5,65 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 78f0828c0..f021c4b68 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 c2a49f7af..62fd9d660 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 867338652..fd5b099d8 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 b3be0cf15..b81794065 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 67b062867..6b6f960c4 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 2e8bb6dda..61d95afab 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 33b0072ee..fd9d75149 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 e6fd7d6c4..f07775214 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 7c07513b5..c87c441cf 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 0a32a3ff7..adbd928a2 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,68 +5,69 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 e08641cee..bbdc74e1d 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/calendar_by_scope_leave_sample.py b/samples/api/corehr/v1/calendar_by_scope_leave_sample.py new file mode 100644 index 000000000..f298add1d --- /dev/null +++ b/samples/api/corehr/v1/calendar_by_scope_leave_sample.py @@ -0,0 +1,74 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.corehr.v1 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: CalendarByScopeLeaveRequest = CalendarByScopeLeaveRequest.builder() \ + .wk_department_id("") \ + .wk_country_region_id("") \ + .wk_employee_type_id("") \ + .wk_work_location_id("") \ + .wk_working_hours_type_id("") \ + .wk_job_family_id("") \ + .wk_company_id("") \ + .build() + + # 发起请求 + response: CalendarByScopeLeaveResponse = client.corehr.v1.leave.calendar_by_scope(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.calendar_by_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)) + + +# 异步方式 +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: CalendarByScopeLeaveRequest = CalendarByScopeLeaveRequest.builder() \ + .wk_department_id("") \ + .wk_country_region_id("") \ + .wk_employee_type_id("") \ + .wk_work_location_id("") \ + .wk_working_hours_type_id("") \ + .wk_job_family_id("") \ + .wk_company_id("") \ + .build() + + # 发起请求 + response: CalendarByScopeLeaveResponse = await client.corehr.v1.leave.acalendar_by_scope(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v1.leave.acalendar_by_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)) + + +if __name__ == "__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 d3fb98cea..0a7df8acb 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 b63cd5908..c13c2d1ac 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 3cb45539f..9e669df8e 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 f540fb341..f3d3d0744 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 a22442e3b..5f64bc312 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 fa1d11727..766349647 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 f853729d5..7b328ae80 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 a3a57ae3c..4c2221eb7 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 5034c95aa..218c51591 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 98c0f15fa..79be77e0f 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 2fd40b0e2..0e4e105b9 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 41b7c4e9e..e73f923d7 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 1c9ab7d62..99ce83883 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 9678b07ae..663f9a775 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 1ba219210..1789a2305 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 2faae6b70..27272db6e 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 6c4069cb5..f40adff89 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 b948b0c6d..50c6fd2d4 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 fcd830847..c2900cdb0 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 85e7057c7..199c8dc32 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 b234b808a..3162700c8 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 b27667b24..4156a952b 100644 --- a/samples/api/corehr/v1/delete_job_data_sample.py +++ b/samples/api/corehr/v1/delete_job_data_sample.py @@ -5,58 +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: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ - .job_data_id("467642764726472") \ - .build() + # 构造请求对象 + request: DeleteJobDataRequest = DeleteJobDataRequest.builder() \ + .job_data_id("467642764726472") \ + .version_id("1616161616") \ + .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") \ + .version_id("1616161616") \ + .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 4fa368180..4a795d303 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 82cdd065d..c4087e5ae 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 82c27c5fc..51a1f7b50 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 46b8c3af4..d47a174b3 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 33301a5b1..34ce890b4 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 28f68eb58..48f9549ea 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 017cf7bc8..1ee558f6f 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 3837d0237..fb118a699 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 dbb01410e..8390cfbb0 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 6098ea82f..9cc3ef223 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,68 +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: 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 6fae96718..8fb5ba24b 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 a042ac0df..b1936038c 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 aa6d6a868..e8f5f8196 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 e2ef08cad..b2d81e2b7 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 70e66eb36..c0004aca7 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 91b5bc996..6faaac98e 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 f727394c2..e589c20c1 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 038beebf6..3c7bf03c5 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 c47a54d13..a02012c37 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 0bf939e36..0ef05b9ca 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 a39e73cce..33a4ed337 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 9bd6b5379..ab98b4eab 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 804ada585..b18fcdbf4 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 28d465773..2714d9a88 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 42f43e442..631420db5 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 101f28ccb..1066ef811 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 bf4bb99ab..705a6321e 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 c19bb7c79..a1cdea1f6 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 23d91a6a3..920577399 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 ab49c43ad..67f0aad58 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 c45336e81..4394638dd 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 edcb9528b..8703527fc 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 816586351..f69f1c00b 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 1c25acae9..1d948b5fb 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 fa7ee81bb..d14716be6 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 34a9a6d8b..55c51d8e5 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 d4ac05b9f..630f93edd 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 e89580c4e..47a9c8518 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 bfaef36fa..9337db13c 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 667a5ccb9..44d6d3e0f 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 a5321560a..2e3a09548 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 3729d38f6..eaf9d2a12 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 67a172135..f72e3ffb5 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 a6d7d13c9..e3afa9ab3 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 b00c9a056..c14a44e01 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 b0d45fca2..202890b33 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 87651beb5..fd9dc4386 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 b789c4def..42883513e 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 77686ed4a..203869470 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 36ac11d05..02ac9602e 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 847e5db1b..53fa7e1bb 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 44e4e95a9..fb9249df5 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 067f1071f..05140fbc6 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 c8a064c58..71f56df58 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 208f9031e..f17af136f 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 988920bab..c22510cab 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 ae7c2b316..56b78416b 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 60e117f84..35f61e50b 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 c5b0e1086..87d28fc97 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 0f802aca4..19950897e 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 31f17efd5..4b51087ff 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 afff7f0b0..b28b49943 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 a4436856f..1aeb4b2c1 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 274a42bd0..fedf55e2c 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 d86ed8974..a7ecfb0d7 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 a2e74b0f0..7e2f9fed0 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 b1dc04c8f..477e4f775 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 7155e6e23..19639591d 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 c973c9b8e..999ceb38b 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 661784208..ab2f87fcc 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 ddd4b1758..b39a10b8c 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 afe4043cb..77a84b683 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 afe825c8a..b094dd75d 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 9a8e230f7..6b3fa5c6c 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 1e51c3b2d..ac5180e79 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 37833ad98..f42d61f9f 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 7f70ebe3a..005900706 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 902ec5915..2101b5988 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 448c5aa97..c62499cb6 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 b70013e01..d72e464a5 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 ceca244d9..651994039 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 e4af5d632..7c126b69f 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 77b7f6e74..e16ec4773 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 995386f6f..65d766361 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 f02de5deb..d5466c734 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 13e5cc383..d7cd67eec 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 c17ab4687..5cf4a03bc 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 2bd899b2d..720b549b0 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 177304e0f..2dbd7697d 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 d9473f096..20f7e4859 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 50b6c2368..ff6c37446 100644 --- a/samples/api/corehr/v2/create_person_sample.py +++ b/samples/api/corehr/v2/create_person_sample.py @@ -5,126 +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: 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") + .nationality_id_v2("6862995757234914821") + .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") + .nationality_id_v2("6862995757234914821") + .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 39af87881..7964cf36c 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 e5f31f491..562e7fea7 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 2e65afb3a..2923c247d 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 e30ff1bf4..346dbeb94 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_department_sample.py b/samples/api/corehr/v2/delete_department_sample.py new file mode 100644 index 000000000..12e7938fe --- /dev/null +++ b/samples/api/corehr/v2/delete_department_sample.py @@ -0,0 +1,64 @@ +# 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: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("1616161616") \ + .department_id_type("open_department_id") \ + .build() + + # 发起请求 + response: DeleteDepartmentResponse = client.corehr.v2.department.delete(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.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)) + + +# 异步方式 +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: DeleteDepartmentRequest = DeleteDepartmentRequest.builder() \ + .department_id("1616161616") \ + .department_id_type("open_department_id") \ + .build() + + # 发起请求 + response: DeleteDepartmentResponse = await client.corehr.v2.department.adelete(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.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)) + + +if __name__ == "__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 b50fb6f0a..a07e6b4a6 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 e485cdb47..9565a2ee4 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 54cc488e1..d6f239b40 100644 --- a/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py +++ b/samples/api/corehr/v2/enable_disable_assessment_probation_sample.py @@ -5,64 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 25d43ba90..cdb16b239 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 b04e53893..6636cdbfe 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 447453eb8..b50ccd94d 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 24b8f2f75..4decddbd9 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 ea07712b9..e7e5b3972 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 873fe4a92..20370253e 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 df800f90b..5d7ab8edb 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 0ccd96c40..4336c7f9c 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 fbdaee956..fd09ea30e 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 b10e56807..9853d8813 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_department_sample.py b/samples/api/corehr/v2/patch_department_sample.py new file mode 100644 index 000000000..c13574b92 --- /dev/null +++ b/samples/api/corehr/v2/patch_department_sample.py @@ -0,0 +1,90 @@ +# 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: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("1616161616") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(DepartmentForPatch.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.v2.department.patch(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.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)) + + +# 异步方式 +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: PatchDepartmentRequest = PatchDepartmentRequest.builder() \ + .department_id("1616161616") \ + .client_token("12454646") \ + .user_id_type("people_corehr_id") \ + .department_id_type("people_corehr_department_id") \ + .request_body(DepartmentForPatch.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.v2.department.apatch(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.corehr.v2.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)) + + +if __name__ == "__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 833b9c596..4a0ece6ac 100644 --- a/samples/api/corehr/v2/patch_person_sample.py +++ b/samples/api/corehr/v2/patch_person_sample.py @@ -5,130 +5,132 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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") + .nationality_id_v2("6862995757234914821") + .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") + .nationality_id_v2("6862995757234914821") + .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 303554be7..80a388826 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 03a5ad7ad..04746bf98 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 e697a6968..4b5e35a7c 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 6aeb01159..25d21ac8f 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 dc5a3a147..6d3f4d59e 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 441658f9d..8785bbd4c 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 8b6440a8f..dcc2490f6 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 8461ae435..b02d73815 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 ad57ff9f3..52d9a1dc6 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 3194cadd7..8c7d4f81d 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 e435f6c61..c19ee7bb7 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 776974f7d..668b6e283 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,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: 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 2fe9866b3..2c844630e 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 05b0a51f7..adfb42c1a 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 553d5857a..edb6ea163 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 4eb603442..51833c0d4 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 159566142..51c4a9198 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 1d088ab9a..aadc71238 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 19483ac4a..ef73e2bdb 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 8d4d303b7..0bc8ba8d5 100644 --- a/samples/api/corehr/v2/search_job_change_sample.py +++ b/samples/api/corehr/v2/search_job_change_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: 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() + # 构造请求对象 + 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") - .target_department_ids([]) - .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 f54d68a2b..c77d985b8 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 99c94236d..1657a533b 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 764194791..242c88593 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 e6b95350b..1d84c62db 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 index e15f70316..3ec7c9be9 100644 --- a/samples/api/corehr/v2/tree_department_sample.py +++ b/samples/api/corehr/v2/tree_department_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: 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() + # 构造请求对象 + 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) + # 发起请求 + 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 + # 处理失败返回 + 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)) + # 处理业务结果 + lark.logger.info(lark.JSON.marshal(response.data, indent=4)) # 异步方式 async def amain(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.DEBUG) \ - .build() + # 创建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() + # 构造请求对象 + 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) + # 发起请求 + 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 + # 处理失败返回 + 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)) + # 处理业务结果 + lark.logger.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/update_process_approver_sample.py b/samples/api/corehr/v2/update_process_approver_sample.py index ed4f4e2a9..ccb695495 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 e1b78eb5e..adfe0ae24 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 5f4179eac..c33ee77a8 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 301660a26..047f245af 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 1dba9f3d0..5b351fb0f 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 b680fe7e4..cf293ab4e 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 659f7da1b..0576ad927 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 d6f10af47..dd0e7f585 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 c0c65f0e5..26f31253f 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 b958a35b8..aa942bc4f 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 eb7aba611..4da4e06c1 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 e78b8809c..6cb800077 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 6313bcc48..9a4312f1f 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,64 +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: 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 92f51fce6..2b654eb7d 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 46c33694a..b831c3665 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 ac966c458..4275c3823 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 decf04207..fdd4ac8f4 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,64 +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: 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 09615982c..cb5337424 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 20255adfc..c25691661 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 21c915497..8b19aa849 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 cec2b026d..39692b2a1 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,72 +5,73 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 1442bde48..9a87f7f94 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 cb3071a4b..70515e18c 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 aae08f870..f31548b85 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 07a053935..e5ea51ff9 100644 --- a/samples/api/docx/v1/get_document_block_children_sample.py +++ b/samples/api/docx/v1/get_document_block_children_sample.py @@ -5,68 +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: 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 1b239a03b..5a7a94536 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 246731a01..3606eb9c8 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 07387a762..2d7eca9af 100644 --- a/samples/api/docx/v1/list_document_block_sample.py +++ b/samples/api/docx/v1/list_document_block_sample.py @@ -5,66 +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: 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 4f6a60963..2213366da 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 010533be8..257df42a8 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 bedbde7b6..3012c5fcf 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 9d106cf96..38b71d262 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 730868d2b..7b6168dfe 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,60 +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: 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 6fd973b26..a739a2f0d 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 2380dd75d..86d3481ac 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 700a983d2..eb22a6d08 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 9c3d89f98..57619e8cd 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 93005f2ea..f79d19127 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 274477ea5..ea9e5bee9 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 8ae2027b5..a12fa8a0a 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 22001c38f..db7e6d429 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 e628cbf6b..e94657969 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 7d57ea7fc..ab52bb26d 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 2491d824c..4224bcbb7 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 5021ccf49..c0b45c1fa 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 3aee9236f..c32719892 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 af7efb059..be01e3a79 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 a73b2ab98..23226c7e1 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 9ef0e47c3..89e34e21d 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 b4430d27c..c21863960 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 4c6e1cd76..9731279d4 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 57e79bd3e..9629c6006 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 72acbe179..9466b1db2 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 64b85a02d..8687e30a5 100644 --- a/samples/api/drive/v1/download_media_sample.py +++ b/samples/api/drive/v1/download_media_sample.py @@ -5,64 +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: 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 8e73e6d8a..b6cd00ee3 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 cb05dff42..4168c697e 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 1b805e9d8..799a4a38f 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 13e730d50..ee24acb5a 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 68bd53593..cde7e3ac9 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 7efaeaa6b..6a8f0521c 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 abe9e1a66..af94c588a 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 b93cb0a8b..85ff7802e 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 eacf32738..196fa9eb5 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 0c4d30f6f..484c89ed5 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 9793b8547..197922ec5 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 a4503ef3d..7ba4a7135 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 21e092fc8..2ab1d16c0 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 09876f20c..c05736a32 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 48bcb09ae..6008caf55 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 26be7d813..bd71b0d9f 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 01dafb459..4d4b24923 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 108eab56c..876171e9a 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 659197741..c0f577ff7 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 e510b1b5f..c06579948 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 d9ba8366d..946f72f8b 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 99ee59d78..88dace5a6 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 28c3f4c4c..85084ba97 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 bc733f813..acc74f4f6 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 cca9e42d5..70fca0121 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 a1da74724..73c7b8b0d 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 a444f9a5d..f9585b75c 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 4a73ab171..d7e3e584c 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 280e7c678..d37bbc5bb 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 10db7b993..cfa1c8db5 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 7fb3ee223..e08645c19 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 39d0ad092..4deb3c9b5 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 bfea18217..4068d6996 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 6ae6bbc20..3d3ee081c 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 780a71886..5073fbd1b 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 47d73888b..5e8428735 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 90698130a..6ab179464 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 55c482ca9..536e7b8c8 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 64e802287..f84f92b8b 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 8d1c91f97..e6a17c983 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 1c384353f..5a1313897 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 a09c79ae4..546e7ee1c 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 44741ca02..caed37c2c 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 51b93fa6f..a0168bc9b 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 ace0de31b..e5ab3b596 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 1f976827c..579459318 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 31ef0edaa..3c114b64c 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 bacabafdb..810c1b72e 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 d189461a1..aa35dc092 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 63a2c8b4d..609509ea7 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 be38fe343..38c0b804c 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 85e7b9939..352f9665a 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 6a1e8d059..8ebafde57 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 9a2e6537e..0b7160366 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 8234f7106..40196df0c 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 9c2ec512d..54753f782 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 d64596795..4b466e766 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 a72eedcaa..d21cba0a8 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 4eb597160..d3a28a38e 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 f8f6644f9..d4aa79d97 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 e9ed5fd83..b4b0766eb 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 ad2017051..1c37948f3 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 b7e38a259..9ad0fe3b6 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 07ed32818..03ec4b53e 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 129efbf9c..e73e77d62 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 579b4e741..4bea8749b 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 3e79e39f7..ee2a701b2 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 74c66af2b..9984aa28a 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 853e24ee0..6a1126590 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 a559a93c7..9d54f0875 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 021114c7d..771a10073 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 ab3a5dc1a..1f5e5f554 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 d5210d5b6..cbefcfd68 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 09203cea8..72cbc7f60 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 7cc7160ff..d9fdf9a3b 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 7310aae28..a11cfb390 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 8ff1195e6..30a4d345d 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 4ee5625b9..fb24f5bfa 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 1a9c82e64..2e22a51b0 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 709a258f1..7bbdbdffa 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 2fae4c91d..26c909923 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 3c0887708..dbe5790a7 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 d1b658d2a..b97b10bbb 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 083cd871e..a6a2fa250 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 75a9c42ed..c9ac3a91b 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 198595c53..4fa5b9a5f 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 3c42d00b9..be0286090 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 287cf2c66..01461bec6 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 fcff44f5b..95002f8d1 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 7e66de3ec..016dbb4b7 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 f0f0bba4d..e26d31b12 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 1f65aea5d..785e52a3c 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,64 +5,65 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 6e599dc03..69805ba7c 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,62 +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: 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 65beb8c52..9e2def4c1 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,66 +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: 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 01b7636cf..03935d3e1 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 ea3cfa882..f139789d6 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 37bcb1a4f..477dc3567 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,64 +5,65 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 18c680e7f..db5427b30 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,64 +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: 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 114e4d413..8f9014c58 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,66 +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: 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 9be2c778c..00f0af87e 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 ab3870d8c..8b7ac1cd5 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 c079ec241..8e84f8d34 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 4ec1d2c09..638930a1a 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 a46039c9b..a01eb41c4 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 9bcac09a4..ea043db62 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 2f12bf248..d2c24266c 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 f831505d1..801d9c7fb 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 dded7c7b9..1e3a7d133 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 b7c37e404..c94784212 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 819a3b985..359bec00f 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 107986814..dc2e19929 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,80 +5,81 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 6777ceec1..8537cd942 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 acc413558..14068b12a 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 84ba8b90e..d1017db83 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,64 +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: 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 8c6292ac3..4e1f844e7 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,66 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 a9d3b5a8d..1d2497e38 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 1c8ce16b1..0c1bd305b 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 1f9f4854b..2ae97a647 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 30733a915..d0a68b258 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 7b1ea72a6..0abfdf897 100644 --- a/samples/api/hire/v1/create_external_interview_assessment_sample.py +++ b/samples/api/hire/v1/create_external_interview_assessment_sample.py @@ -5,72 +5,73 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 ff32cfd14..a65bb6c25 100644 --- a/samples/api/hire/v1/create_external_interview_sample.py +++ b/samples/api/hire/v1/create_external_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: 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() + # 构造请求对象 + 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) - .interview_assessments([]) - .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 3a7e30a01..94764ec3d 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 1125d1ece..b1315878b 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 d914839a0..546ae49ad 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 98f62174c..4ffb2ff27 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 ac9c7a1a5..350df24e7 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 dc5a0b2d3..183f64f9b 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 e4ae61808..4452cbaee 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 da493f53f..063f716fb 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 82607fe67..268a7ab03 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 122db6992..7e2f590a0 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 4e818039e..af6158a41 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 24bc55115..e2687ec2a 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 620d71798..dd0b19857 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 dcfba6742..bc7f1ec1e 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 c8e544477..3ee7fc8cb 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 25da506f6..d2e832445 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 a7cb279fe..3cd13c042 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 4122fc843..864f377a1 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 46ed64464..55e0f2a50 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 96a96ed9c..3ff53b70b 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 b93814bbd..c398bb875 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 644317a14..c1954bad1 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 cd43b170a..bd837c962 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 96edea210..daf2451d9 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 47e3f5d7e..0767c70f4 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 2bd14f758..ab317ebfd 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 0065c9895..6b53f16ab 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_minutes_sample.py b/samples/api/hire/v1/get_minutes_sample.py new file mode 100644 index 000000000..bbdb33eb3 --- /dev/null +++ b/samples/api/hire/v1/get_minutes_sample.py @@ -0,0 +1,66 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.hire.v1 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: GetMinutesRequest = GetMinutesRequest.builder() \ + .interview_id("str") \ + .page_token("str") \ + .page_size(20) \ + .build() + + # 发起请求 + response: GetMinutesResponse = client.hire.v1.minutes.get(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.minutes.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)) + + +# 异步方式 +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: GetMinutesRequest = GetMinutesRequest.builder() \ + .interview_id("str") \ + .page_token("str") \ + .page_size(20) \ + .build() + + # 发起请求 + response: GetMinutesResponse = await client.hire.v1.minutes.aget(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.minutes.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)) + + +if __name__ == "__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 34c7d680e..6e6e87aaf 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 8249a9143..13748cd3c 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 0383ad9e4..d5ae8adce 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 7e9c893bd..2bcae735c 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 09372600f..1f8403d26 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 bf31aca62..e73520235 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 81a3412a9..325ccb824 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 4bc8b4086..71c6a53a4 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 a519629de..bd9189687 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 d0df1945d..3b08e1588 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 190635668..058f93198 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 b302142cf..2188ec656 100644 --- a/samples/api/hire/v1/list_application_sample.py +++ b/samples/api/hire/v1/list_application_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: 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() + # 构造请求对象 + 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") \ - .lock_status([]) \ - .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 d03a1da2c..b5a2ede3f 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 5b7949e23..4e11418bc 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 028ae2402..1f2029b43 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 381443131..c45f2183e 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 9eca2c0f5..6e0124cf7 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 36f74e92d..0c8efbd88 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 650e60e09..71b0117b5 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 9629cccb2..31024448e 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 702ab9bc0..56cb02d22 100644 --- a/samples/api/hire/v1/list_interview_registration_schema_sample.py +++ b/samples/api/hire/v1/list_interview_registration_schema_sample.py @@ -5,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 0f449d626..440f3fb74 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 45f748626..c561bfe5f 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 720f98e9d..da94d559b 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_interviewer_sample.py b/samples/api/hire/v1/list_interviewer_sample.py new file mode 100644 index 000000000..51474aa7c --- /dev/null +++ b/samples/api/hire/v1/list_interviewer_sample.py @@ -0,0 +1,74 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.hire.v1 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: ListInterviewerRequest = ListInterviewerRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .user_ids([]) \ + .verify_status(1) \ + .earliest_update_time("1714374796615") \ + .latest_update_time("1714374796616") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: ListInterviewerResponse = client.hire.v1.interviewer.list(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interviewer.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)) + + +# 异步方式 +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: ListInterviewerRequest = ListInterviewerRequest.builder() \ + .page_size(int) \ + .page_token("str") \ + .user_ids([]) \ + .verify_status(1) \ + .earliest_update_time("1714374796615") \ + .latest_update_time("1714374796616") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: ListInterviewerResponse = await client.hire.v1.interviewer.alist(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interviewer.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)) + + +if __name__ == "__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 4fb67d977..869c4277f 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 2eb28db9f..4645d8442 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 204102cd6..7f3adfaaf 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 4999c5e63..88ea8505a 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 de411b444..0a80da882 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 3ae0349dc..49af88d1e 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 693a77c3e..c41e73211 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 9387b13b6..6f0004e0c 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 0c188ca74..3697c5618 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 334846736..c3bd8a545 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 e90d4505d..c29d12d98 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 0d7086cdb..9b9ac2ac9 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(20) \ - .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(20) \ - .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 1346e87f3..2affb4a51 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 f41df1316..e7853d8fa 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 2c6f42ccb..f99cd5d00 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 4e1d5879c..1ef84a102 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 b343a6424..90c916a2f 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 e685866cd..bdf297a2d 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 5688bcbd4..afb313d4a 100644 --- a/samples/api/hire/v1/list_talent_sample.py +++ b/samples/api/hire/v1/list_talent_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: 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() + # 构造请求对象 + 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() \ - .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() + # 构造请求对象 + 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 4c9263cfe..e1dc7b2e4 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 3de19eb13..32118157a 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("10") \ - .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("10") \ - .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 73ffdcefd..a832d6417 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_user_role_sample.py b/samples/api/hire/v1/list_user_role_sample.py new file mode 100644 index 000000000..177976588 --- /dev/null +++ b/samples/api/hire/v1/list_user_role_sample.py @@ -0,0 +1,74 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.hire.v1 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: ListUserRoleRequest = ListUserRoleRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id("ou_xxxx") \ + .role_id("101") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: ListUserRoleResponse = client.hire.v1.user_role.list(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.user_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)) + + +# 异步方式 +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: ListUserRoleRequest = ListUserRoleRequest.builder() \ + .page_token("eyJvZmZzZXQiOjEwLCJ0aW1lc3RhbXAiOjE2Mjc1NTUyMjM2NzIsImlkIjpudWxsfQ==") \ + .page_size(10) \ + .user_id("ou_xxxx") \ + .role_id("101") \ + .update_start_time("1618500278663") \ + .update_end_time("1618500278663") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: ListUserRoleResponse = await client.hire.v1.user_role.alist(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.user_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)) + + +if __name__ == "__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 07474424a..33cf45e87 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 1dd428ac6..9b1e1144f 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 5775a69b1..24c3a49bb 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 ba756c5a6..9abc97bc9 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 ce1671bc3..6684adcf9 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 a7b825162..9c833fcb8 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 cb192e294..dc5336755 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 887f34172..0bf986b91 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 9f4b57b78..112981383 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 da7f355e8..0f3b6c87c 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 9fc3ea076..16c51bf89 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 01c063ca0..f7d6e3f2e 100644 --- a/samples/api/hire/v1/patch_external_interview_assessment_sample.py +++ b/samples/api/hire/v1/patch_external_interview_assessment_sample.py @@ -5,70 +5,71 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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_interviewer_sample.py b/samples/api/hire/v1/patch_interviewer_sample.py new file mode 100644 index 000000000..a6dc49235 --- /dev/null +++ b/samples/api/hire/v1/patch_interviewer_sample.py @@ -0,0 +1,70 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.hire.v1 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: PatchInterviewerRequest = PatchInterviewerRequest.builder() \ + .interviewer_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(PatchInterviewerRequestBody.builder() + .interviewer(Interviewer.builder().build()) + .build()) \ + .build() + + # 发起请求 + response: PatchInterviewerResponse = client.hire.v1.interviewer.patch(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interviewer.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)) + + +# 异步方式 +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: PatchInterviewerRequest = PatchInterviewerRequest.builder() \ + .interviewer_id("ou_7dab8a3d3cdcc9da365777c7ad535d62") \ + .user_id_type("user_id") \ + .request_body(PatchInterviewerRequestBody.builder() + .interviewer(Interviewer.builder().build()) + .build()) \ + .build() + + # 发起请求 + response: PatchInterviewerResponse = await client.hire.v1.interviewer.apatch(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.hire.v1.interviewer.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)) + + +if __name__ == "__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 ae1961fb5..bd92ae128 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 42e7af8a5..07b17d5c5 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 fd036d9bd..e059f6dc1 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 292873951..2913963c6 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 5d50e4115..0f40651c3 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 a5db0a11c..b7baa4bd0 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 7872cbb99..fd3d2aa90 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 916de04fd..baa78930d 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 4bfd8753d..7e2331d96 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 397351406..ec68f1a0c 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 a8a675d6c..668c2eb49 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 f6a37e631..560de41a9 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 3e6e571b7..451a8fe1a 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 cd9c2135d..e421cea52 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 d558bed89..af079d7f8 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 272ce1b78..071c8483e 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 24bf28c31..a3c2d0cb6 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 faa256001..c233a04e2 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 0f8665def..5bb509459 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 c62ae3191..1ebea698f 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 f37145546..f743a9e54 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 17b2a3ed7..eaf1a9016 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 9a231cc0d..229ae9d89 100644 --- a/samples/api/hire/v1/update_external_application_sample.py +++ b/samples/api/hire/v1/update_external_application_sample.py @@ -5,84 +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: 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() + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .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() + .job_recruitment_type(1) + .job_title("高级Java") + .resume_source("lagou") + .stage("1") + .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 162c4b289..528d6cf9d 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 12cd33b14..ee92375b2 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 246fc5019..786a31a48 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 039f8949b..01b6da0c8 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,74 +5,75 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 63057b6f8..70f0df8ef 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 3755e5ad8..6bde8bfd7 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 b4afe2d77..739c86a77 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 618f4e1d7..4a61b1c39 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 cf9da3dc1..9406bc57c 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 388a38e11..830c11580 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 438c2889d..78a2db53a 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 f14510e06..cecb55ca1 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 b23112502..4d6584d2c 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 954c18235..bd4e7532c 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 9dd655ebe..255475c20 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 1a6aa61f2..bc37f20b2 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 56494d553..80594bc7c 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 5dcd29ccf..d10c5d44c 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 d637bae5a..0699933b2 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 57747b87f..6f1a5e078 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 cc6e15b9b..0644f7737 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 703883a9e..12a190dce 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 7be3b0261..1270af0cd 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 24ac517bd..afd19f016 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 264700dc5..239509f8d 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 381b8c9e2..77612ca9d 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 26bfcf2e3..b15cef160 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 466768549..d88c15a77 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 7673d646b..a1e99e2cf 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 6f85b131d..95d291291 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 670f74754..c854cc40f 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 b1f4eb3b8..ab09f77a2 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 69397b6cd..e6b8eb1c5 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 a998182f2..0008295ff 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 f911b7025..6bbc7d718 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 7d4549175..763570139 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 4fcd5e800..dbb4214eb 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 309a8be68..4b88ad967 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 9c55ec8d5..a5050eed6 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 6c17f5b47..130688d46 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 2453a1fbf..6c9223d9c 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 5caa02c05..f7188576b 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 890b03496..98897ef81 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 6e0f8b4d2..3162fddef 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 b61e2a3c1..5650fd3f9 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 3a7146ba7..db8759c44 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 eb27b98e6..7ceddc93a 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 49f9190d6..05d58695b 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 ac07ca401..3f15303b6 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 253bfcc67..a9046059c 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 52327d2d8..39a24f8bf 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 637ee7cc6..9ab1cff5e 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 1de950273..062284afa 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 2c0604bf2..74eeec277 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 c6c0aa582..9ec46b2f4 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 e4c0225ae..a228d7119 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 bc646df48..0eae3a006 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 752dd9827..2a1a41e3c 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 23defb4eb..54d35ac52 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 ad5b81b63..b0a1dba7f 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 ab952e7e7..672c5780a 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 79fc2aba8..72e16049f 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 a0c7ad2c0..dd48a5a20 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 e13da9aeb..f2aafccf6 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 8b270e4a2..7755b2523 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 a4253234b..36369e3f8 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 3aabf0e92..a0d8069b2 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 143589af7..267e7c08e 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 3214c9ec0..2d06e24d7 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 e7da744e8..5c5e0d9c5 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 f4df35f1c..bd416194a 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/bot_time_sentive_feed_card_sample.py b/samples/api/im/v2/bot_time_sentive_feed_card_sample.py new file mode 100644 index 000000000..8dbd2a546 --- /dev/null +++ b/samples/api/im/v2/bot_time_sentive_feed_card_sample.py @@ -0,0 +1,70 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.im.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: BotTimeSentiveFeedCardRequest = BotTimeSentiveFeedCardRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BotTimeSentiveFeedCardRequestBody.builder() + .time_sensitive(True) + .user_ids([]) + .build()) \ + .build() + + # 发起请求 + response: BotTimeSentiveFeedCardResponse = client.im.v2.feed_card.bot_time_sentive(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.feed_card.bot_time_sentive 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: BotTimeSentiveFeedCardRequest = BotTimeSentiveFeedCardRequest.builder() \ + .user_id_type("open_id") \ + .request_body(BotTimeSentiveFeedCardRequestBody.builder() + .time_sensitive(True) + .user_ids([]) + .build()) \ + .build() + + # 发起请求 + response: BotTimeSentiveFeedCardResponse = await client.im.v2.feed_card.abot_time_sentive(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.im.v2.feed_card.abot_time_sentive 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/im/v2/create_app_feed_card_sample.py b/samples/api/im/v2/create_app_feed_card_sample.py index 7b8138777..b895ab13c 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 608160751..066cd6d97 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 619bff4a1..da3f4c8c3 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 5d47cf186..7d02dc380 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 0a7f99b21..30fd62b74 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 80e8f9c59..59346eb40 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 f85cb2933..6e50ea57d 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 d7c8aa69b..f3172271c 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 0f0921d92..222920cd1 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 ca6b44f7c..ca69a793f 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 8bc225edf..a2ced7dc5 100644 --- a/samples/api/lingo/v1/create_draft_sample.py +++ b/samples/api/lingo/v1/create_draft_sample.py @@ -5,80 +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: 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 6ab032f33..dc59c90d0 100644 --- a/samples/api/lingo/v1/create_entity_sample.py +++ b/samples/api/lingo/v1/create_entity_sample.py @@ -5,78 +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: 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 a3a2fad80..d54073248 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 b455493b8..4eab77a05 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 f717d5543..eaaa51828 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 51ac5fb3a..8115ab516 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 285e6fb5c..e7ab2511d 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 129342f41..84d1eae4a 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 992853477..3f3decdd8 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 63639a876..f9a0f9e4b 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 110fcb4e5..f635718e3 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 303e47d6a..3bcaaeb3f 100644 --- a/samples/api/lingo/v1/update_draft_sample.py +++ b/samples/api/lingo/v1/update_draft_sample.py @@ -5,78 +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: 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 a1f390e68..49192afdd 100644 --- a/samples/api/lingo/v1/update_entity_sample.py +++ b/samples/api/lingo/v1/update_entity_sample.py @@ -5,78 +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: 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 4e7631d54..4dc4f4cf6 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 9dc8ea283..69bd722c7 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 d47503de7..f888663a3 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 797540f52..4bcee2c07 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,68 +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: 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 5415ac32e..132742cf2 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 b32c6f824..88d858066 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 68df393dc..8cc1177f9 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 c933eb3d6..19851fb47 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,64 +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: 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 ef64acd32..bbf3fafb3 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 d572f40bc..d885efcf5 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 25d006a00..8db9209f1 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 4a1f57200..ca4839ea3 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 8be694559..0aa8cc861 100644 --- a/samples/api/mail/v1/create_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/create_mailgroup_permission_member_sample.py @@ -5,74 +5,75 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 93655f569..cf210e127 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 45bcb8bc6..d6cbbdd83 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 da5b3da92..576b5f40c 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 a1b4b0294..5321721a7 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 b9dbf53d5..dcde37a90 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 c567051ca..6d81c0011 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 c6321b570..44c509a2c 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 bb52d7838..d36701e58 100644 --- a/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py +++ b/samples/api/mail/v1/delete_mailgroup_permission_member_sample.py @@ -5,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 747645cd7..b99f7c2e9 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 f7bce62e8..0e819e881 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 976ec0fc5..1b7e3014d 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 b014a85d4..9451a369a 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 2f89c7589..8b1958024 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 6fc859606..dae2b75b0 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 7a926f480..9a6332101 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 c7df34cb0..4d2e6eada 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 6d6a3defd..20620e2bd 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 5fcd4c652..c52ac9249 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 5f6c500c2..9d47674da 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 e58025c57..a0f0af7ed 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 9fe4ebe52..8697da12f 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 a6302a17e..d20f1ac49 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 ce4505ef8..2c04e01ae 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 15982d221..a007a5768 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 60d0cc7e1..6f0a097c1 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 d07d5f46e..cae4a5045 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 b273916d8..c5cd0106f 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 300323a6a..1d86b1cef 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 809301fe8..e8c8af87b 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 b4b5bc901..cc3b19d91 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 bc3486a3c..c726874e4 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/send_user_mailbox_message_sample.py b/samples/api/mail/v1/send_user_mailbox_message_sample.py new file mode 100644 index 000000000..35afef686 --- /dev/null +++ b/samples/api/mail/v1/send_user_mailbox_message_sample.py @@ -0,0 +1,84 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.mail.v1 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: SendUserMailboxMessageRequest = SendUserMailboxMessageRequest.builder() \ + .user_mailbox_id("user@xxx.xx 或 me") \ + .request_body(Message.builder() + .subject("邮件标题") + .to([]) + .cc([]) + .bcc([]) + .head_from(MailAddress.builder().build()) + .body_html("xxxx") + .body_plain_text("xxxxx") + .attachments([]) + .thread_id("tfuh9N4WnzU6jdDw=") + .build()) \ + .build() + + # 发起请求 + response: SendUserMailboxMessageResponse = client.mail.v1.user_mailbox_message.send(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_message.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)) + + +# 异步方式 +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: SendUserMailboxMessageRequest = SendUserMailboxMessageRequest.builder() \ + .user_mailbox_id("user@xxx.xx 或 me") \ + .request_body(Message.builder() + .subject("邮件标题") + .to([]) + .cc([]) + .bcc([]) + .head_from(MailAddress.builder().build()) + .body_html("xxxx") + .body_plain_text("xxxxx") + .attachments([]) + .thread_id("tfuh9N4WnzU6jdDw=") + .build()) \ + .build() + + # 发起请求 + response: SendUserMailboxMessageResponse = await client.mail.v1.user_mailbox_message.asend(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.mail.v1.user_mailbox_message.asend 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/mail/v1/update_mailgroup_sample.py b/samples/api/mail/v1/update_mailgroup_sample.py index c1da9f0ae..8e0cf155b 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 b5724bd0b..af19e5652 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 d78671f0a..235fe7bc0 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 246c27735..9205490bf 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/moments/v1/get_post_sample.py b/samples/api/moments/v1/get_post_sample.py new file mode 100644 index 000000000..14161f740 --- /dev/null +++ b/samples/api/moments/v1/get_post_sample.py @@ -0,0 +1,64 @@ +# Code generated by Lark OpenAPI. + +import lark_oapi as lark +from lark_oapi.api.moments.v1 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: GetPostRequest = GetPostRequest.builder() \ + .post_id("6934510454161014804") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: GetPostResponse = client.moments.v1.post.get(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.moments.v1.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)) + + +# 异步方式 +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: GetPostRequest = GetPostRequest.builder() \ + .post_id("6934510454161014804") \ + .user_id_type("user_id") \ + .build() + + # 发起请求 + response: GetPostResponse = await client.moments.v1.post.aget(request) + + # 处理失败返回 + if not response.success(): + lark.logger.error( + f"client.moments.v1.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)) + + +if __name__ == "__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 3c3d0aabb..806977fbf 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 a425796e7..148b87ceb 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 6f7e578cc..b51b51515 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 62dd85ba9..698d059b6 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 b72d02b57..c913df291 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 611430a0c..c273c4566 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 1e4d9cbd9..4915ef814 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 130ab248a..ced225eee 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 74b02b0ee..9ba010032 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 eb730ee89..a807d121a 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 ad1db9ece..db2c0face 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 ea3dbdf71..ddd815546 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 8551b50b8..d688b2c34 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 a88633156..21d4dce94 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 c79ee8b39..3f0393414 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 6eda130b4..e30cc7721 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 5e2d3ed1a..26a652376 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 fe979c1f4..7c9507270 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 6476a4d32..bf2d0db6d 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 16f4a4897..c1d5e792b 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 c465477e9..43b886d1d 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 d7f55c7e0..14c5cd7fd 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 05ecf5218..15439475a 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 802db69a1..d5413f26a 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 7c677e47d..4162f020a 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 5eff34d65..b0caa9ad7 100644 --- a/samples/api/search/v2/create_data_source_sample.py +++ b/samples/api/search/v2/create_data_source_sample.py @@ -5,86 +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: 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 3cd2db11b..be8e8c596 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 aeaafd074..3faecf9d3 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 236aa7384..b1184e551 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 a936fe753..8ed508dd8 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 ce40ae0e9..e45e785ca 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 6f0dd1c72..9f5110690 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 aa9c6f9fb..2146ff8e3 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 0f518ce6c..d5195e7b0 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 6a2922c40..233ea6a66 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 9782634bd..494e345c9 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 2ad1442a4..88363b56c 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 8ba27e0f9..508e8ab08 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 45a63775f..772884c8b 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 08378141d..066a16f12 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 c56b3c8b4..295a8a7bb 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,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: 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 f2b970b16..3747d9cbf 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,70 +5,71 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 7fd31e055..2e6eb6518 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,78 +5,79 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 179c14217..228c6134d 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 38dd4ff10..7ee8c51d4 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,64 +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: 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 f16dec9c9..cb1541d24 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,62 +5,63 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 a15962e95..e5b4486ee 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,62 +5,63 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 9eb3e2819..5bdb9876a 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 33cbb4bea..6be6ef1e2 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 3c2afc1ef..f39a973e2 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 52316e549..c5d630347 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,64 +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: 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 2cfbc027f..cb6a22047 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 096036995..113ff7412 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 a4ebf00ac..0fa956ccd 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 f66ed062f..f0c50cb11 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 587b7c8f1..a83a97326 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 4dc54007e..aef2b955e 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,70 +5,71 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 0d3d74b22..e0b1a6ee9 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,78 +5,79 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 4fce5002b..344edeae8 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,62 +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: 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 a3f7ecfbb..8706fea84 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,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 9558f14a0..f9265b466 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,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 6e220360c..b1fe26c42 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 383949a7f..9e7df164f 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 e62a71693..ad1d5487f 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 dd4c908c9..7d9f9c996 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,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: 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 9e4f9c9b3..e743b8313 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 4d12fd64a..83bcb14ad 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 d675d5c21..839b60c96 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 cc18ccbe0..31e77d31f 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 985c48a66..8505b0a69 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 66613c8ce..5700c6775 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 4aa990b48..a3c06999c 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 01a5f377b..e47050010 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 795d7698a..50f6d2628 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 7ef6d4487..6429c690e 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 b1d14d506..714fef510 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 d75a19ee9..aa1c16c95 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 685091e52..ef73a2fb1 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 9ec1a91d8..063c3d614 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 0f08bce9d..aa5cd6747 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 d3089f287..b3594f536 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 06227b4e9..d9fcd7816 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 b81123d97..193d9cc02 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 79057c0be..c8862fca4 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 ec1494001..12710ee67 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 f24be4c03..40500a1d8 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 62c3d4fa8..922a3f91d 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 a343f0337..3e8478033 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 7f28b2634..dd200cbfa 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 6f2b6ba5b..12e75f63b 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 b0dfcb884..987232581 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 30b27cff2..3b9f4ebfc 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 d88bd3b51..a1d13c765 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 5e9776cbc..fca48cfdb 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 d6a137173..c0c5ef42f 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 b4b763dca..673dba310 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 4e82318ad..689e5c66e 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 346dd3920..9ad3256a0 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 f22039b68..96824b1a5 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 217d86d71..55bf014e0 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 c6b5fd514..9227ea60d 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 0d4b876bf..dba392891 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 2dfe71d76..9543059f4 100644 --- a/samples/api/task/v2/create_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/create_tasklist_activity_subscription_sample.py @@ -5,72 +5,73 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 356945c93..0b8634db9 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 ee4a8d882..aefd0230c 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 ef07e65f0..d1f06a51b 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 2dbd497cf..bbbe5b933 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 922809730..2317ebe21 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 0a064eb45..85c3d3e75 100644 --- a/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/delete_tasklist_activity_subscription_sample.py @@ -5,60 +5,61 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 da594d587..e54a98fd1 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 4978a54eb..489901667 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 c3ada786c..bcdea95a3 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 4fd860257..ece28d1e9 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 ab90017ef..24fa04f59 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 2ced6af37..c03823fdf 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 7bf44497e..88e5ec04b 100644 --- a/samples/api/task/v2/get_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/get_tasklist_activity_subscription_sample.py @@ -5,62 +5,63 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 d32a25587..7f44e582f 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 47913b12b..a59acf8f4 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 14117677c..a690e4381 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 b350f9856..e3c39da98 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 d0fdeb2e8..5f29ec5b2 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 3373c537d..9ef1aa6a5 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 3d58ca936..286e92dd9 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 642cf4591..471736abc 100644 --- a/samples/api/task/v2/list_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/list_tasklist_activity_subscription_sample.py @@ -5,62 +5,63 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 6c099f9b9..4df256a83 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 77b017624..ced668bf0 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 473f84c10..9df132c04 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 89f9d5081..f27bf0604 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 9c56a2dc5..f61b6cb4d 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 50a894b09..94a22b1d4 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 0b09c766d..4aafac781 100644 --- a/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py +++ b/samples/api/task/v2/patch_tasklist_activity_subscription_sample.py @@ -5,70 +5,71 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 a9cd92154..d1b051ef3 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 2a96f6f68..49dd3ad43 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 3bd3b8e30..4593a7718 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 97ffc0dc1..ebee14206 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 83e393d83..886e43992 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 81f9b7152..d7352f9f1 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 dcb0be804..055949621 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 3da2c0853..dc0870a54 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 e85ad5de5..386773bae 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 407c3ed46..b5e7612b7 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 37f3ad980..3126c6098 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 7a7fc378d..c06412515 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 ef37c4550..a18e2ac55 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 4dc0b9b86..296377922 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 453b05abd..89fbd755e 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 5d89d4540..55f47be60 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 9e5efcc90..c7b539ad5 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 16956eef6..9b10c6bf1 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 b16c16ccb..776727a51 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 8caded410..eeda52a4e 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 1fb0ff347..1325c16e5 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 1f381662c..ef18edaf2 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 a03fa334c..fef511796 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 31280a870..51b7923a6 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 6a7bdc9d2..d4e2501ef 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 dd354b853..a5be43aa4 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 f5216e936..b159e88f6 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 dd1986e59..4fa20de66 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 c0d2d298c..388d39204 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 82a4043b9..55f81e229 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 e94b5ea66..e3c535664 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 62d987398..e80dbc603 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 9778cccb5..db31598cf 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 1d5fbea81..159465356 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 41641b94a..7a351785e 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 6f10252bd..498116b63 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 409c73e46..c069f2992 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 4e941a0d1..a21f9dcfa 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 f8091ccb2..9de36c93b 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 929f02714..34436e1d6 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 8317c5110..4757106b8 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 1dd07d80a..4f07f2836 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 29ddaa3f0..1a6469df4 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 83c89a61b..301990169 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 daaa8fb33..599f8a63e 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 2d2dee1df..7b83abbff 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 1c13c0b77..9c9c6ead4 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 6a7d29b21..9e584b66d 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 72c79f367..1d76482cd 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 a0ad360c3..450554b62 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 8b92012a0..25a77f010 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 debc5807b..90c1455b7 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 d315bbb02..f5d674e1f 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 c78f05d2e..9fe836301 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 3c48365fe..16d548c91 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 0a831694e..d5f554215 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 dd0bf592a..35e43b30c 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 f69a1e890..ad3eb3bcd 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 8d7c0291a..73f3a76dc 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 ba34fed4b..7d613bd98 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 4493176c7..d29953519 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 39dab989a..65050cda3 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 851c0177a..83de4bede 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 51d83f2b9..21ecdb05c 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,74 +5,75 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 f68b8e24c..178051b16 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 124b8a3cb..f031df605 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 2d7543b39..5573c592f 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 b49910755..58710e232 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 32d9183c7..f7da583fb 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 b02a04969..3f396e0a4 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 e3274b824..c02b71248 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 640f3255f..de32392d6 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 841ef8d94..85dc04e2b 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 4452cc26c..c7c6e56b5 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 84561fe23..4b25e91f2 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 87ccc2cc2..133b020bb 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 d81e33bd1..2b5fd7fd9 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 9f2cf7f0b..7c5dd47ac 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 28d806469..e517d8a67 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 aee88e546..150a58f5d 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 0d1dbad99..12d42bca5 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 11f5a807a..0fcff7abf 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 cf3875694..63cfcebbb 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 14e29135d..c11b105ab 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 99d2b1ea3..c863d33b1 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 19521504e..c198d6b13 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 21c6ead0d..4aa27e902 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 d41db61e5..f0e2cc08d 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,66 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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 cbebf9b03..a8607dc3c 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 a79e85fa3..3877c6b41 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,66 +5,67 @@ def main(): - # 创建client - client = lark.Client.builder() \ - .app_id(lark.APP_ID) \ - .app_secret(lark.APP_SECRET) \ - .log_level(lark.LogLevel.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()