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

Lines changed: 25 additions & 29 deletions
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

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
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"
Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 7 deletions
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

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
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'
Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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',

0 commit comments

Comments
 (0)