Skip to content

Commit bd16dc7

Browse files
github-actions[bot]github-actions
andauthored
Add includesOwnedAudienceGroups Parameter to Audience API (#577)
line/line-openapi#105 # Enhancement to Shared Audiences API This PR introduces a new query parameter `includesOwnedAudienceGroups` to the `/v2/bot/audienceGroup/shared/list` endpoint in the Business Manager API. This enhancement allows users to specify whether to include audience groups owned by the user in the response. ## Changes Made - Added the `includesOwnedAudienceGroups` parameter to the API endpoint. - **Type**: Boolean - **Default**: false - **Description**: - `true`: Include audience groups owned by the LINE Official Account Manager. - `false`: Respond only with audience groups shared by Business Manager. - Removed the `/v2/bot/audienceGroup/{audienceGroupId}/activate` and `/v2/bot/audienceGroup/authorityLevel` endpoints. ## Purpose This update provides more flexibility in retrieving audience groups by allowing users to filter based on ownership. It is especially useful for users who manage both shared and owned audience groups. The removal of certain endpoints is part of a cleanup effort to streamline the API. Please review the changes and let me know if there are any questions or further modifications needed. ## Documents and Reference - [Get List of Shared Audiences](https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list) - [Removed Endpoints](https://developers.line.biz/en/news/2025/03/26/cross-targeting-closing/) For more information, please refer to the links provided above. Co-authored-by: github-actions <[email protected]>
1 parent f4a6d10 commit bd16dc7

File tree

3 files changed

+10
-187
lines changed

3 files changed

+10
-187
lines changed

line-openapi

linebot/manage_audience/.openapi-generator/FILES

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ model_adaccount.go
44
model_add_audience_to_audience_group_request.go
55
model_audience.go
66
model_audience_group.go
7-
model_audience_group_authority_level.go
87
model_audience_group_create_route.go
98
model_audience_group_failed_type.go
109
model_audience_group_job.go
@@ -24,9 +23,7 @@ model_detailed_owner.go
2423
model_error_detail.go
2524
model_error_response.go
2625
model_get_audience_data_response.go
27-
model_get_audience_group_authority_level_response.go
2826
model_get_audience_groups_response.go
2927
model_get_shared_audience_data_response.go
3028
model_get_shared_audience_groups_response.go
31-
model_update_audience_group_authority_level_request.go
3229
model_update_audience_group_description_request.go

linebot/manage_audience/api_manage_audience.go

Lines changed: 9 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -116,69 +116,6 @@ func WithEndpoint(endpoint string) ManageAudienceAPIOption {
116116
}
117117
}
118118

119-
// ActivateAudienceGroup
120-
//
121-
// Activate audience
122-
// Parameters:
123-
// audienceGroupId The audience ID.
124-
125-
// https://developers.line.biz/en/reference/messaging-api/#activate-audience-group
126-
func (client *ManageAudienceAPI) ActivateAudienceGroup(
127-
128-
audienceGroupId int64,
129-
130-
) (struct{}, error) {
131-
_, body, error := client.ActivateAudienceGroupWithHttpInfo(
132-
133-
audienceGroupId,
134-
)
135-
return body, error
136-
}
137-
138-
// ActivateAudienceGroup
139-
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
140-
//
141-
// Activate audience
142-
// Parameters:
143-
// audienceGroupId The audience ID.
144-
145-
// https://developers.line.biz/en/reference/messaging-api/#activate-audience-group
146-
func (client *ManageAudienceAPI) ActivateAudienceGroupWithHttpInfo(
147-
148-
audienceGroupId int64,
149-
150-
) (*http.Response, struct{}, error) {
151-
path := "/v2/bot/audienceGroup/{audienceGroupId}/activate"
152-
153-
path = strings.Replace(path, "{audienceGroupId}", strconv.FormatInt(audienceGroupId, 10), -1)
154-
155-
req, err := http.NewRequest(http.MethodPut, client.Url(path), nil)
156-
if err != nil {
157-
return nil, struct{}{}, err
158-
}
159-
160-
res, err := client.Do(req)
161-
162-
if err != nil {
163-
return res, struct{}{}, err
164-
}
165-
166-
if res.StatusCode/100 != 2 {
167-
bodyBytes, err := io.ReadAll(res.Body)
168-
bodyReader := bytes.NewReader(bodyBytes)
169-
if err != nil {
170-
return res, struct{}{}, fmt.Errorf("failed to read response body: %w", err)
171-
}
172-
res.Body = io.NopCloser(bodyReader)
173-
return res, struct{}{}, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
174-
}
175-
176-
defer res.Body.Close()
177-
178-
return res, struct{}{}, nil
179-
180-
}
181-
182119
// AddAudienceToAudienceGroup
183120
//
184121
// Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON)
@@ -593,59 +530,6 @@ func (client *ManageAudienceAPI) GetAudienceDataWithHttpInfo(
593530

594531
}
595532

