This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #466 from TwilioDevEd/add-create-address-code-snip…
…pets Implement create address code snippets
- Loading branch information
Showing
7 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
rest/addresses/instance-create-example/instance-create-example.3.x.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Download the Node helper library from twilio.com/docs/node/install | ||
// These identifiers are your accountSid and authToken from | ||
// https://www.twilio.com/console | ||
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | ||
const authToken = 'your_auth_token'; | ||
const client = require('twilio')(accountSid, authToken); | ||
|
||
client.addresses | ||
.create({ | ||
customerName: 'FriendlyName', | ||
street: 'Elm Street', | ||
city: 'Racoon', | ||
region: 'Mordor', | ||
postalCode: '150', | ||
isoCountry: 'AX', | ||
}) | ||
.then(address => console.log(address.customerName)); |
26 changes: 26 additions & 0 deletions
26
rest/addresses/instance-create-example/instance-create-example.5.x.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp | ||
using System; | ||
using Twilio; | ||
using Twilio.Rest.Api.V2010.Account; | ||
|
||
class Example | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// Find your Account Sid and Auth Token at twilio.com/console | ||
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
const string authToken = "your_auth_token"; | ||
TwilioClient.Init(accountSid, authToken); | ||
|
||
var address = AddressResource.Create( | ||
customerName: "FriendlyName", | ||
street: "Elm Street", | ||
city: "Racoon", | ||
region: "Mordor", | ||
postalCode: "150", | ||
isoCountry: "AX" | ||
); | ||
|
||
Console.WriteLine(address.CustomerName); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
rest/addresses/instance-create-example/instance-create-example.5.x.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
// Get the PHP helper library from twilio.com/docs/php/install | ||
require_once '/path/to/vendor/autoload.php'; // Loads the library | ||
use Twilio\Rest\Client; | ||
|
||
// Your Account Sid and Auth Token from twilio.com/user/account | ||
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
$token = "your_auth_token"; | ||
$client = new Client($sid, $token); | ||
|
||
// Get an object from its sid. If you do not have a sid, | ||
// check out the list resource examples on this page | ||
$address = $client | ||
->addresses | ||
->create( | ||
'FriendlyName', | ||
'Elm Street', | ||
'Racoon', | ||
'Mordor', | ||
'150', | ||
'AX' | ||
); | ||
|
||
echo $address->customerName; |
21 changes: 21 additions & 0 deletions
21
rest/addresses/instance-create-example/instance-create-example.5.x.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Get twilio-ruby from twilio.com/docs/ruby/install | ||
require 'twilio-ruby' | ||
|
||
# Get your Account SID and Auth Token from twilio.com/console | ||
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | ||
auth_token = 'your_auth_token' | ||
|
||
# Initialize Twilio Client | ||
@client = Twilio::REST::Client.new(account_sid, auth_token) | ||
|
||
# Get an object from its sid. If you do not have a sid, | ||
# check out the list resource examples on this page | ||
@address = @client.api.addresses.create( | ||
customer_name: 'FriendlyName', | ||
street: 'Elm Street', | ||
city: 'Racoon', | ||
region: 'Mordor', | ||
postal_code: '150', | ||
iso_country: 'AX') | ||
|
||
puts @address.customer_name |
17 changes: 17 additions & 0 deletions
17
rest/addresses/instance-create-example/instance-create-example.6.x.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Download the Python helper library from twilio.com/docs/python/install | ||
from twilio.rest import Client | ||
|
||
# Your Account Sid and Auth Token from twilio.com/user/account | ||
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
auth_token = "your_auth_token" | ||
client = Client(account_sid, auth_token) | ||
|
||
address = client.addresses.create( | ||
customer_name='FriendlyName', | ||
street='Elm Street', | ||
city='Racoon', | ||
region='Mordor', | ||
postal_code='150', | ||
iso_country='AX') | ||
|
||
print(address.customer_name) |
26 changes: 26 additions & 0 deletions
26
rest/addresses/instance-create-example/instance-create-example.7.x.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Install the Java helper library from twilio.com/docs/java/install | ||
import com.twilio.Twilio; | ||
import com.twilio.rest.api.v2010.account.Address; | ||
|
||
public class Example { | ||
// Find your Account Sid and Token at twilio.com/user/account | ||
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
public static final String AUTH_TOKEN = "your_auth_token"; | ||
|
||
public static void main(String[] args) { | ||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN); | ||
|
||
// Get an object from its sid. If you do not have a sid, | ||
// check out the list resource examples on this page | ||
Address address = Address.creator( | ||
"FriendlyName", | ||
"Elm Street", | ||
"Racoon", | ||
"Mordor", | ||
"150", | ||
"AX" | ||
).create(); | ||
|
||
System.out.println(address.getCustomerName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Instance Create Example", | ||
"type": "server" | ||
} |