Skip to content

Commit 5cedfc1

Browse files
authored
limit.upToRemainingQuota property has been added to narrowcast messag… (#590)
Closes #572
1 parent 44bf94e commit 5cedfc1

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

line-bot-api-client/src/test/java/com/linecorp/bot/client/LineMessagingClientImplTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import java.io.IOException;
3131
import java.net.URI;
32+
import java.util.Collections;
3233

3334
import org.junit.Rule;
3435
import org.junit.Test;
@@ -48,6 +49,7 @@
4849
import com.linecorp.bot.model.group.GroupSummaryResponse;
4950
import com.linecorp.bot.model.message.TextMessage;
5051
import com.linecorp.bot.model.narrowcast.Filter;
52+
import com.linecorp.bot.model.narrowcast.Limit;
5153
import com.linecorp.bot.model.narrowcast.filter.GenderDemographicFilter;
5254
import com.linecorp.bot.model.narrowcast.filter.GenderDemographicFilter.Gender;
5355
import com.linecorp.bot.model.profile.MembersIdsResponse;
@@ -171,6 +173,30 @@ public void narrowcast() {
171173
assertThat(botApiResponse).isEqualTo(BOT_API_SUCCESS_RESPONSE);
172174
}
173175

176+
@Test
177+
public void narrowcast2() {
178+
whenCall(retrofitMock.narrowcast(isNull(), any(Narrowcast.class)),
179+
BOT_API_SUCCESS_RESPONSE_BODY);
180+
final Narrowcast narrowcast = new Narrowcast(
181+
Collections.singletonList(new TextMessage("text")),
182+
null,
183+
Filter.builder()
184+
.demographic(
185+
GenderDemographicFilter.builder()
186+
.oneOf(singletonList(Gender.FEMALE))
187+
.build()
188+
).build(),
189+
Limit.builder()
190+
.upToRemainingQuota(true)
191+
.build(),
192+
false
193+
);
194+
195+
final BotApiResponse botApiResponse = target.narrowcast(narrowcast).join();
196+
verify(retrofitMock).narrowcast(null, narrowcast);
197+
assertThat(botApiResponse).isEqualTo(BOT_API_SUCCESS_RESPONSE);
198+
}
199+
174200
@Test
175201
public void getNarrowcastProgress() {
176202
whenCall(retrofitMock.getNarrowcastProgress(any()),

line-bot-model/src/main/java/com/linecorp/bot/model/narrowcast/Limit.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ public class Limit {
3535
*/
3636
Integer max;
3737

38+
/**
39+
* If true, the message will be sent within the maximum number of deliverable messages. The default value is
40+
* false.<br>
41+
* Targets will be selected at random.
42+
*/
43+
Boolean upToRemainingQuota;
44+
3845
@JsonPOJOBuilder(withPrefix = "")
3946
public static class LimitBuilder {
4047
// Filled by lombok

0 commit comments

Comments
 (0)