diff --git a/lib/messaging-api/api/messagingApiClient.ts b/lib/messaging-api/api/messagingApiClient.ts index a6f2d4d5d..e750d908c 100644 --- a/lib/messaging-api/api/messagingApiClient.ts +++ b/lib/messaging-api/api/messagingApiClient.ts @@ -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 Documentation - */ - public async getAdPhoneMessageStatistics( - date: string, - ): Promise { - 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 Documentation - */ - public async getAdPhoneMessageStatisticsWithHttpInfo( - date: string, - ): Promise> { - 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. diff --git a/lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts b/lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts index 5d3721504..5e58ae280 100644 --- a/lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts +++ b/lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts @@ -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; diff --git a/line-openapi b/line-openapi index 5ae51b6a9..950521edd 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 5ae51b6a91aea5da364666cdc60d24919ad0b6ad +Subproject commit 950521edd0f5a4508277a3f7e73563bf040aac0f