Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 1497201

Browse files
committed
Fix failing snippets in /notifications and activate testing
1 parent 55b0f72 commit 1497201

File tree

135 files changed

+420
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+420
-499
lines changed

notifications/register/create-binding-server-apns/create-binding-server-apn.7.x.java

+25-29
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,31 @@
33
import java.util.List;
44

55
import com.twilio.Twilio;
6-
import com.twilio.rest.notify.service.Binding;
6+
import com.twilio.rest.notify.v1.service.Binding;
77

88
public class Example {
9-
// Find your Account Sid and Token at twilio.com/user/account
10-
public static final String ACCOUNT_SID = "ACCOUNT_SID";
11-
public static final String AUTH_TOKEN = "AUTH_TOKEN";
12-
13-
public static final String SERVICE_SID = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
14-
15-
public static void main(String[] args) {
16-
// Initialize the client
17-
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
18-
19-
List<String> tags = Arrays.asList("premium", "new user");
20-
21-
String endpoint = "endpoint_id";
22-
String identity = "00000001";
23-
String address = "apn_device_token";
24-
25-
Binding binding = Binding
26-
.creator(
27-
SERVICE_SID,
28-
endpoint,
29-
identity,
30-
Binding.BindingType.APN,
31-
address)
32-
.setTag(tags)
33-
.create();
34-
35-
System.out.println(binding.getSid());
36-
}
9+
// Find your Account Sid and Token at twilio.com/user/account
10+
public static final String ACCOUNT_SID = "ACCOUNT_SID";
11+
public static final String AUTH_TOKEN = "AUTH_TOKEN";
12+
13+
public static final String SERVICE_SID = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
14+
15+
public static void main(String[] args) {
16+
// Initialize the client
17+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
18+
19+
List<String> tags = Arrays.asList("premium", "new user");
20+
21+
String endpoint = "endpoint_id";
22+
String identity = "00000001";
23+
String address = "apn_device_token";
24+
25+
Binding binding = Binding
26+
.creator(SERVICE_SID, identity, Binding.BindingType.APN, address)
27+
.setEndpoint(endpoint)
28+
.setTag(tags)
29+
.create();
30+
31+
System.out.println(binding.getSid());
32+
}
3733
}

