Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire GET /v2/bot/message/delivery/ad_phone #101

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
70 changes: 0 additions & 70 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 Expand Up @@ -323,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
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
187 changes: 0 additions & 187 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 Expand Up @@ -687,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 −80 messaging-api.yml