Vonage Client SDKでのページネーション
Product deprecation notice
Effective April 30th, 2026, Vonage In-App Messaging will no longer be available. Access for new users will be closed, and the service will be discontinued for all existing users.
If you have any questions regarding this product’s discontinuation, please contact your account manager or our support team.
Vonage Client SDKでオブジェクトのリストを取得する場合、レスポンスはページ分割されます。これは、すべてのオブジェクトを一度に返すのではなく、レスポンスのレイテンシとサイズを増加させる、レスポンスのチャンクまたは ページ.例えば getConversations を返します。 ConversationsPage.
ページを返す関数には、ページサイズとカーソルのパラメータがある。カーソルを与えることで、すべての結果を得るまでページをたどることができます。以下は会話を取得する例です。
val params = GetConversationsParameters(order = PresentingOrder.ASC, pageSize = 5, cursor = null)
client.getConversations(params) { error, conversationsPage ->
error?.let { /* Handle Error in fetching Conversations */ }
conversationsPage?.let {
val nextCursor = it.nextCursor
val previousCursor = it.previousCursor
it.conversations.forEach {conversation ->
println("Conversation id: ${conversation.id}, name: ${conversation.name}")
}
}
}
について ConversationsPage がある。 nextCursor そして previousCursor パラメータが必要です。Conversationsの次のページを取得するには、以下を呼び出す。 getConversations の値を提供する。 ConversationsPage.nextCursor カーソルのために:
結果の最後に到達したら nextCursor はnil/nullになる。逆に、結果の先頭に達すると previousCursor はnil/nullとなる。