notifications/register/create-binding-server-apns/create-binding-server-apn.curl

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
curl -XPOST "https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings" \
2+
-d "Endpoint=endpoint_id" \
3+
-d "Identity=00000001" \
4+
-d "BindingType=apn" \
5+
-d "Address=apn_device_token" \
6+
-d "Tag=preferred device" \
7+
-d "Tag=new user" \
8+
-u "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/create-binding-server-fcm/create-binding-server-fcm.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
binding = service.bindings.create(
1313
identity: '00000001',

notifications/register/create-binding-server-fcm/create-binding-server-fcm.7.x.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.List;
44

55
import com.twilio.Twilio;
6-
import com.twilio.rest.notify.service.Binding;
6+
import com.twilio.rest.notify.v1.service.Binding;
77

88
public class Example {
99
// Find your Account Sid and Token at twilio.com/user/account
@@ -21,13 +21,10 @@ public static void main(String[] args) {
2121
String endpoint = "XXXXXXXXXXXXXXX";
2222
String identity = "00000001";
2323
String address = "fcm_device_token";
24+
2425
Binding binding = Binding
25-
.creator(
26-
SERVICE_SID,
27-
endpoint,
28-
identity,
29-
Binding.BindingType.FACEBOOK_MESSENGER,
30-
address)
26+
.creator(SERVICE_SID, identity, Binding.BindingType.FACEBOOK_MESSENGER, address)
27+
.setEndpoint(endpoint)
3128
.setTag(tags)
3229
.create();
3330

notifications/register/create-binding-server-fcm/create-binding-server-fcm.curl

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
curl -XPOST "https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings" \
2+
-d "Endpoint=XXXXXXXXXXXXXXX" \
3+
-d "Identity=00000001" \
4+
-d "BindingType=fcm" \
5+
-d "Address=fcm_device_token" \
6+
-d "Tag=preferred device" \
7+
-d "Tag=new user" \
8+
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/create-binding-server/create-binding-server-apn.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
binding = service.bindings.create(
1313
identity: '00000001',

notifications/register/create-binding-server/create-binding-server.6.x.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88

99

1010
client = Client(ACCOUNT_SID, AUTH_TOKEN)
11-
binding = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').bindings.create(
12-
endpoint='XXXXXXXXXXXXXXX',
13-
identity='00000001', # We recommend using a GUID or other anonymized identifier for Identity.
14-
binding_type='gcm',
15-
address='gcm_device_token',
16-
tag=['premium', 'new user']
17-
)
11+
binding = client.notify.v1.services(sid='ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
12+
.bindings.create(
13+
endpoint='XXXXXXXXXXXXXXX',
14+
identity='00000001', # We recommend using a GUID or other anonymized identifier for Identity.
15+
binding_type='gcm',
16+
address='gcm_device_token',
17+
tag=['premium', 'new user']
18+
)
1819
print(binding.sid)

notifications/register/create-binding-server/create-binding-server.7.x.java

+19-23
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,30 @@
33
import java.util.List;
44

55
import com.twilio.Twilio;
6-
import com.twilio.rest.notify.service.Binding;
6+
import com.twilio.rest.notify.v1.service.Binding;
77

88
public class Example {
9-
// Find your Account Sid and Token at twilio.com/user/account
10-
public static final String ACCOUNT_SID = "ACCOUNT_SID";
11-
public static final String AUTH_TOKEN = "AUTH_TOKEN";
9+
// Find your Account Sid and Token at twilio.com/user/account
10+
public static final String ACCOUNT_SID = "ACCOUNT_SID";
11+
public static final String AUTH_TOKEN = "AUTH_TOKEN";
1212

13-
public static final String SERVICE_SID = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
public static final String SERVICE_SID = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
1414

15-
public static void main(String[] args) {
16-
// Initialize the client
17-
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
15+
public static void main(String[] args) {
16+
// Initialize the client
17+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
1818

19-
List<String> tags = Arrays.asList("premium", "new user");
19+
List<String> tags = Arrays.asList("premium", "new user");
2020

21-
String endpoint = "xxx";
22-
String identity = "00000001";
23-
String address = "xxx";
24-
Binding binding = Binding
25-
.creator(
26-
SERVICE_SID,
27-
endpoint,
28-
identity,
29-
Binding.BindingType.GCM,
30-
address)
31-
.setTag(tags)
32-
.create();
21+
String endpoint = "xxx";
22+
String identity = "00000001";
23+
String address = "xxx";
24+
Binding binding = Binding
25+
.creator(SERVICE_SID, identity, Binding.BindingType.GCM, address)
26+
.setEndpoint(endpoint)
27+
.setTag(tags)
28+
.create();
3329

34-
System.out.println(binding.getSid());
35-
}
30+
System.out.println(binding.getSid());
31+
}
3632
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/send-notification-2/send-notification-2.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
notification = service.notifications.create(
1313
body: 'Hello Bob',

notifications/register/send-notification-2/send-notification-2.7.x.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// information on how to download and install this version, visit
33
// https://www.twilio.com/docs/libraries/java
44
import com.twilio.Twilio;
5-
import com.twilio.rest.notify.service.Notification;
5+
import com.twilio.rest.notify.v1.service.Notification;
66

77
public class Example {
88
// Find your Account Sid and Token at twilio.com/user/account

notifications/register/send-notification-2/send-notification-2.curl notifications/register/send-notification-2/send-notification-2.json.curl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
curl -X POST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
1+
curl -XPOST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
22
-d 'Identity=00000001' \
33
-d 'Tag=preferred_device' \
44
-d 'Body=Hello Bob' \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/send-notification-segment-tag/send-notification-1.js

-22
This file was deleted.

notifications/register/send-notification-segment-tag/send-notification-segment-tag.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
notification = service.notifications.create(
1313
body: 'Hello New Users',

notifications/register/send-notification-segment-tag/send-notification-segment-tag.7.x.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// information on how to download and install this version, visit
33
// https://www.twilio.com/docs/libraries/java
44
import com.twilio.Twilio;
5-
import com.twilio.rest.notify.service.Notification;
5+
import com.twilio.rest.notify.v1.service.Notification;
66

77
public class Example {
88
// Find your Account Sid and Token at twilio.com/user/account

notifications/register/send-notification-segment-tag/send-notification-segment-tag.curl notifications/register/send-notification-segment-tag/send-notification-segment-tag.json.curl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
curl -X POST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
1+
curl -XPOST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
22
-d 'Segment=new_user' \
33
-d 'Tag=preferred_device' \
44
-d 'Body=Hello New Users on your preferred device' \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/send-notification-segment/send-notification-segment.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
notification = service.notifications.create(
1313
body: 'Hello New Users',

notifications/register/send-notification-segment/send-notification-segment.7.x.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// information on how to download and install this version, visit
33
// https://www.twilio.com/docs/libraries/java
44
import com.twilio.Twilio;
5-
import com.twilio.rest.notify.service.Notification;
5+
import com.twilio.rest.notify.v1.service.Notification;
66

77
public class Example {
88
// Find your Account Sid and Token at twilio.com/user/account

notifications/register/send-notification-segment/send-notification-segment.js

-22
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
curl -X POST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
1+
curl -XPOST https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications \
22
-d 'Segment=new_user' \
33
-d 'Body=Hello New Users' \
44
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

notifications/register/send-notification/send-notification.5.x.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
client = Twilio::REST::Client.new(account_sid, auth_token)
99

10-
service = client.notify.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10+
service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1111

1212
notification = service.notifications.create(
1313
identity: '00000001',

notifications/register/send-notification/send-notification.7.x.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// information on how to download and install this version, visit
33
// https://www.twilio.com/docs/libraries/java
44
import com.twilio.Twilio;
5-
import com.twilio.rest.notify.service.Notification;
5+
import com.twilio.rest.notify.v1.service.Notification;
66

77
public class Example {
88
// Find your Account Sid and Token at twilio.com/user/account

notifications/register/send-notification/send-notification.js

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testable: true

0 commit comments

Comments
 (0)