diff --git a/line-openapi b/line-openapi index 5eeed11c0..04b9b633e 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 5eeed11c04680245bb535279686d7d28e0521857 +Subproject commit 04b9b633e6558600ee94bc5156e228643f020c79 diff --git a/linebot/v3/audience/__init__.py b/linebot/v3/audience/__init__.py index 018233e9c..431a83f7a 100644 --- a/linebot/v3/audience/__init__.py +++ b/linebot/v3/audience/__init__.py @@ -35,6 +35,7 @@ from linebot.v3.audience.exceptions import ApiException # import models into sdk package +from linebot.v3.audience.models.adaccount import Adaccount from linebot.v3.audience.models.add_audience_to_audience_group_request import AddAudienceToAudienceGroupRequest from linebot.v3.audience.models.audience import Audience from linebot.v3.audience.models.audience_group import AudienceGroup @@ -54,10 +55,13 @@ from linebot.v3.audience.models.create_click_based_audience_group_response import CreateClickBasedAudienceGroupResponse from linebot.v3.audience.models.create_imp_based_audience_group_request import CreateImpBasedAudienceGroupRequest from linebot.v3.audience.models.create_imp_based_audience_group_response import CreateImpBasedAudienceGroupResponse +from linebot.v3.audience.models.detailed_owner import DetailedOwner from linebot.v3.audience.models.error_detail import ErrorDetail from linebot.v3.audience.models.error_response import ErrorResponse from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest diff --git a/linebot/v3/audience/api/async_manage_audience.py b/linebot/v3/audience/api/async_manage_audience.py index 3422ce78b..fda42f27c 100644 --- a/linebot/v3/audience/api/async_manage_audience.py +++ b/linebot/v3/audience/api/async_manage_audience.py @@ -36,6 +36,8 @@ from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest @@ -1463,6 +1465,341 @@ def get_audience_groups_with_http_info(self, page : Annotated[conint(strict=True collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + async def get_shared_audience_data(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], **kwargs) -> GetSharedAudienceDataResponse: # noqa: E501 + ... + + @overload + def get_shared_audience_data(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], async_req: Optional[bool]=True, **kwargs) -> GetSharedAudienceDataResponse: # noqa: E501 + ... + + @validate_arguments + def get_shared_audience_data(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], async_req: Optional[bool]=None, **kwargs) -> Union[GetSharedAudienceDataResponse, Awaitable[GetSharedAudienceDataResponse]]: # noqa: E501 + """get_shared_audience_data # noqa: E501 + + Gets audience data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_data(audience_group_id, async_req=True) + >>> result = thread.get() + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :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. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: GetSharedAudienceDataResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_shared_audience_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + if async_req is not None: + kwargs['async_req'] = async_req + return self.get_shared_audience_data_with_http_info(audience_group_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_shared_audience_data_with_http_info(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], **kwargs) -> ApiResponse: # noqa: E501 + """get_shared_audience_data # noqa: E501 + + Gets audience data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_data_with_http_info(audience_group_id, async_req=True) + >>> result = thread.get() + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :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. + :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 + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(GetSharedAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'audience_group_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_audience_data" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['audience_group_id']: + _path_params['audienceGroupId'] = _params['audience_group_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetSharedAudienceDataResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/audienceGroup/shared/{audienceGroupId}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @overload + async def get_shared_audience_groups(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, **kwargs) -> GetSharedAudienceGroupsResponse: # noqa: E501 + ... + + @overload + def get_shared_audience_groups(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, async_req: Optional[bool]=True, **kwargs) -> GetSharedAudienceGroupsResponse: # noqa: E501 + ... + + @validate_arguments + def get_shared_audience_groups(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[GetSharedAudienceGroupsResponse, Awaitable[GetSharedAudienceGroupsResponse]]: # noqa: E501 + """get_shared_audience_groups # noqa: E501 + + Gets data for more than one audience, including those shared by the Business Manager. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_groups(page, description, status, size, create_route, async_req=True) + >>> result = thread.get() + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :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. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: GetSharedAudienceGroupsResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_shared_audience_groups_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + if async_req is not None: + kwargs['async_req'] = async_req + return self.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, **kwargs) # noqa: E501 + + @validate_arguments + def get_shared_audience_groups_with_http_info(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """get_shared_audience_groups # noqa: E501 + + Gets data for more than one audience, including those shared by the Business Manager. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, async_req=True) + >>> result = thread.get() + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :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. + :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 + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(GetSharedAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'page', + 'description', + 'status', + 'size', + 'create_route' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_audience_groups" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('page') is not None: # noqa: E501 + _query_params.append(('page', _params['page'])) + + if _params.get('description') is not None: # noqa: E501 + _query_params.append(('description', _params['description'])) + + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'].value)) + + if _params.get('size') is not None: # noqa: E501 + _query_params.append(('size', _params['size'])) + + if _params.get('create_route') is not None: # noqa: E501 + _query_params.append(('createRoute', _params['create_route'].value)) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetSharedAudienceGroupsResponse", + } + + return self.api_client.call_api( + '/v2/bot/audienceGroup/shared/list', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @overload async def update_audience_group_authority_level(self, update_audience_group_authority_level_request : UpdateAudienceGroupAuthorityLevelRequest, **kwargs) -> None: # noqa: E501 ... diff --git a/linebot/v3/audience/api/manage_audience.py b/linebot/v3/audience/api/manage_audience.py index eb9bfa939..3163e66a1 100644 --- a/linebot/v3/audience/api/manage_audience.py +++ b/linebot/v3/audience/api/manage_audience.py @@ -34,6 +34,8 @@ from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest @@ -1371,6 +1373,321 @@ def get_audience_groups_with_http_info(self, page : Annotated[conint(strict=True collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def get_shared_audience_data(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], **kwargs) -> GetSharedAudienceDataResponse: # noqa: E501 + """get_shared_audience_data # noqa: E501 + + Gets audience data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_data(audience_group_id, async_req=True) + >>> result = thread.get() + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :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. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: GetSharedAudienceDataResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_shared_audience_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_shared_audience_data_with_http_info(audience_group_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_shared_audience_data_with_http_info(self, audience_group_id : Annotated[StrictInt, Field(..., description="The audience ID.")], **kwargs) -> ApiResponse: # noqa: E501 + """get_shared_audience_data # noqa: E501 + + Gets audience data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_data_with_http_info(audience_group_id, async_req=True) + >>> result = thread.get() + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :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. + :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 + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(GetSharedAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'audience_group_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_audience_data" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['audience_group_id']: + _path_params['audienceGroupId'] = _params['audience_group_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetSharedAudienceDataResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/audienceGroup/shared/{audienceGroupId}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_shared_audience_groups(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, **kwargs) -> GetSharedAudienceGroupsResponse: # noqa: E501 + """get_shared_audience_groups # noqa: E501 + + Gets data for more than one audience, including those shared by the Business Manager. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_groups(page, description, status, size, create_route, async_req=True) + >>> result = thread.get() + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :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. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: GetSharedAudienceGroupsResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_shared_audience_groups_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, **kwargs) # noqa: E501 + + @validate_arguments + def get_shared_audience_groups_with_http_info(self, page : Annotated[conint(strict=True, ge=1), Field(..., description="The page to return when getting (paginated) results. Must be 1 or higher.")], description : Annotated[Optional[StrictStr], Field(description="The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ")] = None, status : Annotated[Optional[AudienceGroupStatus], Field(description="The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ")] = None, size : Annotated[Optional[conint(strict=True, le=40)], Field(description="The number of audiences per page. Default: 20 Max: 40 ")] = None, create_route : Annotated[Optional[AudienceGroupCreateRoute], Field(description="How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """get_shared_audience_groups # noqa: E501 + + Gets data for more than one audience, including those shared by the Business Manager. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, async_req=True) + >>> result = thread.get() + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :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. + :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 + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(GetSharedAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'page', + 'description', + 'status', + 'size', + 'create_route' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_audience_groups" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('page') is not None: # noqa: E501 + _query_params.append(('page', _params['page'])) + + if _params.get('description') is not None: # noqa: E501 + _query_params.append(('description', _params['description'])) + + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'].value)) + + if _params.get('size') is not None: # noqa: E501 + _query_params.append(('size', _params['size'])) + + if _params.get('create_route') is not None: # noqa: E501 + _query_params.append(('createRoute', _params['create_route'].value)) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetSharedAudienceGroupsResponse", + } + + return self.api_client.call_api( + '/v2/bot/audienceGroup/shared/list', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def update_audience_group_authority_level(self, update_audience_group_authority_level_request : UpdateAudienceGroupAuthorityLevelRequest, **kwargs) -> None: # noqa: E501 """update_audience_group_authority_level # noqa: E501 diff --git a/linebot/v3/audience/docs/ManageAudience.md b/linebot/v3/audience/docs/ManageAudience.md index 19eb12fe8..a0cdb74d7 100644 --- a/linebot/v3/audience/docs/ManageAudience.md +++ b/linebot/v3/audience/docs/ManageAudience.md @@ -13,6 +13,8 @@ Method | HTTP request | Description [**get_audience_data**](ManageAudience.md#get_audience_data) | **GET** /v2/bot/audienceGroup/{audienceGroupId} | [**get_audience_group_authority_level**](ManageAudience.md#get_audience_group_authority_level) | **GET** /v2/bot/audienceGroup/authorityLevel | [**get_audience_groups**](ManageAudience.md#get_audience_groups) | **GET** /v2/bot/audienceGroup/list | +[**get_shared_audience_data**](ManageAudience.md#get_shared_audience_data) | **GET** /v2/bot/audienceGroup/shared/{audienceGroupId} | +[**get_shared_audience_groups**](ManageAudience.md#get_shared_audience_groups) | **GET** /v2/bot/audienceGroup/shared/list | [**update_audience_group_authority_level**](ManageAudience.md#update_audience_group_authority_level) | **PUT** /v2/bot/audienceGroup/authorityLevel | [**update_audience_group_description**](ManageAudience.md#update_audience_group_description) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/updateDescription | @@ -696,6 +698,167 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_shared_audience_data** +> GetSharedAudienceDataResponse get_shared_audience_data(audience_group_id) + + + +Gets audience data. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.audience +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.line.me +# See configuration.py for a list of all supported configuration parameters. +configuration = linebot.v3.audience.Configuration( + host = "https://api.line.me" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: Bearer +configuration = linebot.v3.audience.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with linebot.v3.audience.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = linebot.v3.audience.ManageAudience(api_client) + audience_group_id = 56 # int | The audience ID. + + try: + api_response = api_instance.get_shared_audience_data(audience_group_id) + print("The response of ManageAudience->get_shared_audience_data:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ManageAudience->get_shared_audience_data: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **audience_group_id** | **int**| The audience ID. | + +### Return type + +[**GetSharedAudienceDataResponse**](GetSharedAudienceDataResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_shared_audience_groups** +> GetSharedAudienceGroupsResponse get_shared_audience_groups(page, description=description, status=status, size=size, create_route=create_route) + + + +Gets data for more than one audience, including those shared by the Business Manager. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.audience +from linebot.v3.audience.models.audience_group_create_route import AudienceGroupCreateRoute +from linebot.v3.audience.models.audience_group_status import AudienceGroupStatus +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse +from linebot.v3.audience.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.line.me +# See configuration.py for a list of all supported configuration parameters. +configuration = linebot.v3.audience.Configuration( + host = "https://api.line.me" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: Bearer +configuration = linebot.v3.audience.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with linebot.v3.audience.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = linebot.v3.audience.ManageAudience(api_client) + page = 56 # int | The page to return when getting (paginated) results. Must be 1 or higher. + description = 'description_example' # str | The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. (optional) + status = linebot.v3.audience.AudienceGroupStatus() # AudienceGroupStatus | The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. (optional) + size = 20 # int | The number of audiences per page. Default: 20 Max: 40 (optional) + create_route = linebot.v3.audience.AudienceGroupCreateRoute() # AudienceGroupCreateRoute | How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. (optional) + + try: + api_response = api_instance.get_shared_audience_groups(page, description=description, status=status, size=size, create_route=create_route) + print("The response of ManageAudience->get_shared_audience_groups:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ManageAudience->get_shared_audience_groups: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **page** | **int**| The page to return when getting (paginated) results. Must be 1 or higher. | + **description** | **str**| The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. | [optional] + **status** | [**AudienceGroupStatus**](.md)| The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. | [optional] + **size** | **int**| The number of audiences per page. Default: 20 Max: 40 | [optional] + **create_route** | [**AudienceGroupCreateRoute**](.md)| How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. | [optional] + +### Return type + +[**GetSharedAudienceGroupsResponse**](GetSharedAudienceGroupsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **update_audience_group_authority_level** > update_audience_group_authority_level(update_audience_group_authority_level_request) diff --git a/linebot/v3/audience/models/__init__.py b/linebot/v3/audience/models/__init__.py index c0d0b3d17..f215e2f2a 100644 --- a/linebot/v3/audience/models/__init__.py +++ b/linebot/v3/audience/models/__init__.py @@ -14,6 +14,7 @@ # import models into model package +from linebot.v3.audience.models.adaccount import Adaccount from linebot.v3.audience.models.add_audience_to_audience_group_request import AddAudienceToAudienceGroupRequest from linebot.v3.audience.models.audience import Audience from linebot.v3.audience.models.audience_group import AudienceGroup @@ -33,10 +34,13 @@ from linebot.v3.audience.models.create_click_based_audience_group_response import CreateClickBasedAudienceGroupResponse from linebot.v3.audience.models.create_imp_based_audience_group_request import CreateImpBasedAudienceGroupRequest from linebot.v3.audience.models.create_imp_based_audience_group_response import CreateImpBasedAudienceGroupResponse +from linebot.v3.audience.models.detailed_owner import DetailedOwner from linebot.v3.audience.models.error_detail import ErrorDetail from linebot.v3.audience.models.error_response import ErrorResponse from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest diff --git a/linebot/v3/audience/models/adaccount.py b/linebot/v3/audience/models/adaccount.py new file mode 100644 index 000000000..f17e4f6f8 --- /dev/null +++ b/linebot/v3/audience/models/adaccount.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic.v1 import BaseModel, Field, StrictStr + +class Adaccount(BaseModel): + """ + Adaccount + """ + name: Optional[StrictStr] = Field(None, description="Ad account name.") + + __properties = ["name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Adaccount: + """Create an instance of Adaccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Adaccount: + """Create an instance of Adaccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Adaccount.parse_obj(obj) + + _obj = Adaccount.parse_obj({ + "name": obj.get("name") + }) + return _obj + diff --git a/linebot/v3/audience/models/detailed_owner.py b/linebot/v3/audience/models/detailed_owner.py new file mode 100644 index 000000000..e665501c6 --- /dev/null +++ b/linebot/v3/audience/models/detailed_owner.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic.v1 import BaseModel, Field, StrictStr + +class DetailedOwner(BaseModel): + """ + Owner of this audience group. + """ + service_type: Optional[StrictStr] = Field(None, alias="serviceType", description="Service name where the audience group has been created.") + id: Optional[StrictStr] = Field(None, description="Owner ID in the service.") + name: Optional[StrictStr] = Field(None, description="Owner account name.") + + __properties = ["serviceType", "id", "name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> DetailedOwner: + """Create an instance of DetailedOwner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DetailedOwner: + """Create an instance of DetailedOwner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DetailedOwner.parse_obj(obj) + + _obj = DetailedOwner.parse_obj({ + "service_type": obj.get("serviceType"), + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + diff --git a/linebot/v3/audience/models/get_audience_data_response.py b/linebot/v3/audience/models/get_audience_data_response.py index 81b9d962f..1fd5ff543 100644 --- a/linebot/v3/audience/models/get_audience_data_response.py +++ b/linebot/v3/audience/models/get_audience_data_response.py @@ -20,6 +20,7 @@ from typing import List, Optional from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.audience.models.adaccount import Adaccount from linebot.v3.audience.models.audience_group import AudienceGroup from linebot.v3.audience.models.audience_group_job import AudienceGroupJob @@ -30,8 +31,9 @@ class GetAudienceDataResponse(BaseModel): """ audience_group: Optional[AudienceGroup] = Field(None, alias="audienceGroup") jobs: Optional[conlist(AudienceGroupJob, max_items=50)] = Field(None, description="An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 ") + adaccount: Optional[Adaccount] = None - __properties = ["audienceGroup", "jobs"] + __properties = ["audienceGroup", "jobs", "adaccount"] class Config: """Pydantic configuration""" @@ -67,6 +69,9 @@ def to_dict(self): if _item: _items.append(_item.to_dict()) _dict['jobs'] = _items + # override the default output from pydantic.v1 by calling `to_dict()` of adaccount + if self.adaccount: + _dict['adaccount'] = self.adaccount.to_dict() return _dict @classmethod @@ -80,7 +85,8 @@ def from_dict(cls, obj: dict) -> GetAudienceDataResponse: _obj = GetAudienceDataResponse.parse_obj({ "audience_group": AudienceGroup.from_dict(obj.get("audienceGroup")) if obj.get("audienceGroup") is not None else None, - "jobs": [AudienceGroupJob.from_dict(_item) for _item in obj.get("jobs")] if obj.get("jobs") is not None else None + "jobs": [AudienceGroupJob.from_dict(_item) for _item in obj.get("jobs")] if obj.get("jobs") is not None else None, + "adaccount": Adaccount.from_dict(obj.get("adaccount")) if obj.get("adaccount") is not None else None }) return _obj diff --git a/linebot/v3/audience/models/get_shared_audience_data_response.py b/linebot/v3/audience/models/get_shared_audience_data_response.py new file mode 100644 index 000000000..5d8702c37 --- /dev/null +++ b/linebot/v3/audience/models/get_shared_audience_data_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.audience.models.audience_group import AudienceGroup +from linebot.v3.audience.models.audience_group_job import AudienceGroupJob +from linebot.v3.audience.models.detailed_owner import DetailedOwner + +class GetSharedAudienceDataResponse(BaseModel): + """ + Get audience data + https://developers.line.biz/en/reference/messaging-api/#get-audience-group + """ + audience_group: Optional[AudienceGroup] = Field(None, alias="audienceGroup") + jobs: Optional[conlist(AudienceGroupJob, max_items=50)] = Field(None, description="An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 ") + owner: Optional[DetailedOwner] = None + + __properties = ["audienceGroup", "jobs", "owner"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> GetSharedAudienceDataResponse: + """Create an instance of GetSharedAudienceDataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic.v1 by calling `to_dict()` of audience_group + if self.audience_group: + _dict['audienceGroup'] = self.audience_group.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of each item in jobs (list) + _items = [] + if self.jobs: + for _item in self.jobs: + if _item: + _items.append(_item.to_dict()) + _dict['jobs'] = _items + # override the default output from pydantic.v1 by calling `to_dict()` of owner + if self.owner: + _dict['owner'] = self.owner.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetSharedAudienceDataResponse: + """Create an instance of GetSharedAudienceDataResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetSharedAudienceDataResponse.parse_obj(obj) + + _obj = GetSharedAudienceDataResponse.parse_obj({ + "audience_group": AudienceGroup.from_dict(obj.get("audienceGroup")) if obj.get("audienceGroup") is not None else None, + "jobs": [AudienceGroupJob.from_dict(_item) for _item in obj.get("jobs")] if obj.get("jobs") is not None else None, + "owner": DetailedOwner.from_dict(obj.get("owner")) if obj.get("owner") is not None else None + }) + return _obj + diff --git a/linebot/v3/audience/models/get_shared_audience_groups_response.py b/linebot/v3/audience/models/get_shared_audience_groups_response.py new file mode 100644 index 000000000..fd8286faa --- /dev/null +++ b/linebot/v3/audience/models/get_shared_audience_groups_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic.v1 import BaseModel, Field, StrictBool, StrictInt, conlist +from linebot.v3.audience.models.audience_group import AudienceGroup + +class GetSharedAudienceGroupsResponse(BaseModel): + """ + Gets data for more than one audience. + https://developers.line.biz/en/reference/messaging-api/#get-audience-groups + """ + audience_groups: Optional[conlist(AudienceGroup)] = Field(None, alias="audienceGroups", description="An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.") + has_next_page: Optional[StrictBool] = Field(None, alias="hasNextPage", description="true when this is not the last page.") + total_count: Optional[StrictInt] = Field(None, alias="totalCount", description="The total number of audiences that can be returned with the specified filter.") + read_write_audience_group_total_count: Optional[StrictInt] = Field(None, alias="readWriteAudienceGroupTotalCount", description="Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.") + page: Optional[StrictInt] = Field(None, description="The current page number.") + size: Optional[StrictInt] = Field(None, description="The maximum number of audiences on the current page.") + + __properties = ["audienceGroups", "hasNextPage", "totalCount", "readWriteAudienceGroupTotalCount", "page", "size"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> GetSharedAudienceGroupsResponse: + """Create an instance of GetSharedAudienceGroupsResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic.v1 by calling `to_dict()` of each item in audience_groups (list) + _items = [] + if self.audience_groups: + for _item in self.audience_groups: + if _item: + _items.append(_item.to_dict()) + _dict['audienceGroups'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetSharedAudienceGroupsResponse: + """Create an instance of GetSharedAudienceGroupsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetSharedAudienceGroupsResponse.parse_obj(obj) + + _obj = GetSharedAudienceGroupsResponse.parse_obj({ + "audience_groups": [AudienceGroup.from_dict(_item) for _item in obj.get("audienceGroups")] if obj.get("audienceGroups") is not None else None, + "has_next_page": obj.get("hasNextPage"), + "total_count": obj.get("totalCount"), + "read_write_audience_group_total_count": obj.get("readWriteAudienceGroupTotalCount"), + "page": obj.get("page"), + "size": obj.get("size") + }) + return _obj +