# coding: utf-8

"""
    Teambition Open API

    Teambition Open API

    The version of the OpenAPI document: 1.0.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictStr
from typing import Optional
from typing_extensions import Annotated
from teambition_oapi_sdk.model.create_platform_response import CreatePlatformResponse
from teambition_oapi_sdk.model.get_pipeline_platform_response import GetPipelinePlatformResponse
from teambition_oapi_sdk.model.get_pipeline_response import GetPipelineResponse
from teambition_oapi_sdk.model.get_platforms_response import GetPlatformsResponse
from teambition_oapi_sdk.model.sync_builds_request import SyncBuildsRequest
from teambition_oapi_sdk.model.sync_builds_response import SyncBuildsResponse
from teambition_oapi_sdk.model.sync_pipelines_request import SyncPipelinesRequest
from teambition_oapi_sdk.model.update_pipeline_params_request import UpdatePipelineParamsRequest
from teambition_oapi_sdk.model.update_pipeline_platform_request import UpdatePipelinePlatformRequest
from teambition_oapi_sdk.model.update_pipeline_platform_response import UpdatePipelinePlatformResponse

from teambition_oapi_sdk.api_client import ApiClient, RequestSerialized
from teambition_oapi_sdk.api_response import ApiResponse
from teambition_oapi_sdk.rest import RESTResponseType

class CodeApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client

    @validate_call
    def create_platform(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> CreatePlatformResponse:
        """创建流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_platform_serialize(
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreatePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def create_platform_with_http_info(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[CreatePlatformResponse]:
        """创建流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_platform_serialize(
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreatePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def create_platform_without_preload_content(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """创建流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_platform_serialize(
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreatePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _create_platform_serialize(
        self,
        x_tenant_id,
        update_pipeline_platform_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter
        if update_pipeline_platform_request is not None:
            _body_params = update_pipeline_platform_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/platforms"

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/code/pipeline/platforms',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def get_pipeline(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        code: Annotated[Optional[StrictStr], Field(description="流水线code")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> GetPipelineResponse:
        """根据code查询流水线

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param code: 流水线code
        :type code: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            code=code,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def get_pipeline_with_http_info(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        code: Annotated[Optional[StrictStr], Field(description="流水线code")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[GetPipelineResponse]:
        """根据code查询流水线

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param code: 流水线code
        :type code: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            code=code,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def get_pipeline_without_preload_content(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        code: Annotated[Optional[StrictStr], Field(description="流水线code")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """根据code查询流水线

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param code: 流水线code
        :type code: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            code=code,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _get_pipeline_serialize(
        self,
        platform_id,
        x_tenant_id,
        code,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if platform_id is not None:
            _path_params['platformId'] = platform_id
        # process the query parameters
        if code is not None:
            
            _query_params.append(('code', code))
            
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/get/{platformId}"
        url = url.replace('{' + 'platformId' + '}', str(platform_id))

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/code/pipeline/get/{platformId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def get_pipeline_platform(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        name: Annotated[Optional[StrictStr], Field(description="流水线源平台名称")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> GetPipelinePlatformResponse:
        """根据名称查询流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param name: 流水线源平台名称
        :type name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_platform_serialize(
            x_tenant_id=x_tenant_id,
            name=name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def get_pipeline_platform_with_http_info(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        name: Annotated[Optional[StrictStr], Field(description="流水线源平台名称")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[GetPipelinePlatformResponse]:
        """根据名称查询流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param name: 流水线源平台名称
        :type name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_platform_serialize(
            x_tenant_id=x_tenant_id,
            name=name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def get_pipeline_platform_without_preload_content(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        name: Annotated[Optional[StrictStr], Field(description="流水线源平台名称")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """根据名称查询流水线源平台

        

        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param name: 流水线源平台名称
        :type name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_pipeline_platform_serialize(
            x_tenant_id=x_tenant_id,
            name=name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _get_pipeline_platform_serialize(
        self,
        x_tenant_id,
        name,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if name is not None:
            
            _query_params.append(('name', name))
            
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/platform/get"

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/code/platform/get',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def get_platforms(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description=" 企业 ID")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> GetPlatformsResponse:
        """查询流水线源平台

        

        :param x_tenant_id:  企业 ID
        :type x_tenant_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_platforms_serialize(
            x_tenant_id=x_tenant_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPlatformsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def get_platforms_with_http_info(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description=" 企业 ID")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[GetPlatformsResponse]:
        """查询流水线源平台

        

        :param x_tenant_id:  企业 ID
        :type x_tenant_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_platforms_serialize(
            x_tenant_id=x_tenant_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPlatformsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def get_platforms_without_preload_content(
        self,
        x_tenant_id: Annotated[Optional[StrictStr], Field(description=" 企业 ID")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """查询流水线源平台

        

        :param x_tenant_id:  企业 ID
        :type x_tenant_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_platforms_serialize(
            x_tenant_id=x_tenant_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPlatformsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _get_platforms_serialize(
        self,
        x_tenant_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/platforms"

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/code/pipeline/platforms',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def sync_builds(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        sync_builds_request: Optional[SyncBuildsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> SyncBuildsResponse:
        """同步构建信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param sync_builds_request: 
        :type sync_builds_request: SyncBuildsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_builds_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            sync_builds_request=sync_builds_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "SyncBuildsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def sync_builds_with_http_info(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        sync_builds_request: Optional[SyncBuildsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[SyncBuildsResponse]:
        """同步构建信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param sync_builds_request: 
        :type sync_builds_request: SyncBuildsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_builds_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            sync_builds_request=sync_builds_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "SyncBuildsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def sync_builds_without_preload_content(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        sync_builds_request: Optional[SyncBuildsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """同步构建信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param sync_builds_request: 
        :type sync_builds_request: SyncBuildsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_builds_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            sync_builds_request=sync_builds_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "SyncBuildsResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _sync_builds_serialize(
        self,
        platform_id,
        pipeline_id,
        x_tenant_id,
        sync_builds_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if platform_id is not None:
            _path_params['platformId'] = platform_id
        if pipeline_id is not None:
            _path_params['pipelineId'] = pipeline_id
        # process the query parameters
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter
        if sync_builds_request is not None:
            _body_params = sync_builds_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/platforms/{platformId}/pipelines/{pipelineId}/builds"
        url = url.replace('{' + 'platformId' + '}', str(platform_id))
        url = url.replace('{' + 'pipelineId' + '}', str(pipeline_id))

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/code/pipeline/platforms/{platformId}/pipelines/{pipelineId}/builds',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def sync_pipelines(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        platform_id2: Annotated[Optional[StrictStr], Field(description="流水线源平台id")] = None,
        sync_pipelines_request: Optional[SyncPipelinesRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> GetPipelineResponse:
        """同步流水线信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param platform_id2: 流水线源平台id
        :type platform_id2: str
        :param sync_pipelines_request: 
        :type sync_pipelines_request: SyncPipelinesRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_pipelines_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            platform_id2=platform_id2,
            sync_pipelines_request=sync_pipelines_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def sync_pipelines_with_http_info(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        platform_id2: Annotated[Optional[StrictStr], Field(description="流水线源平台id")] = None,
        sync_pipelines_request: Optional[SyncPipelinesRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[GetPipelineResponse]:
        """同步流水线信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param platform_id2: 流水线源平台id
        :type platform_id2: str
        :param sync_pipelines_request: 
        :type sync_pipelines_request: SyncPipelinesRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_pipelines_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            platform_id2=platform_id2,
            sync_pipelines_request=sync_pipelines_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def sync_pipelines_without_preload_content(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        platform_id2: Annotated[Optional[StrictStr], Field(description="流水线源平台id")] = None,
        sync_pipelines_request: Optional[SyncPipelinesRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """同步流水线信息

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param platform_id2: 流水线源平台id
        :type platform_id2: str
        :param sync_pipelines_request: 
        :type sync_pipelines_request: SyncPipelinesRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._sync_pipelines_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            platform_id2=platform_id2,
            sync_pipelines_request=sync_pipelines_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetPipelineResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _sync_pipelines_serialize(
        self,
        platform_id,
        x_tenant_id,
        platform_id2,
        sync_pipelines_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if platform_id is not None:
            _path_params['platformId'] = platform_id
        # process the query parameters
        if platform_id2 is not None:
            
            _query_params.append(('platformId', platform_id2))
            
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter
        if sync_pipelines_request is not None:
            _body_params = sync_pipelines_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/platforms/{platformId}/pipelines"
        url = url.replace('{' + 'platformId' + '}', str(platform_id))

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/code/pipeline/platforms/{platformId}/pipelines',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def update_pipeline_params(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_params_request: Optional[UpdatePipelineParamsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> UpdatePipelinePlatformResponse:
        """同步流水线构建参数信息

        更新参数

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_params_request: 
        :type update_pipeline_params_request: UpdatePipelineParamsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_params_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_params_request=update_pipeline_params_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def update_pipeline_params_with_http_info(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_params_request: Optional[UpdatePipelineParamsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[UpdatePipelinePlatformResponse]:
        """同步流水线构建参数信息

        更新参数

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_params_request: 
        :type update_pipeline_params_request: UpdatePipelineParamsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_params_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_params_request=update_pipeline_params_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def update_pipeline_params_without_preload_content(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        pipeline_id: Annotated[StrictStr, Field(description="流水线id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_params_request: Optional[UpdatePipelineParamsRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """同步流水线构建参数信息

        更新参数

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param pipeline_id: 流水线id (required)
        :type pipeline_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_params_request: 
        :type update_pipeline_params_request: UpdatePipelineParamsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_params_serialize(
            platform_id=platform_id,
            pipeline_id=pipeline_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_params_request=update_pipeline_params_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _update_pipeline_params_serialize(
        self,
        platform_id,
        pipeline_id,
        x_tenant_id,
        update_pipeline_params_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if platform_id is not None:
            _path_params['platformId'] = platform_id
        if pipeline_id is not None:
            _path_params['pipelineId'] = pipeline_id
        # process the query parameters
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter
        if update_pipeline_params_request is not None:
            _body_params = update_pipeline_params_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/pipeline/platforms/{platformId}/pipelines/{pipelineId}/buildParams"
        url = url.replace('{' + 'platformId' + '}', str(platform_id))
        url = url.replace('{' + 'pipelineId' + '}', str(pipeline_id))

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/code/pipeline/platforms/{platformId}/pipelines/{pipelineId}/buildParams',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


    @validate_call
    def update_pipeline_platform(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> UpdatePipelinePlatformResponse:
        """更新流水线源平台

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_platform_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def update_pipeline_platform_with_http_info(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[UpdatePipelinePlatformResponse]:
        """更新流水线源平台

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_platform_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def update_pipeline_platform_without_preload_content(
        self,
        platform_id: Annotated[StrictStr, Field(description="流水线源平台id")],
        x_tenant_id: Annotated[Optional[StrictStr], Field(description="企业 ID")] = None,
        update_pipeline_platform_request: Optional[UpdatePipelinePlatformRequest] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """更新流水线源平台

        

        :param platform_id: 流水线源平台id (required)
        :type platform_id: str
        :param x_tenant_id: 企业 ID
        :type x_tenant_id: str
        :param update_pipeline_platform_request: 
        :type update_pipeline_platform_request: UpdatePipelinePlatformRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_pipeline_platform_serialize(
            platform_id=platform_id,
            x_tenant_id=x_tenant_id,
            update_pipeline_platform_request=update_pipeline_platform_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "UpdatePipelinePlatformResponse",
        }

        method, url, header_params, body, post_params = _param
        response_data = self.api_client.call_api(
            method=method,
            url=url,
            header_params=header_params,
            body=body,
            post_params=post_params,
            _request_timeout=_request_timeout
        )
        return response_data.response

    def _update_pipeline_platform_serialize(
        self,
        platform_id,
        x_tenant_id,
        update_pipeline_platform_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = 'https://open.teambition.com/api'  

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if platform_id is not None:
            _path_params['platformId'] = platform_id
        # process the query parameters
        # process the header parameters
        if x_tenant_id is not None:
            _header_params['X-Tenant-Id'] = x_tenant_id
        # process the form parameters
        # process the body parameter
        if update_pipeline_platform_request is not None:
            _body_params = update_pipeline_platform_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'appToken'
        ]

        # Build the full URL
        url = _host + "/code/platform/update/{platformId}"
        url = url.replace('{' + 'platformId' + '}', str(platform_id))

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/code/platform/update/{platformId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )

