Skip to content

Commit 8955719

Browse files
github-actions[bot]github-actions
and
github-actions
authored
Add /v2/bot/audienceGroup/shared path (#757)
line/line-openapi#85 # Shared Audiences in Business Manager API Support We have added and supported new API endpoints related to Shared Audiences in Business Manager. ## API to Get Shared Audience Information You can obtain detailed information about a specific audience shared in Business Manager by calling the endpoint: - GET `https://api.line.me/v2/bot/audienceGroup/shared/{audienceGroupId}` ## API to Get List of Shared Audiences You can acquire a list of audiences shared in Business Manager using the following endpoint: - GET `https://api.line.me/v2/bot/audienceGroup/shared/list` By using the "Get Shared Audience Information" endpoint, you can retrieve more detailed data about each audience. ## Documents and Reference - News Announcement: [Shared Audience Feature Release](https://developers.line.biz/en/news/2025/02/12/shared-audience/) - API Reference: - [Get List of Shared Audiences](https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list) - [Get Shared Audience Information](https://developers.line.biz/en/reference/messaging-api/#get-shared-audience) - Documentation on Audience Sharing: [Using Audience Sharing](https://developers.line.biz/en/docs/messaging-api/using-audience/#audience-sharing) For more information, please refer to the links provided above. Co-authored-by: github-actions <[email protected]>
1 parent d60ff10 commit 8955719

11 files changed

+1162
-3
lines changed

line-openapi

linebot/v3/audience/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from linebot.v3.audience.exceptions import ApiException
3636

3737
# import models into sdk package
38+
from linebot.v3.audience.models.adaccount import Adaccount
3839
from linebot.v3.audience.models.add_audience_to_audience_group_request import AddAudienceToAudienceGroupRequest
3940
from linebot.v3.audience.models.audience import Audience
4041
from linebot.v3.audience.models.audience_group import AudienceGroup
@@ -54,10 +55,13 @@
5455
from linebot.v3.audience.models.create_click_based_audience_group_response import CreateClickBasedAudienceGroupResponse
5556
from linebot.v3.audience.models.create_imp_based_audience_group_request import CreateImpBasedAudienceGroupRequest
5657
from linebot.v3.audience.models.create_imp_based_audience_group_response import CreateImpBasedAudienceGroupResponse
58+
from linebot.v3.audience.models.detailed_owner import DetailedOwner
5759
from linebot.v3.audience.models.error_detail import ErrorDetail
5860
from linebot.v3.audience.models.error_response import ErrorResponse
5961
from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse
6062
from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse
6163
from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse
64+
from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse
65+
from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse
6266
from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest
6367
from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest

linebot/v3/audience/api/async_manage_audience.py

+337
Large diffs are not rendered by default.

linebot/v3/audience/api/manage_audience.py

+317
Large diffs are not rendered by default.

linebot/v3/audience/docs/ManageAudience.md

+163
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Method | HTTP request | Description
1313
[**get_audience_data**](ManageAudience.md#get_audience_data) | **GET** /v2/bot/audienceGroup/{audienceGroupId} |
1414
[**get_audience_group_authority_level**](ManageAudience.md#get_audience_group_authority_level) | **GET** /v2/bot/audienceGroup/authorityLevel |
1515
[**get_audience_groups**](ManageAudience.md#get_audience_groups) | **GET** /v2/bot/audienceGroup/list |
16+
[**get_shared_audience_data**](ManageAudience.md#get_shared_audience_data) | **GET** /v2/bot/audienceGroup/shared/{audienceGroupId} |
17+
[**get_shared_audience_groups**](ManageAudience.md#get_shared_audience_groups) | **GET** /v2/bot/audienceGroup/shared/list |
1618
[**update_audience_group_authority_level**](ManageAudience.md#update_audience_group_authority_level) | **PUT** /v2/bot/audienceGroup/authorityLevel |
1719
[**update_audience_group_description**](ManageAudience.md#update_audience_group_description) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/updateDescription |
1820

@@ -696,6 +698,167 @@ Name | Type | Description | Notes
696698

697699
[[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)
698700

701+
# **get_shared_audience_data**
702+
> GetSharedAudienceDataResponse get_shared_audience_data(audience_group_id)
703+
704+
705+
706+
Gets audience data.
707+
708+
### Example
709+
710+
* Bearer Authentication (Bearer):
711+
```python
712+
import time
713+
import os
714+
import linebot.v3.audience
715+
from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse
716+
from linebot.v3.audience.rest import ApiException
717+
from pprint import pprint
718+
719+
# Defining the host is optional and defaults to https://api.line.me
720+
# See configuration.py for a list of all supported configuration parameters.
721+
configuration = linebot.v3.audience.Configuration(
722+
host = "https://api.line.me"
723+
)
724+
725+
# The client must configure the authentication and authorization parameters
726+
# in accordance with the API server security policy.
727+
# Examples for each auth method are provided below, use the example that
728+
# satisfies your auth use case.
729+
730+
# Configure Bearer authorization: Bearer
731+
configuration = linebot.v3.audience.Configuration(
732+
access_token = os.environ["BEARER_TOKEN"]
733+
)
734+
735+
# Enter a context with an instance of the API client
736+
with linebot.v3.audience.ApiClient(configuration) as api_client:
737+
# Create an instance of the API class
738+
api_instance = linebot.v3.audience.ManageAudience(api_client)
739+
audience_group_id = 56 # int | The audience ID.
740+
741+
try:
742+
api_response = api_instance.get_shared_audience_data(audience_group_id)
743+
print("The response of ManageAudience->get_shared_audience_data:\n")
744+
pprint(api_response)
745+
except Exception as e:
746+
print("Exception when calling ManageAudience->get_shared_audience_data: %s\n" % e)
747+
```
748+
749+
750+
### Parameters
751+
752+
Name | Type | Description | Notes
753+
------------- | ------------- | ------------- | -------------
754+
**audience_group_id** | **int**| The audience ID. |
755+
756+
### Return type
757+
758+
[**GetSharedAudienceDataResponse**](GetSharedAudienceDataResponse.md)
759+
760+
### Authorization
761+
762+
[Bearer](../README.md#Bearer)
763+
764+
### HTTP request headers
765+
766+
- **Content-Type**: Not defined
767+
- **Accept**: application/json
768+
769+
### HTTP response details
770+
| Status code | Description | Response headers |
771+
|-------------|-------------|------------------|
772+
**200** | OK | - |
773+
**400** | Bad request | - |
774+
775+
[[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)
776+
777+
# **get_shared_audience_groups**
778+
> GetSharedAudienceGroupsResponse get_shared_audience_groups(page, description=description, status=status, size=size, create_route=create_route)
779+
780+
781+
782+
Gets data for more than one audience, including those shared by the Business Manager.
783+
784+
### Example
785+
786+
* Bearer Authentication (Bearer):
787+
```python
788+
import time
789+
import os
790+
import linebot.v3.audience
791+
from linebot.v3.audience.models.audience_group_create_route import AudienceGroupCreateRoute
792+
from linebot.v3.audience.models.audience_group_status import AudienceGroupStatus
793+
from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse
794+
from linebot.v3.audience.rest import ApiException
795+
from pprint import pprint
796+
797+
# Defining the host is optional and defaults to https://api.line.me
798+
# See configuration.py for a list of all supported configuration parameters.
799+
configuration = linebot.v3.audience.Configuration(
800+
host = "https://api.line.me"
801+
)
802+
803+
# The client must configure the authentication and authorization parameters
804+
# in accordance with the API server security policy.
805+
# Examples for each auth method are provided below, use the example that
806+
# satisfies your auth use case.
807+
808+
# Configure Bearer authorization: Bearer
809+
configuration = linebot.v3.audience.Configuration(
810+
access_token = os.environ["BEARER_TOKEN"]
811+
)
812+
813+
# Enter a context with an instance of the API client
814+
with linebot.v3.audience.ApiClient(configuration) as api_client:
815+
# Create an instance of the API class
816+
api_instance = linebot.v3.audience.ManageAudience(api_client)
817+
page = 56 # int | The page to return when getting (paginated) results. Must be 1 or higher.
818+
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)
819+
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)
820+
size = 20 # int | The number of audiences per page. Default: 20 Max: 40 (optional)
821+
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)
822+
823+
try:
824+
api_response = api_instance.get_shared_audience_groups(page, description=description, status=status, size=size, create_route=create_route)
825+
print("The response of ManageAudience->get_shared_audience_groups:\n")
826+
pprint(api_response)
827+
except Exception as e:
828+
print("Exception when calling ManageAudience->get_shared_audience_groups: %s\n" % e)
829+
```
830+
831+
832+
### Parameters
833+
834+
Name | Type | Description | Notes
835+
------------- | ------------- | ------------- | -------------
836+
**page** | **int**| The page to return when getting (paginated) results. Must be 1 or higher. |
837+
**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]
838+
**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]
839+
**size** | **int**| The number of audiences per page. Default: 20 Max: 40 | [optional]
840+
**create_route** | [**AudienceGroupCreateRoute**](.md)| How the audience was created. If omitted, all audiences are included. &#x60;OA_MANAGER&#x60;: Return only audiences created with LINE Official Account Manager (opens new window). &#x60;MESSAGING_API&#x60;: Return only audiences created with Messaging API. | [optional]
841+
842+
### Return type
843+
844+
[**GetSharedAudienceGroupsResponse**](GetSharedAudienceGroupsResponse.md)
845+
846+
### Authorization
847+
848+
[Bearer](../README.md#Bearer)
849+
850+
### HTTP request headers
851+
852+
- **Content-Type**: Not defined
853+
- **Accept**: application/json
854+
855+
### HTTP response details
856+
| Status code | Description | Response headers |
857+
|-------------|-------------|------------------|
858+
**200** | OK | - |
859+
860+
[[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)
861+
699862
# **update_audience_group_authority_level**
700863
> update_audience_group_authority_level(update_audience_group_authority_level_request)
701864

linebot/v3/audience/models/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616
# import models into model package
17+
from linebot.v3.audience.models.adaccount import Adaccount
1718
from linebot.v3.audience.models.add_audience_to_audience_group_request import AddAudienceToAudienceGroupRequest
1819
from linebot.v3.audience.models.audience import Audience
1920
from linebot.v3.audience.models.audience_group import AudienceGroup
@@ -33,10 +34,13 @@
3334
from linebot.v3.audience.models.create_click_based_audience_group_response import CreateClickBasedAudienceGroupResponse
3435
from linebot.v3.audience.models.create_imp_based_audience_group_request import CreateImpBasedAudienceGroupRequest
3536
from linebot.v3.audience.models.create_imp_based_audience_group_response import CreateImpBasedAudienceGroupResponse
37+
from linebot.v3.audience.models.detailed_owner import DetailedOwner
3638
from linebot.v3.audience.models.error_detail import ErrorDetail
3739
from linebot.v3.audience.models.error_response import ErrorResponse
3840
from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse
3941
from linebot.v3.audience.models.get_audience_group_authority_level_response import GetAudienceGroupAuthorityLevelResponse
4042
from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse
43+
from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse
44+
from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse
4145
from linebot.v3.audience.models.update_audience_group_authority_level_request import UpdateAudienceGroupAuthorityLevelRequest
4246
from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# coding: utf-8
2+
3+
"""
4+
LINE Messaging API
5+
6+
This document describes LINE Messaging API. # noqa: E501
7+
8+
The version of the OpenAPI document: 0.0.1
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
"""
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
21+
from typing import Optional
22+
from pydantic.v1 import BaseModel, Field, StrictStr
23+
24+
class Adaccount(BaseModel):
25+
"""
26+
Adaccount
27+
"""
28+
name: Optional[StrictStr] = Field(None, description="Ad account name.")
29+
30+
__properties = ["name"]
31+
32+
class Config:
33+
"""Pydantic configuration"""
34+
allow_population_by_field_name = True
35+
validate_assignment = True
36+
37+
def to_str(self) -> str:
38+
"""Returns the string representation of the model using alias"""
39+
return pprint.pformat(self.dict(by_alias=True))
40+
41+
def to_json(self) -> str:
42+
"""Returns the JSON representation of the model using alias"""
43+
return json.dumps(self.to_dict())
44+
45+
@classmethod
46+
def from_json(cls, json_str: str) -> Adaccount:
47+
"""Create an instance of Adaccount from a JSON string"""
48+
return cls.from_dict(json.loads(json_str))
49+
50+
def to_dict(self):
51+
"""Returns the dictionary representation of the model using alias"""
52+
_dict = self.dict(by_alias=True,
53+
exclude={
54+
},
55+
exclude_none=True)
56+
return _dict
57+
58+
@classmethod
59+
def from_dict(cls, obj: dict) -> Adaccount:
60+
"""Create an instance of Adaccount from a dict"""
61+
if obj is None:
62+
return None
63+
64+
if not isinstance(obj, dict):
65+
return Adaccount.parse_obj(obj)
66+
67+
_obj = Adaccount.parse_obj({
68+
"name": obj.get("name")
69+
})
70+
return _obj
71+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# coding: utf-8
2+
3+
"""
4+
LINE Messaging API
5+
6+
This document describes LINE Messaging API. # noqa: E501
7+
8+
The version of the OpenAPI document: 0.0.1
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
"""
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
21+
from typing import Optional
22+
from pydantic.v1 import BaseModel, Field, StrictStr
23+
24+
class DetailedOwner(BaseModel):
25+
"""
26+
Owner of this audience group.
27+
"""
28+
service_type: Optional[StrictStr] = Field(None, alias="serviceType", description="Service name where the audience group has been created.")
29+
id: Optional[StrictStr] = Field(None, description="Owner ID in the service.")
30+
name: Optional[StrictStr] = Field(None, description="Owner account name.")
31+
32+
__properties = ["serviceType", "id", "name"]
33+
34+
class Config:
35+
"""Pydantic configuration"""
36+
allow_population_by_field_name = True
37+
validate_assignment = True
38+
39+
def to_str(self) -> str:
40+
"""Returns the string representation of the model using alias"""
41+
return pprint.pformat(self.dict(by_alias=True))
42+
43+
def to_json(self) -> str:
44+
"""Returns the JSON representation of the model using alias"""
45+
return json.dumps(self.to_dict())
46+
47+
@classmethod
48+
def from_json(cls, json_str: str) -> DetailedOwner:
49+
"""Create an instance of DetailedOwner from a JSON string"""
50+
return cls.from_dict(json.loads(json_str))
51+
52+
def to_dict(self):
53+
"""Returns the dictionary representation of the model using alias"""
54+
_dict = self.dict(by_alias=True,
55+
exclude={
56+
},
57+
exclude_none=True)
58+
return _dict
59+
60+
@classmethod
61+
def from_dict(cls, obj: dict) -> DetailedOwner:
62+
"""Create an instance of DetailedOwner from a dict"""
63+
if obj is None:
64+
return None
65+
66+
if not isinstance(obj, dict):
67+
return DetailedOwner.parse_obj(obj)
68+
69+
_obj = DetailedOwner.parse_obj({
70+
"service_type": obj.get("serviceType"),
71+
"id": obj.get("id"),
72+
"name": obj.get("name")
73+
})
74+
return _obj
75+

0 commit comments

Comments
 (0)