Permalink
Browse files

updated all the individual examples to use pagination;

  • Loading branch information...
1 parent 6075070 commit 86113b7b93146433b1dcae7e9d4d502874bc0737 @caseysoftware committed Mar 30, 2013
@@ -8,8 +8,20 @@
$accounts = $client->accounts->index();
// Now our $accounts object has a count of accounts and iterable set of accounts
-echo "\nDisplaying {$accounts->count} records:\n";
+echo "\nDisplaying {$accounts->count} records per page:\n";
+echo "\nPage: " . $accounts->page . ' of ' . $accounts->getPageCount() . "\n";
+
foreach($accounts as $account) {
echo $account->username . "\n";
echo $account->type . "\n";
+}
+
+while ($accounts->hasMorePages()) {
+ $itempage = $accounts->getNextPage();
+
+ echo "\nPage: " . $accounts->page . ' of ' . $accounts->getPageCount() . "\n";
+ foreach($itempage as $account) {
+ echo $account->username . "\n";
+ echo $account->type . "\n";
+ }
}
View
@@ -8,7 +8,18 @@
$buckets = $client->buckets->index();
// Now our $buckets object has a count of buckets and iterable set of buckets
-echo "\nDisplaying {$buckets->count} records:\n";
+echo "\nDisplaying {$buckets->count} records per page:\n";
+echo "\nPage: " . $buckets->page . ' of ' . $buckets->getPageCount() . "\n";
+
foreach($buckets as $bucket) {
echo $bucket->name . "\n";
+}
+
+while ($buckets->hasMorePages()) {
+ $itempage = $buckets->getNextPage();
+
+ echo "\nPage: " . $buckets->page . ' of ' . $buckets->getPageCount() . "\n";
+ foreach($itempage as $bucket) {
+ echo $bucket->name . "\n";
+ }
}
@@ -5,11 +5,23 @@
$client = new Services_Contactually(array('apikey' => $apiKey));
-$contact_histories = $client->contact_histories->index();
+$contact_histories = $client->contact_histories->index($page = 1, $limit = 10);
// Now our $accounts object has a count of accounts and iterable set of accounts
-echo "\nDisplaying {$contact_histories->count} records:\n";
+echo "\nDisplaying {$contact_histories->count} records per page:\n";
+echo "\nPage: " . $contact_histories->page . ' of ' . $contact_histories->getPageCount() . "\n";
+
foreach($contact_histories as $contact_history) {
echo $contact_history->email . "\n";
echo $contact_history->subject . "\n";
+}
+
+while ($contact_histories->hasMorePages()) {
+ $itempage = $contact_histories->getNextPage();
+
+ echo "\n\nPage: " . $contact_histories->page . ' of ' . $contact_histories->getPageCount() . "\n";
+ foreach($itempage as $contact_history) {
+ echo $contact_history->email . "\n";
+ echo $contact_history->subject . "\n";
+ }
}
@@ -5,10 +5,21 @@
$client = new Services_Contactually(array('apikey' => $apiKey));
-$contacts = $client->contacts->index();
+$contacts = $client->contacts->index($page = 1, $limit = 10);
// Now our $contacts object has a count of contacts and iterable set of contacts
-echo "\nDisplaying {$contacts->count} records:\n";
+echo "\nDisplaying {$contacts->count} records per page:\n";
+echo "\nPage: " . $contacts->page . ' of ' . $contacts->getPageCount() . "\n";
+
foreach($contacts as $contact) {
echo $contact->first_name . " " . $contact->last_name . "\n";
+}
+
+while ($contacts->hasMorePages()) {
+ $itempage = $contacts->getNextPage();
+
+ echo "\nPage: " . $contacts->page . ' of ' . $contacts->getPageCount() . "\n";
+ foreach($itempage as $contact) {
+ echo $contact->first_name . " " . $contact->last_name . "\n";
+ }
}
@@ -5,10 +5,21 @@
$client = new Services_Contactually(array('apikey' => $apiKey));
-$followups = $client->followups->index();
+$followups = $client->followups->index($page = 1, $limit = 10);
// Now our $followups object has a count of followups and iterable set of followups
-echo "\nDisplaying {$followups->count} records:\n";
+echo "\nDisplaying {$followups->count} records per page:\n";
+echo "\nPage: " . $followups->page . ' of ' . $followups->getPageCount() . "\n";
+
foreach($followups as $followup) {
echo $followup->title . " " . $followup->due_date . "\n";
+}
+
+while ($followups->hasMorePages()) {
+ $itempage = $followups->getNextPage();
+
+ echo "\nPage: " . $followups->page . ' of ' . $followups->getPageCount() . "\n";
+ foreach($itempage as $followup) {
+ echo $followup->title . " " . $followup->due_date . "\n";
+ }
}
View
@@ -5,10 +5,21 @@
$client = new Services_Contactually(array('apikey' => $apiKey));
-$notes = $client->notes->index();
+$notes = $client->notes->index($page = 1, $limit = 10);
// Now our $notes object has a count of notes and iterable set of notes
-echo "\nDisplaying {$notes->count} records:\n";
+echo "\nDisplaying {$notes->count} records per page:\n";
+echo "\nPage: " . $notes->page . ' of ' . $notes->getPageCount() . "\n";
+
foreach($notes as $note) {
echo $note->body . "\n";
+}
+
+while ($notes->hasMorePages()) {
+ $itempage = $notes->getNextPage();
+
+ echo "\nPage: " . $notes->page . ' of ' . $notes->getPageCount() . "\n";
+ foreach($itempage as $note) {
+ echo $note->body . "\n";
+ }
}
View
@@ -5,11 +5,23 @@
$client = new Services_Contactually(array('apikey' => $apiKey));
-$tasks = $client->tasks->index();
+$tasks = $client->tasks->index($page = 1, $limit = 10);
// Now our $notes object has a count of notes and iterable set of notes
-echo "\nDisplaying {$tasks->count} records:\n";
+echo "\nDisplaying {$tasks->count} records per page:\n";
+echo "\nPage: " . $tasks->page . ' of ' . $tasks->getPageCount() . "\n";
+
foreach($tasks as $task) {
echo $task->title . "\n";
echo $task->due_date . "\n";
+}
+
+while ($tasks->hasMorePages()) {
+ $itempage = $tasks->getNextPage();
+
+ echo "\nPage: " . $tasks->page . ' of ' . $tasks->getPageCount() . "\n";
+ foreach($itempage as $task) {
+ echo $task->title . "\n";
+ echo $task->due_date . "\n";
+ }
}

0 comments on commit 86113b7

Please sign in to comment.