-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 'page_size' returned by SMS API cannot be used to compute total …
…pages count to detect end of list/pagination. Use dedicated 'SMSCursorPageNavigator' to compute end of list by checking result size against empty list
- Loading branch information
Showing
26 changed files
with
212 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
client/src/main/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.sinch.sdk.domains.sms.models; | ||
|
||
import com.sinch.sdk.core.models.pagination.PageNavigator; | ||
|
||
public class SMSCursorPageNavigator extends PageNavigator<Integer> { | ||
|
||
private final Integer currentPage; | ||
private final Integer pageSize; | ||
|
||
public SMSCursorPageNavigator(Integer currentPage, Integer pageSize) { | ||
super(null); | ||
this.currentPage = currentPage; | ||
this.pageSize = pageSize; | ||
} | ||
|
||
private Integer computeNextPageCursor() { | ||
return null == pageSize || pageSize == 0 ? null : currentPage + 1; | ||
} | ||
|
||
@Override | ||
public Integer getToken() { | ||
return computeNextPageCursor(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SMSCursorPageNavigator{" | ||
+ "currentPage=" | ||
+ currentPage | ||
+ ", pageSize=" | ||
+ pageSize | ||
+ "} " | ||
+ super.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.