596-
// GetAudienceGroupAuthorityLevel
597-
//
598-
// Get the authority level of the audience
599-
// Parameters:
600-
601-
// https://developers.line.biz/en/reference/messaging-api/#get-authority-level
602-
func (client *ManageAudienceAPI) GetAudienceGroupAuthorityLevel() (*GetAudienceGroupAuthorityLevelResponse, error) {
603-
_, body, error := client.GetAudienceGroupAuthorityLevelWithHttpInfo()
604-
return body, error
605-
}
606-
607-
// GetAudienceGroupAuthorityLevel
608-
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
609-
//
610-
// Get the authority level of the audience
611-
// Parameters:
612-
613-
// https://developers.line.biz/en/reference/messaging-api/#get-authority-level
614-
func (client *ManageAudienceAPI) GetAudienceGroupAuthorityLevelWithHttpInfo() (*http.Response, *GetAudienceGroupAuthorityLevelResponse, error) {
615-
path := "/v2/bot/audienceGroup/authorityLevel"
616-
617-
req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
618-
if err != nil {
619-
return nil, nil, err
620-
}
621-
622-
res, err := client.Do(req)
623-
624-
if err != nil {
625-
return res, nil, err
626-
}
627-
628-
if res.StatusCode/100 != 2 {
629-
bodyBytes, err := io.ReadAll(res.Body)
630-
bodyReader := bytes.NewReader(bodyBytes)
631-
if err != nil {
632-
return res, nil, fmt.Errorf("failed to read response body: %w", err)
633-
}
634-
res.Body = io.NopCloser(bodyReader)
635-
return res, nil, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
636-
}
637-
638-
defer res.Body.Close()
639-
640-
decoder := json.NewDecoder(res.Body)
641-
result := GetAudienceGroupAuthorityLevelResponse{}
642-
if err := decoder.Decode(&result); err != nil {
643-
return res, nil, fmt.Errorf("failed to decode JSON: %w", err)
644-
}
645-
return res, &result, nil
646-
647-
}
648-
649533
// GetAudienceGroups
650534
//
651535
// Gets data for more than one audience.
@@ -841,6 +725,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceDataWithHttpInfo(
841725
// 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.
842726
// size The number of audiences per page. Default: 20 Max: 40
843727
// 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.
728+
// includesOwnedAudienceGroups true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager
844729

845730
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
846731
func (client *ManageAudienceAPI) GetSharedAudienceGroups(
@@ -855,6 +740,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(
855740

856741
createRoute AudienceGroupCreateRoute,
857742

743+
includesOwnedAudienceGroups bool,
744+
858745
) (*GetSharedAudienceGroupsResponse, error) {
859746
_, body, error := client.GetSharedAudienceGroupsWithHttpInfo(
860747

@@ -867,6 +754,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(
867754
size,
868755

869756
createRoute,
757+
758+
includesOwnedAudienceGroups,
870759
)
871760
return body, error
872761
}
@@ -881,6 +770,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(
881770
// 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.
882771
// size The number of audiences per page. Default: 20 Max: 40
883772
// 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.
773+
// includesOwnedAudienceGroups true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager
884774

885775
// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
886776
func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
@@ -895,6 +785,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
895785

896786
createRoute AudienceGroupCreateRoute,
897787

788+
includesOwnedAudienceGroups bool,
789+
898790
) (*http.Response, *GetSharedAudienceGroupsResponse, error) {
899791
path := "/v2/bot/audienceGroup/shared/list"
900792

@@ -911,6 +803,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
911803
query.Add("status", string(status))
912804
query.Add("size", strconv.FormatInt(size, 10))
913805
query.Add("createRoute", string(createRoute))
806+
query.Add("includesOwnedAudienceGroups", strconv.FormatBool(includesOwnedAudienceGroups))
914807

915808
req.URL.RawQuery = query.Encode()
916809

@@ -941,73 +834,6 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
941834

942835
}
943836

944-
// UpdateAudienceGroupAuthorityLevel
945-
//
946-
// Change the authority level of the audience
947-
// Parameters:
948-
// updateAudienceGroupAuthorityLevelRequest
949-
950-
// https://developers.line.biz/en/reference/messaging-api/#change-authority-level
951-
func (client *ManageAudienceAPI) UpdateAudienceGroupAuthorityLevel(
952-
953-
updateAudienceGroupAuthorityLevelRequest *UpdateAudienceGroupAuthorityLevelRequest,
954-
955-
) (struct{}, error) {
956-
_, body, error := client.UpdateAudienceGroupAuthorityLevelWithHttpInfo(
957-
958-
updateAudienceGroupAuthorityLevelRequest,
959-
)
960-
return body, error
961-
}
962-
963-
// UpdateAudienceGroupAuthorityLevel
964-
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
965-
//
966-
// Change the authority level of the audience
967-
// Parameters:
968-
// updateAudienceGroupAuthorityLevelRequest
969-
970-
// https://developers.line.biz/en/reference/messaging-api/#change-authority-level
971-
func (client *ManageAudienceAPI) UpdateAudienceGroupAuthorityLevelWithHttpInfo(
972-
973-
updateAudienceGroupAuthorityLevelRequest *UpdateAudienceGroupAuthorityLevelRequest,
974-
975-
) (*http.Response, struct{}, error) {
976-
path := "/v2/bot/audienceGroup/authorityLevel"
977-
978-
var buf bytes.Buffer
979-
enc := json.NewEncoder(&buf)
980-
if err := enc.Encode(updateAudienceGroupAuthorityLevelRequest); err != nil {
981-
return nil, struct{}{}, err
982-
}
983-
req, err := http.NewRequest(http.MethodPut, client.Url(path), &buf)
984-
if err != nil {
985-
return nil, struct{}{}, err
986-
}
987-
req.Header.Set("Content-Type", "application/json; charset=UTF-8")
988-
989-
res, err := client.Do(req)
990-
991-
if err != nil {
992-
return res, struct{}{}, err
993-
}
994-
995-
if res.StatusCode/100 != 2 {
996-
bodyBytes, err := io.ReadAll(res.Body)
997-
bodyReader := bytes.NewReader(bodyBytes)
998-
if err != nil {
999-
return res, struct{}{}, fmt.Errorf("failed to read response body: %w", err)
1000-
}
1001-
res.Body = io.NopCloser(bodyReader)
1002-
return res, struct{}{}, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
1003-
}
1004-
1005-
defer res.Body.Close()
1006-
1007-
return res, struct{}{}, nil
1008-
1009-
}
1010-
1011837
// UpdateAudienceGroupDescription
1012838
//
1013839
// Renames an existing audience.

0 commit comments

Comments
 (0)