Skip to content

Commit 62b7501

Browse files
committed
Merge remote-tracking branch 'origin/allow-non-paging' into alpha
2 parents 9eeb7db + b9fb9ed commit 62b7501

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![Travis branch](https://img.shields.io/travis/twilio/twilio-php/master.svg)](https://travis-ci.org/twilio/twilio-php/branches)
2+
[![NuGet](https://img.shields.io/nuget/v/Twilio.svg)](https://www.nuget.org/packages/Twilio)
3+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Twilio.svg?label=nuget (alpha))](https://www.nuget.org/packages/Twilio)
4+
15
# Twilio REST API and TwiML Libraries for .NET
26

37
Twilio provides a simple HTTP-based API for sending and receiving phone calls and text messages. Learn more at [http://www.twilio.com][0]

src/Twilio/Base/Page.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,19 @@ record => JsonConvert.DeserializeObject<T>(record.ToString())
142142
var uriNode = root["uri"];
143143
if (uriNode != null)
144144
{
145+
JToken pageSize;
146+
JToken firstPageUri;
147+
JToken nextPageUri;
148+
JToken previousPageUri;
149+
145150
// v2010 API
146151
return new Page<T>(
147152
parsedRecords,
148-
root["page_size"].Value<int>(),
153+
root.TryGetValue("page_size", out pageSize) ? root["page_size"].Value<int>() : parsedRecords.Count,
149154
uri: uriNode.Value<string>(),
150-
firstPageUri: root["first_page_uri"].Value<string>(),
151-
nextPageUri: root["next_page_uri"].Value<string>(),
152-
previousPageUri: root["previous_page_uri"].Value<string>()
155+
firstPageUri: root.TryGetValue("first_page_uri", out firstPageUri) ? root["first_page_uri"].Value<string>() : null,
156+
nextPageUri: root.TryGetValue("next_page_uri", out nextPageUri) ? root["next_page_uri"].Value<string>() : null,
157+
previousPageUri: root.TryGetValue("previous_page_uri", out previousPageUri) ? root["previous_page_uri"].Value<string>() : null
153158
);
154159
}
155160

0 commit comments

Comments
 (0)