Skip to content

Commit

Permalink
Add /v2/bot/audienceGroup/shared path (#1160)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
github-actions[bot] and github-actions authored Feb 12, 2025
1 parent 434d884 commit d4ee02c
Show file tree
Hide file tree
Showing 10 changed files with 544 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/manage-audience/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ api.ts
api/apis.ts
api/manageAudienceBlobClient.ts
api/manageAudienceClient.ts
model/adaccount.ts
model/addAudienceToAudienceGroupRequest.ts
model/audience.ts
model/audienceGroup.ts
Expand All @@ -22,11 +23,14 @@ model/createClickBasedAudienceGroupRequest.ts
model/createClickBasedAudienceGroupResponse.ts
model/createImpBasedAudienceGroupRequest.ts
model/createImpBasedAudienceGroupResponse.ts
model/detailedOwner.ts
model/errorDetail.ts
model/errorResponse.ts
model/getAudienceDataResponse.ts
model/getAudienceGroupAuthorityLevelResponse.ts
model/getAudienceGroupsResponse.ts
model/getSharedAudienceDataResponse.ts
model/getSharedAudienceGroupsResponse.ts
model/models.ts
model/updateAudienceGroupAuthorityLevelRequest.ts
model/updateAudienceGroupDescriptionRequest.ts
Expand Down
101 changes: 101 additions & 0 deletions lib/manage-audience/api/manageAudienceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { ErrorResponse } from "../model/errorResponse.js";
import { GetAudienceDataResponse } from "../model/getAudienceDataResponse.js";
import { GetAudienceGroupAuthorityLevelResponse } from "../model/getAudienceGroupAuthorityLevelResponse.js";
import { GetAudienceGroupsResponse } from "../model/getAudienceGroupsResponse.js";
import { GetSharedAudienceDataResponse } from "../model/getSharedAudienceDataResponse.js";
import { GetSharedAudienceGroupsResponse } from "../model/getSharedAudienceGroupsResponse.js";
import { UpdateAudienceGroupAuthorityLevelRequest } from "../model/updateAudienceGroupAuthorityLevelRequest.js";
import { UpdateAudienceGroupDescriptionRequest } from "../model/updateAudienceGroupDescriptionRequest.js";

Expand Down Expand Up @@ -404,6 +406,105 @@ export class ManageAudienceClient {
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets audience data.
* @param audienceGroupId The audience ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-shared-audience"> Documentation</a>
*/
public async getSharedAudienceData(
audienceGroupId: number,
): Promise<GetSharedAudienceDataResponse> {
return (await this.getSharedAudienceDataWithHttpInfo(audienceGroupId)).body;
}

/**
* Gets audience data..
* This method includes HttpInfo object to return additional information.
* @param audienceGroupId The audience ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-shared-audience"> Documentation</a>
*/
public async getSharedAudienceDataWithHttpInfo(
audienceGroupId: number,
): Promise<Types.ApiResponseType<GetSharedAudienceDataResponse>> {
const res = await this.httpClient.get(
"/v2/bot/audienceGroup/shared/{audienceGroupId}".replace(
"{audienceGroupId}",
String(audienceGroupId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets data for more than one audience, including those shared by the Business Manager.
* @param page The page to return when getting (paginated) results. Must be 1 or higher.
* @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.
* @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.
* @param size The number of audiences per page. Default: 20 Max: 40
* @param 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.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list"> Documentation</a>
*/
public async getSharedAudienceGroups(
page: number,
description?: string,
status?: AudienceGroupStatus,
size?: number,
createRoute?: AudienceGroupCreateRoute,
): Promise<GetSharedAudienceGroupsResponse> {
return (
await this.getSharedAudienceGroupsWithHttpInfo(
page,
description,
status,
size,
createRoute,
)
).body;
}

/**
* Gets data for more than one audience, including those shared by the Business Manager..
* This method includes HttpInfo object to return additional information.
* @param page The page to return when getting (paginated) results. Must be 1 or higher.
* @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.
* @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.
* @param size The number of audiences per page. Default: 20 Max: 40
* @param 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.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list"> Documentation</a>
*/
public async getSharedAudienceGroupsWithHttpInfo(
page: number,
description?: string,
status?: AudienceGroupStatus,
size?: number,
createRoute?: AudienceGroupCreateRoute,
): Promise<Types.ApiResponseType<GetSharedAudienceGroupsResponse>> {
const queryParams = {
page: page,
description: description,
status: status,
size: size,
createRoute: createRoute,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});

const res = await this.httpClient.get(
"/v2/bot/audienceGroup/shared/list",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Change the authority level of the audience
* @param updateAudienceGroupAuthorityLevelRequest
Expand Down
21 changes: 21 additions & 0 deletions lib/manage-audience/model/adaccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* Adaccount
*/
export type Adaccount = {
/**
* Ad account name.
*/
name?: string /**/;
};
29 changes: 29 additions & 0 deletions lib/manage-audience/model/detailedOwner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* Owner of this audience group.
*/
export type DetailedOwner = {
/**
* Service name where the audience group has been created.
*/
serviceType?: string /**/;
/**
* Owner ID in the service.
*/
id?: string /**/;
/**
* Owner account name.
*/
name?: string /**/;
};
6 changes: 6 additions & 0 deletions lib/manage-audience/model/getAudienceDataResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Do not edit the class manually.
*/

import { Adaccount } from "./adaccount.js";
import { AudienceGroup } from "./audienceGroup.js";
import { AudienceGroupJob } from "./audienceGroupJob.js";

Expand All @@ -28,4 +29,9 @@ export type GetAudienceDataResponse = {
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-group">jobs Documentation</a>
*/
jobs?: Array<AudienceGroupJob> /**/;
/**
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-group">adaccount Documentation</a>
*/
adaccount?: Adaccount /**/;
};
37 changes: 37 additions & 0 deletions lib/manage-audience/model/getSharedAudienceDataResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { AudienceGroup } from "./audienceGroup.js";
import { AudienceGroupJob } from "./audienceGroupJob.js";
import { DetailedOwner } from "./detailedOwner.js";

/**
* Get audience data
*/
export type GetSharedAudienceDataResponse = {
/**
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-group">audienceGroup Documentation</a>
*/
audienceGroup?: AudienceGroup /**/;
/**
* 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
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-group">jobs Documentation</a>
*/
jobs?: Array<AudienceGroupJob> /**/;
/**
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-group">owner Documentation</a>
*/
owner?: DetailedOwner /**/;
};
55 changes: 55 additions & 0 deletions lib/manage-audience/model/getSharedAudienceGroupsResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { AudienceGroup } from "./audienceGroup.js";

/**
* Gets data for more than one audience.
*/
export type GetSharedAudienceGroupsResponse = {
/**
* An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">audienceGroups Documentation</a>
*/
audienceGroups?: Array<AudienceGroup> /**/;
/**
* true when this is not the last page.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">hasNextPage Documentation</a>
*/
hasNextPage?: boolean /**/;
/**
* The total number of audiences that can be returned with the specified filter.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">totalCount Documentation</a>
*/
totalCount?: number /**/;
/**
* Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">readWriteAudienceGroupTotalCount Documentation</a>
*/
readWriteAudienceGroupTotalCount?: number /**/;
/**
* The current page number.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">page Documentation</a>
*/
page?: number /**/;
/**
* The maximum number of audiences on the current page.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-audience-groups">size Documentation</a>
*/
size?: number /**/;
};
4 changes: 4 additions & 0 deletions lib/manage-audience/model/models.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./adaccount.js";
export * from "./addAudienceToAudienceGroupRequest.js";
export * from "./audience.js";
export * from "./audienceGroup.js";
Expand All @@ -17,10 +18,13 @@ export * from "./createClickBasedAudienceGroupRequest.js";
export * from "./createClickBasedAudienceGroupResponse.js";
export * from "./createImpBasedAudienceGroupRequest.js";
export * from "./createImpBasedAudienceGroupResponse.js";
export * from "./detailedOwner.js";
export * from "./errorDetail.js";
export * from "./errorResponse.js";
export * from "./getAudienceDataResponse.js";
export * from "./getAudienceGroupAuthorityLevelResponse.js";
export * from "./getAudienceGroupsResponse.js";
export * from "./getSharedAudienceDataResponse.js";
export * from "./getSharedAudienceGroupsResponse.js";
export * from "./updateAudienceGroupAuthorityLevelRequest.js";
export * from "./updateAudienceGroupDescriptionRequest.js";
Loading

0 comments on commit d4ee02c

Please sign in to comment.