Skip to content

Commit

Permalink
Remove obsolete feature: Audience Match (#1130)
Browse files Browse the repository at this point in the history
line/line-openapi#80

The Audience Match feature (/bot/ad/multicast/phone) was sunset in
October 2023. This change removes it as it's no longer necessary to
include it in line-openapi.

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
github-actions[bot] and github-actions authored Jan 20, 2025
1 parent 7588c03 commit 0ac4d2f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 148 deletions.
1 change: 0 additions & 1 deletion lib/messaging-api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ model/appTypeDemographic.ts
model/appTypeDemographicFilter.ts
model/areaDemographic.ts
model/areaDemographicFilter.ts
model/audienceMatchMessagesRequest.ts
model/audienceRecipient.ts
model/audioMessage.ts
model/botInfoResponse.ts
Expand Down
31 changes: 0 additions & 31 deletions lib/messaging-api/api/messagingApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/

/* tslint:disable:no-unused-locals */
import { AudienceMatchMessagesRequest } from "../model/audienceMatchMessagesRequest.js";
import { BotInfoResponse } from "../model/botInfoResponse.js";
import { BroadcastRequest } from "../model/broadcastRequest.js";
import { CreateRichMenuAliasRequest } from "../model/createRichMenuAliasRequest.js";
Expand Down Expand Up @@ -103,36 +102,6 @@ export class MessagingApiClient {
return resBody;
}

/**
* Send a message using phone number
* @param audienceMatchMessagesRequest
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#phone-audience-match"> Documentation</a>
*/
public async audienceMatch(
audienceMatchMessagesRequest: AudienceMatchMessagesRequest,
): Promise<Types.MessageAPIResponseBase> {
return (await this.audienceMatchWithHttpInfo(audienceMatchMessagesRequest))
.body;
}

/**
* Send a message using phone number.
* This method includes HttpInfo object to return additional information.
* @param audienceMatchMessagesRequest
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#phone-audience-match"> Documentation</a>
*/
public async audienceMatchWithHttpInfo(
audienceMatchMessagesRequest: AudienceMatchMessagesRequest,
): Promise<Types.ApiResponseType<Types.MessageAPIResponseBase>> {
const params = audienceMatchMessagesRequest;

const res = await this.httpClient.post("/bot/ad/multicast/phone", params);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Sends a message to multiple users at any time.
* @param broadcastRequest
Expand Down
34 changes: 0 additions & 34 deletions lib/messaging-api/model/audienceMatchMessagesRequest.ts

This file was deleted.

1 change: 0 additions & 1 deletion lib/messaging-api/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from "./appTypeDemographic.js";
export * from "./appTypeDemographicFilter.js";
export * from "./areaDemographic.js";
export * from "./areaDemographicFilter.js";
export * from "./audienceMatchMessagesRequest.js";
export * from "./audienceRecipient.js";
export * from "./audioMessage.js";
export * from "./botInfoResponse.js";
Expand Down
81 changes: 0 additions & 81 deletions lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MessagingApiClient } from "../../api.js";

import { AudienceMatchMessagesRequest } from "../../model/audienceMatchMessagesRequest.js";
import { BotInfoResponse } from "../../model/botInfoResponse.js";
import { BroadcastRequest } from "../../model/broadcastRequest.js";
import { CreateRichMenuAliasRequest } from "../../model/createRichMenuAliasRequest.js";
Expand Down Expand Up @@ -103,86 +102,6 @@ function parseForm(arrayBuffer: ArrayBuffer): Record<string, string | Blob> {
}

describe("MessagingApiClient", () => {
it("audienceMatchWithHttpInfo", async () => {
let requestCount = 0;

const server = createServer((req, res) => {
requestCount++;

equal(req.method, "POST");
const reqUrl = new URL(req.url, "http://localhost/");
equal(reqUrl.pathname, "/bot/ad/multicast/phone");

equal(req.headers["authorization"], `Bearer ${channel_access_token}`);
equal(req.headers["user-agent"], "@line/bot-sdk/1.0.0-test");

res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({}));
});
await new Promise(resolve => {
server.listen(0);
server.on("listening", resolve);
});

const serverAddress = server.address();
if (typeof serverAddress === "string" || serverAddress === null) {
throw new Error("Unexpected server address: " + serverAddress);
}

const client = new MessagingApiClient({
channelAccessToken: channel_access_token,
baseURL: `http://localhost:${String(serverAddress.port)}/`,
});

const res = await client.audienceMatchWithHttpInfo(
// audienceMatchMessagesRequest: AudienceMatchMessagesRequest
{} as unknown as AudienceMatchMessagesRequest, // paramName=audienceMatchMessagesRequest
);

equal(requestCount, 1);
server.close();
});

it("audienceMatch", async () => {
let requestCount = 0;

const server = createServer((req, res) => {
requestCount++;

equal(req.method, "POST");
const reqUrl = new URL(req.url, "http://localhost/");
equal(reqUrl.pathname, "/bot/ad/multicast/phone");

equal(req.headers["authorization"], `Bearer ${channel_access_token}`);
equal(req.headers["user-agent"], "@line/bot-sdk/1.0.0-test");

res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({}));
});
await new Promise(resolve => {
server.listen(0);
server.on("listening", resolve);
});

const serverAddress = server.address();
if (typeof serverAddress === "string" || serverAddress === null) {
throw new Error("Unexpected server address: " + serverAddress);
}

const client = new MessagingApiClient({
channelAccessToken: channel_access_token,
baseURL: `http://localhost:${String(serverAddress.port)}/`,
});

const res = await client.audienceMatch(
// audienceMatchMessagesRequest: AudienceMatchMessagesRequest
{} as unknown as AudienceMatchMessagesRequest, // paramName=audienceMatchMessagesRequest
);

equal(requestCount, 1);
server.close();
});

it("broadcastWithHttpInfo", async () => {
let requestCount = 0;

Expand Down

0 comments on commit 0ac4d2f

Please sign in to comment.