Skip to content

Commit 20febc4

Browse files
committed
Add deployed-devices/rest/fleets snippets
1 parent a4429ff commit 20febc4

25 files changed

+433
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices;
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
var fleet = FleetResource.Create(
17+
friendlyName: "My Fleet of Devices"
18+
);
19+
20+
Console.WriteLine(fleet.Sid);
21+
}
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
// Get the Node helper library from https://twilio.com/docs/libraries/php
3+
require_once '/path/to/vendor/autoload.php'; // Loads the library
4+
5+
use Twilio\Rest\Client;
6+
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
$accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
9+
$authToken = 'your_auth_token';
10+
$client = new Client($accountSid, $authToken);
11+
12+
$fleet = $client->preview->deployedDevices->fleets->create(
13+
array(
14+
'friendlyName' => 'My Fleet of Devices'
15+
)
16+
);
17+
18+
echo $fleet->sid;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from https://twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
client = Twilio::REST::Client.new(account_sid, auth_token)
8+
9+
fleet = client.preview.deployed_devices.fleets.create(
10+
friendly_name: 'My Fleet of Devices',
11+
)
12+
13+
puts fleet.sid
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/python
2+
from pathlib import Path
3+
from twilio.rest import Client
4+
5+
# Get your Account SID and Auth Token from https://twilio.com/console
6+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
7+
auth_token = 'your_auth_token'
8+
client = Client(account_sid, auth_token)
9+
10+
fleet = client.preview.deployed_devices.fleets.create(
11+
friendly_name='My Fleet of Devices')
12+
13+
print(fleet.sid)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/java
2+
import com.twilio.Twilio;
3+
import com.twilio.rest.preview.deployedDevices.Fleet;
4+
import com.twilio.rest.preview.deployedDevices.FleetCreator;
5+
6+
public class Example {
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
9+
public static final String AUTH_TOKEN = "your_auth_token";
10+
11+
public static void main(String[] args) {
12+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
13+
14+
FleetCreator fleetCreator = new FleetCreator();
15+
Fleet fleet = fleetCreator
16+
.setFriendlyName("My Fleet of Devices")
17+
.create();
18+
19+
System.out.println(fleet.getSid());
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices;
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
17+
var deleted = FleetResource.Delete(fleetSid);
18+
19+
Console.WriteLine(deleted);
20+
}
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
// Get the Node helper library from https://twilio.com/docs/libraries/php
3+
require_once '/path/to/vendor/autoload.php'; // Loads the library
4+
5+
use Twilio\Rest\Client;
6+
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
$accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
9+
$authToken = 'your_auth_token';
10+
$client = new Client($accountSid, $authToken);
11+
12+
$fleetSid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
13+
$deleted = $client->preview->deployedDevices->fleets($fleetSid)->delete();
14+
15+
echo $deleted;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from https://twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
client = Twilio::REST::Client.new(account_sid, auth_token)
8+
9+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
10+
deleted = client.preview.deployed_devices
11+
.fleets(fleet_sid)
12+
.delete()
13+
14+
puts deleted
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/python
2+
from pathlib import Path
3+
from twilio.rest import Client
4+
5+
# Get your Account SID and Auth Token from https://twilio.com/console
6+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
7+
auth_token = 'your_auth_token'
8+
client = Client(account_sid, auth_token)
9+
10+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
11+
deleted = client.preview.deployed_devices.fleets(sid=fleet_sid).delete()
12+
13+
print(deleted)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/java
2+
import com.twilio.Twilio;
3+
import com.twilio.rest.preview.deployedDevices.FleetDeleter;
4+
5+
public class Example {
6+
// Get your Account SID and Auth Token from https://twilio.com/console
7+
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
8+
public static final String AUTH_TOKEN = "your_auth_token";
9+
10+
public static void main(String[] args) {
11+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
12+
13+
String fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
14+
15+
boolean deleted = new FleetDeleter(fleetSid).delete();
16+
17+
System.out.println(deleted);
18+
}
19+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices;
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
var fleets = FleetResource.Read();
17+
18+
foreach (var fleet in fleets)
19+
{
20+
Console.WriteLine(fleet.Sid);
21+
}
22+
}
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
// Get the Node helper library from https://twilio.com/docs/libraries/php
3+
require_once '/path/to/vendor/autoload.php'; // Loads the library
4+
5+
use Twilio\Rest\Client;
6+
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
$accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
9+
$authToken = 'your_auth_token';
10+
$client = new Client($accountSid, $authToken);
11+
12+
$fleets = $client->preview->deployedDevices->fleets->read();
13+
14+
foreach ($fleet as $fleets) {
15+
echo $fleet->sid;
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from https://twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
client = Twilio::REST::Client.new(account_sid, auth_token)
8+
9+
fleets = client.preview.deployed_devices.fleets.list()
10+
11+
fleets.each do |fleet|
12+
puts fleet.sid
13+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/python
2+
from pathlib import Path
3+
from twilio.rest import Client
4+
5+
# Get your Account SID and Auth Token from https://twilio.com/console
6+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
7+
auth_token = 'your_auth_token'
8+
client = Client(account_sid, auth_token)
9+
10+
fleets = client.preview.deployed_devices.fleets.list()
11+
12+
for fleet in fleets:
13+
print(fleet.sid)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/java
2+
import com.twilio.Twilio;
3+
import com.twilio.base.ResourceSet;
4+
import com.twilio.rest.preview.deployedDevices.Fleet;
5+
import com.twilio.rest.preview.deployedDevices.FleetReader;
6+
7+
public class Example {
8+
// Get your Account SID and Auth Token from https://twilio.com/console
9+
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
10+
public static final String AUTH_TOKEN = "your_auth_token";
11+
12+
public static void main(String[] args) {
13+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
14+
15+
String fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
16+
String deviceSid = "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
17+
18+
ResourceSet<Fleet> fleets = new FleetReader().read();
19+
20+
for(Fleet fleet: fleets) {
21+
System.out.println(fleet.getSid());
22+
}
23+
}
24+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices;
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
17+
var fleet = FleetResource.Fetch(fleetSid);
18+
19+
Console.WriteLine(fleet.Sid);
20+
}
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
// Get the Node helper library from https://twilio.com/docs/libraries/php
3+
require_once '/path/to/vendor/autoload.php'; // Loads the library
4+
5+
use Twilio\Rest\Client;
6+
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
$accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
9+
$authToken = 'your_auth_token';
10+
$client = new Client($accountSid, $authToken);
11+
12+
$fleetSid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
13+
$fleet = $client->preview->deployedDevices->fleets($fleetSid)->fetch();
14+
15+
echo $fleet->friendlyName;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from https://twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
client = Twilio::REST::Client.new(account_sid, auth_token)
8+
9+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
10+
fleet = client.preview.deployed_devices
11+
.fleets(fleet_sid)
12+
.fetch()
13+
14+
puts fleet.friendly_name
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/python
2+
from pathlib import Path
3+
from twilio.rest import Client
4+
5+
# Get your Account SID and Auth Token from https://twilio.com/console
6+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
7+
auth_token = 'your_auth_token'
8+
client = Client(account_sid, auth_token)
9+
10+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
11+
fleet = client.preview.deployed_devices.fleets(sid=fleet_sid).fetch()
12+
13+
print(fleet.friendly_name)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/java
2+
import com.twilio.Twilio;
3+
import com.twilio.rest.preview.deployedDevices.Fleet;
4+
import com.twilio.rest.preview.deployedDevices.FleetFetcher;
5+
6+
public class Example {
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
9+
public static final String AUTH_TOKEN = "your_auth_token";
10+
11+
public static void main(String[] args) {
12+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
13+
14+
String fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
15+
16+
Fleet fleet = new FleetFetcher(fleetSid).fetch();
17+
18+
System.out.println(fleet.getFriendlyName());
19+
}
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices;
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
17+
var fleet = FleetResource.Update(
18+
fleetSid,
19+
friendlyName: "My New Fleet of Devices");
20+
21+
Console.WriteLine(fleet.FriendlyName);
22+
}
23+
}

0 commit comments

Comments
 (0)