Skip to content

Commit

Permalink
Retire GET /v2/bot/message/delivery/ad_phone (#1138)
Browse files Browse the repository at this point in the history
line/line-openapi#82

`GET /v2/bot/message/delivery/ad_phone` was sunset.
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 21, 2025
1 parent 68d36c7 commit 5cc9b27
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 146 deletions.
39 changes: 0 additions & 39 deletions lib/messaging-api/api/messagingApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,45 +292,6 @@ export class MessagingApiClient {
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get result of message delivery using phone number
* @param date Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#get-phone-audience-match"> Documentation</a>
*/
public async getAdPhoneMessageStatistics(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getAdPhoneMessageStatisticsWithHttpInfo(date)).body;
}

/**
* Get result of message delivery using phone number.
* This method includes HttpInfo object to return additional information.
* @param date Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#get-phone-audience-match"> Documentation</a>
*/
public async getAdPhoneMessageStatisticsWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});

const res = await this.httpClient.get(
"/v2/bot/message/delivery/ad_phone",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get name list of units used this month
* @param limit The maximum number of aggregation units you can get per request.
Expand Down
106 changes: 0 additions & 106 deletions lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,112 +606,6 @@ describe("MessagingApiClient", () => {
server.close();
});

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

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

equal(req.method, "GET");
const reqUrl = new URL(req.url, "http://localhost/");
equal(
reqUrl.pathname,
"/v2/bot/message/delivery/ad_phone".replace("{date}", "DUMMY"), // string
);

// Query parameters
const queryParams = new URLSearchParams(reqUrl.search);
equal(
queryParams.get("date"),
String(
// date: string
"DUMMY" as unknown as string, // paramName=date(enum)
),
);

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.getAdPhoneMessageStatisticsWithHttpInfo(
// date: string
"DUMMY" as unknown as string, // paramName=date(enum)
);

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

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

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

equal(req.method, "GET");
const reqUrl = new URL(req.url, "http://localhost/");
equal(
reqUrl.pathname,
"/v2/bot/message/delivery/ad_phone".replace("{date}", "DUMMY"), // string
);

// Query parameters
const queryParams = new URLSearchParams(reqUrl.search);
equal(
queryParams.get("date"),
String(
// date: string
"DUMMY" as unknown as string, // paramName=date(enum)
),
);

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.getAdPhoneMessageStatistics(
// date: string
"DUMMY" as unknown as string, // paramName=date(enum)
);

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

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

Expand Down
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+0 −37 messaging-api.yml

0 comments on commit 5cc9b27

Please sign in to comment.