Skip to content

Commit 61ea67e

Browse files
authored
Merge pull request TwilioDevEd#354 from skuusk/sync-no-serialization
Sync: remove Json serialization
2 parents 3eaafd3 + a7b37b8 commit 61ea67e

12 files changed

+18
-35
lines changed

sync/rest/documents/create-document/create-document.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service;
65

@@ -26,7 +25,7 @@ public static void Main(string[] args)
2625

2726
var doc = DocumentResource.Create(serviceSid,
2827
"MyFirstDocument",
29-
JsonConvert.SerializeObject(data));
28+
data);
3029

3130
Console.WriteLine(doc.Sid);
3231
}

sync/rest/documents/create-document/create-document.6.x.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43
from datetime import datetime
54

65
# Your Account Sid and Auth Token from twilio.com/user/account
76
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
87
auth_token = "your_auth_token"
98
client = Client(account_sid, auth_token)
109

11-
data = json.dumps({
10+
data = {
1211
'date_updated': str(datetime.now()),
1312
'movie_title': "On The Line",
1413
'show_times': ["12:30:00Z", "14:45:00Z", "15:30:00Z", "17:45:00Z"],
1514
'starring': ["Lance Bass", "Joey Fatone"],
16-
'genre': "Romance"
17-
})
15+
'genre': "Romance"}
1816

1917
document = client.sync \
2018
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

sync/rest/documents/update-document/update-document.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service;
65

@@ -26,7 +25,7 @@ public static void Main(string[] args)
2625

2726
var doc = DocumentResource.Update(serviceSid,
2827
"MyFirstDocument",
29-
JsonConvert.SerializeObject(data));
28+
data);
3029

3130
Console.WriteLine(doc.Data);
3231
}

sync/rest/documents/update-document/update-document.6.x.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43
from datetime import datetime
54

65
# Your Account Sid and Auth Token from twilio.com/user/account
76
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
87
auth_token = "your_auth_token"
98
client = Client(account_sid, auth_token)
109

11-
new_data = json.dumps({
10+
new_data = {
1211
'date_updated': str(datetime.now()),
1312
'movie_title': "On The Line",
1413
'show_times': None,
1514
'starring': ["Lance Bass", "Joey Fatone"],
16-
'genre': "Romance"
17-
})
15+
'genre': "Romance"}
1816

1917
document = client.sync \
2018
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

sync/rest/lists/create-list-item/create-list-item.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service.SyncList;
65

@@ -24,7 +23,7 @@ public static void Main(string[] args)
2423

2524
var item = SyncListItemResource.Create(serviceSid,
2625
"MyCollection",
27-
JsonConvert.SerializeObject(data));
26+
data);
2827

2928
Console.WriteLine(item.Index);
3029
}

sync/rest/lists/create-list-item/create-list-item.6.x.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43

54
# Your Account Sid and Auth Token from twilio.com/user/account
65
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
76
auth_token = "your_auth_token"
87
client = Client(account_sid, auth_token)
98

10-
data = json.dumps({
9+
data = {
1110
'number': "001",
1211
'name': "Bulbasaur",
1312
'attack': 49
14-
})
13+
}
1514

1615
list_item = client.sync \
1716
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

sync/rest/lists/update-list-item/update-list-item.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service.SyncList;
65

@@ -26,7 +25,7 @@ public static void Main(string[] args)
2625
serviceSid,
2726
"MyCollection",
2827
0,
29-
JsonConvert.SerializeObject(data));
28+
data);
3029

3130
Console.WriteLine(item.Data);
3231
}

sync/rest/lists/update-list-item/update-list-item.6.x.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43

54
# Your Account Sid and Auth Token from twilio.com/user/account
65
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
76
auth_token = "your_auth_token"
87
client = Client(account_sid, auth_token)
98

10-
data = json.dumps({
9+
data = {
1110
'number': "001",
1211
'name': "Bulbasaur",
13-
'attack': 50
14-
})
12+
'attack': 50}
1513

1614
list_item = client.sync \
1715
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

sync/rest/maps/create-map-item/create-map-item.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service.SyncMap;
65

@@ -26,7 +25,7 @@ public static void Main(string[] args)
2625
serviceSid,
2726
"Players",
2827
"steph_curry",
29-
JsonConvert.SerializeObject(data));
28+
data);
3029

3130
Console.WriteLine(item.Data);
3231
}

sync/rest/maps/create-map-item/create-map-item.6.x.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43

54
# Your Account Sid and Auth Token from twilio.com/user/account
65
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
76
auth_token = "your_auth_token"
87
client = Client(account_sid, auth_token)
98

10-
data = json.dumps({
9+
data = {
1110
'name': "Stephen Curry",
1211
'level': 30,
13-
'username': "spicy_curry"
14-
})
12+
'username': "spicy_curry"}
1513

1614
map_item = client.sync \
1715
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

sync/rest/maps/update-map-item/update-map-item.5.x.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
22
using System;
3-
using Newtonsoft.Json;
43
using Twilio;
54
using Twilio.Rest.Sync.V1.Service.SyncMap;
65

@@ -26,7 +25,7 @@ public static void Main(string[] args)
2625
serviceSid,
2726
"Players",
2827
"steph_curry",
29-
JsonConvert.SerializeObject(data));
28+
data);
3029

3130
Console.WriteLine(item.Data);
3231
}

sync/rest/maps/update-map-item/update-map-item.6.x.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Download the Python helper library from twilio.com/docs/python/install
22
from twilio.rest import Client
3-
import json
43

54
# Your Account Sid and Auth Token from twilio.com/user/account
65
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
76
auth_token = "your_auth_token"
87
client = Client(account_sid, auth_token)
98

10-
data = json.dumps({
9+
data = {
1110
'name': "Stephen Curry",
1211
'level': 31,
13-
'username': "spicy_curry"
14-
})
12+
'username': "spicy_curry"}
1513

1614
map_item = client.sync \
1715
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \

0 commit comments

Comments
 (0)