Skip to content

Commit 63f3874

Browse files
github-actions[bot]github-actions
andauthored
Add /v2/bot/audienceGroup/shared path (#541)
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 f6bf6af commit 63f3874

File tree

8 files changed

+356
-1
lines changed

8 files changed

+356
-1
lines changed

line-openapi

linebot/manage_audience/.openapi-generator/FILES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
api_manage_audience.go
22
api_manage_audience_blob.go
3+
model_adaccount.go
34
model_add_audience_to_audience_group_request.go
45
model_audience.go
56
model_audience_group.go
@@ -19,10 +20,13 @@ model_create_click_based_audience_group_request.go
1920
model_create_click_based_audience_group_response.go
2021
model_create_imp_based_audience_group_request.go
2122
model_create_imp_based_audience_group_response.go
23+
model_detailed_owner.go
2224
model_error_detail.go
2325
model_error_response.go
2426
model_get_audience_data_response.go
2527
model_get_audience_group_authority_level_response.go
2628
model_get_audience_groups_response.go
29+
model_get_shared_audience_data_response.go
30+
model_get_shared_audience_groups_response.go
2731
model_update_audience_group_authority_level_request.go
2832
model_update_audience_group_description_request.go

linebot/manage_audience/api_manage_audience.go

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,183 @@ func (client *ManageAudienceAPI) GetAudienceGroupsWithHttpInfo(
764764

765765
}
766766

767+
// GetSharedAudienceData
768+
//
769+
// Gets audience data.
770+
// Parameters:
771+
// audienceGroupId The audience ID.
772+
773+
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience
774+
func (client *ManageAudienceAPI) GetSharedAudienceData(
775+
776+
audienceGroupId int64,
777+
778+
) (*GetSharedAudienceDataResponse, error) {
779+
_, body, error := client.GetSharedAudienceDataWithHttpInfo(
780+
781+
audienceGroupId,
782+
)
783+
return body, error
784+
}
785+
786+
// GetSharedAudienceData
787+
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
788+
//
789+
// Gets audience data.
790+
// Parameters:
791+
// audienceGroupId The audience ID.
792+
793+
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience
794+
func (client *ManageAudienceAPI) GetSharedAudienceDataWithHttpInfo(
795+
796+
audienceGroupId int64,
797+
798+
) (*http.Response, *GetSharedAudienceDataResponse, error) {
799+
path := "/v2/bot/audienceGroup/shared/{audienceGroupId}"
800+
801+
path = strings.Replace(path, "{audienceGroupId}", strconv.FormatInt(audienceGroupId, 10), -1)
802+
803+
req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
804+
if err != nil {
805+
return nil, nil, err
806+
}
807+
808+
res, err := client.Do(req)
809+
810+
if err != nil {
811+
return res, nil, err
812+
}
813+
814+
if res.StatusCode/100 != 2 {
815+
bodyBytes, err := io.ReadAll(res.Body)
816+
bodyReader := bytes.NewReader(bodyBytes)
817+
if err != nil {
818+
return res, nil, fmt.Errorf("failed to read response body: %w", err)
819+
}
820+
res.Body = io.NopCloser(bodyReader)
821+
return res, nil, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
822+
}
823+
824+
defer res.Body.Close()
825+
826+
decoder := json.NewDecoder(res.Body)
827+
result := GetSharedAudienceDataResponse{}
828+
if err := decoder.Decode(&result); err != nil {
829+
return res, nil, fmt.Errorf("failed to decode JSON: %w", err)
830+
}
831+
return res, &result, nil
832+
833+
}
834+
835+
// GetSharedAudienceGroups
836+
//
837+
// Gets data for more than one audience, including those shared by the Business Manager.
838+
// Parameters:
839+
// page The page to return when getting (paginated) results. Must be 1 or higher.
840+
// 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.
841+
// 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.
842+
// size The number of audiences per page. Default: 20 Max: 40
843+
// createRoute 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.
844+
845+
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
846+
func (client *ManageAudienceAPI) GetSharedAudienceGroups(
847+
848+
page int64,
849+
850+
description string,
851+
852+
status AudienceGroupStatus,
853+
854+
size int64,
855+
856+
createRoute AudienceGroupCreateRoute,
857+
858+
) (*GetSharedAudienceGroupsResponse, error) {
859+
_, body, error := client.GetSharedAudienceGroupsWithHttpInfo(
860+
861+
page,
862+
863+
description,
864+
865+
status,
866+
867+
size,
868+
869+
createRoute,
870+
)
871+
return body, error
872+
}
873+
874+
// GetSharedAudienceGroups
875+
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
876+
//
877+
// Gets data for more than one audience, including those shared by the Business Manager.
878+
// Parameters:
879+
// page The page to return when getting (paginated) results. Must be 1 or higher.
880+
// 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.
881+
// 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.
882+
// size The number of audiences per page. Default: 20 Max: 40
883+
// createRoute 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.
884+
885+
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
886+
func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
887+
888+
page int64,
889+
890+
description string,
891+
892+
status AudienceGroupStatus,
893+
894+
size int64,
895+
896+
createRoute AudienceGroupCreateRoute,
897+
898+
) (*http.Response, *GetSharedAudienceGroupsResponse, error) {
899+
path := "/v2/bot/audienceGroup/shared/list"
900+
901+
req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
902+
if err != nil {
903+
return nil, nil, err
904+
}
905+
906+
query := url.Values{}
907+
query.Add("page", strconv.FormatInt(page, 10))
908+
if description != "" {
909+
query.Add("description", description)
910+
}
911+
query.Add("status", string(status))
912+
query.Add("size", strconv.FormatInt(size, 10))
913+
query.Add("createRoute", string(createRoute))
914+
915+
req.URL.RawQuery = query.Encode()
916+
917+
res, err := client.Do(req)
918+
919+
if err != nil {
920+
return res, nil, err
921+
}
922+
923+
if res.StatusCode/100 != 2 {
924+
bodyBytes, err := io.ReadAll(res.Body)
925+
bodyReader := bytes.NewReader(bodyBytes)
926+
if err != nil {
927+
return res, nil, fmt.Errorf("failed to read response body: %w", err)
928+
}
929+
res.Body = io.NopCloser(bodyReader)
930+
return res, nil, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
931+
}
932+
933+
defer res.Body.Close()
934+
935+
decoder := json.NewDecoder(res.Body)
936+
result := GetSharedAudienceGroupsResponse{}
937+
if err := decoder.Decode(&result); err != nil {
938+
return res, nil, fmt.Errorf("failed to decode JSON: %w", err)
939+
}
940+
return res, &result, nil
941+
942+
}
943+
767944
// UpdateAudienceGroupAuthorityLevel
768945
//
769946
// Change the authority level of the audience
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* LINE Messaging API
3+
* This document describes LINE Messaging API.
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
/**
14+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
15+
* https://openapi-generator.tech
16+
* Do not edit the class manually.
17+
*/
18+
19+
//go:generate python3 ../../generate-code.py
20+
package manage_audience
21+
22+
// Adaccount
23+
// Adaccount
24+
25+
type Adaccount struct {
26+
27+
/**
28+
* Ad account name.
29+
*/
30+
Name string `json:"name,omitempty"`
31+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* LINE Messaging API
3+
* This document describes LINE Messaging API.
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
/**
14+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
15+
* https://openapi-generator.tech
16+
* Do not edit the class manually.
17+
*/
18+
19+
//go:generate python3 ../../generate-code.py
20+
package manage_audience
21+
22+
// DetailedOwner
23+
// Owner of this audience group.
24+
25+
type DetailedOwner struct {
26+
27+
/**
28+
* Service name where the audience group has been created.
29+
*/
30+
ServiceType string `json:"serviceType,omitempty"`
31+
32+
/**
33+
* Owner ID in the service.
34+
*/
35+
Id string `json:"id,omitempty"`
36+
37+
/**
38+
* Owner account name.
39+
*/
40+
Name string `json:"name,omitempty"`
41+
}

linebot/manage_audience/model_get_audience_data_response.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ type GetAudienceDataResponse struct {
3333
* 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
3434
*/
3535
Jobs []AudienceGroupJob `json:"jobs,omitempty"`
36+
37+
/**
38+
* Get Adaccount
39+
*/
40+
Adaccount *Adaccount `json:"adaccount,omitempty"`
3641
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* LINE Messaging API
3+
* This document describes LINE Messaging API.
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
/**
14+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
15+
* https://openapi-generator.tech
16+
* Do not edit the class manually.
17+
*/
18+
19+
//go:generate python3 ../../generate-code.py
20+
package manage_audience
21+
22+
// GetSharedAudienceDataResponse
23+
// Get audience data
24+
// https://developers.line.biz/en/reference/messaging-api/#get-audience-group
25+
type GetSharedAudienceDataResponse struct {
26+
27+
/**
28+
* Get AudienceGroup
29+
*/
30+
AudienceGroup *AudienceGroup `json:"audienceGroup,omitempty"`
31+
32+
/**
33+
* 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
34+
*/
35+
Jobs []AudienceGroupJob `json:"jobs,omitempty"`
36+
37+
/**
38+
* Get Owner
39+
*/
40+
Owner *DetailedOwner `json:"owner,omitempty"`
41+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* LINE Messaging API
3+
* This document describes LINE Messaging API.
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
/**
14+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
15+
* https://openapi-generator.tech
16+
* Do not edit the class manually.
17+
*/
18+
19+
//go:generate python3 ../../generate-code.py
20+
package manage_audience
21+
22+
// GetSharedAudienceGroupsResponse
23+
// Gets data for more than one audience.
24+
// https://developers.line.biz/en/reference/messaging-api/#get-audience-groups
25+
type GetSharedAudienceGroupsResponse struct {
26+
27+
/**
28+
* An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.
29+
*/
30+
AudienceGroups []AudienceGroup `json:"audienceGroups,omitempty"`
31+
32+
/**
33+
* true when this is not the last page.
34+
*/
35+
HasNextPage bool `json:"hasNextPage"`
36+
37+
/**
38+
* The total number of audiences that can be returned with the specified filter.
39+
*/
40+
TotalCount int64 `json:"totalCount"`
41+
42+
/**
43+
* Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.
44+
*/
45+
ReadWriteAudienceGroupTotalCount int64 `json:"readWriteAudienceGroupTotalCount"`
46+
47+
/**
48+
* The current page number.
49+
*/
50+
Page int64 `json:"page"`
51+
52+
/**
53+
* The maximum number of audiences on the current page.
54+
*/
55+
Size int64 `json:"size"`
56+
}

0 commit comments

Comments
 (0)