Skip to content

Commit

Permalink
Added new VB examples and updated C# examples to default to TLS 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
abbeynels committed Jul 27, 2023
2 parents c21ad18 + b60df47 commit 1afebf1
Show file tree
Hide file tree
Showing 26 changed files with 1,078 additions and 112 deletions.
11 changes: 8 additions & 3 deletions src/examples/InternationalAutocompleteExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ namespace Examples
{
using System;
using System.Collections.Generic;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.InternationalAutocompleteApi;

public class InternationalAutocompleteExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
Expand Down
13 changes: 9 additions & 4 deletions src/examples/InternationalStreetExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
{
using System;
using System.Collections.Generic;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.InternationalStreetApi;

internal static class InternationalStreetExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
// https://www.smartystreets.com/docs/cloud/licensing
var client = new ClientBuilder(authId, authToken).WithLicense(new List<string>{"international-global-plus-cloud"})
.BuildInternationalStreetApiClient();
.BuildInternationalStreetApiClient();

// Documentation for input fields can be found at:
// https://smartystreetscom/docs/cloud/international-street-api#http-input-fields
Expand Down
25 changes: 15 additions & 10 deletions src/examples/USAutocompleteProExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@
{
using System;
using System.Collections.Generic;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USAutocompleteProApi;

internal static class USAutocompleteProExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var key = Environment.GetEnvironmentVariable("SMARTY_AUTH_WEB");
var hostname = Environment.GetEnvironmentVariable("SMARTY_WEBSITE_DOMAIN");
var credentials = new SharedCredentials(key, hostname);
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// var id = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// var token = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
// var credentials = new StaticCredentials(id, token);
//var key = Environment.GetEnvironmentVariable("SMARTY_AUTH_WEB");
//var hostname = Environment.GetEnvironmentVariable("SMARTY_WEBSITE_DOMAIN");
//var credentials = new SharedCredentials(key, hostname);

// We recommend storing your secret keys in environment variables.
var id = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var token = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
var credentials = new StaticCredentials(id, token);
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
// https://www.smartystreets.com/docs/cloud/licensing
var client = new ClientBuilder(credentials).WithLicense(new List<string>{"us-autocomplete-pro-cloud"})
.BuildUsAutocompleteProApiClient();
var client = new ClientBuilder(credentials).WithLicense(new List<string>{"us-autocomplete-pro-cloud"})
.BuildUsAutocompleteProApiClient();

var lookup = new Lookup("1042 W Center");
lookup.PreferGeolocation = "none";
Expand Down
12 changes: 9 additions & 3 deletions src/examples/USExtractExample.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
namespace Examples
{
using System;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USExtractApi;

internal static class USExtractExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

var client = new ClientBuilder(authId, authToken).BuildUsExtractApiClient();
var text = "Here is some text.\r\nMy address is 3785 Las Vegs Av." +
"\r\nLos Vegas, Nevada." +
Expand Down
15 changes: 10 additions & 5 deletions src/examples/USReverseGeoExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USReverseGeoApi;

internal static class USReverseGeoExample
{
public static void Run()
{
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
Expand Down
11 changes: 8 additions & 3 deletions src/examples/USStreetLookupsWithMatchStrategyExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USStreetApi;

internal static class USStreetLookupsWithMatchStrategyExamples
{
public static void Run()
{
// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
Expand Down
13 changes: 9 additions & 4 deletions src/examples/USStreetMultipleAddressesExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USStreetApi;

internal static class USStreetMultipleAddressesExample
{
public static void Run()
{
// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
// https://www.smartystreets.com/docs/cloud/licensing
var client = new ClientBuilder(authId, authToken).WithLicense(new List<string>{"us-core-cloud"})
.BuildUsStreetApiClient();
.BuildUsStreetApiClient();
var batch = new Batch();

// Documentation for input fields can be found at:
Expand Down
15 changes: 10 additions & 5 deletions src/examples/USStreetSingleAddressEndpointExample.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
namespace Examples
{
using System;
using System.Net;
using System.Collections.Generic;
using System.IO;
using SmartyStreets;
using SmartyStreets;
using SmartyStreets.USStreetApi;

internal static class USStreetSingleAddressEndpointExample
{
public static void Run()
{
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
Expand Down
19 changes: 12 additions & 7 deletions src/examples/USStreetSingleAddressExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USStreetApi;

internal static class USStreetSingleAddressExample
{
public static void Run()
{
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// var authId = "Your SmartyStreets Auth ID here";
// var authToken = "Your SmartyStreets Auth Token here";

// We recommend storing your keys in environment variables instead---it's safer!
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

// The appropriate license values to be used for your subscriptions
// can be found on the Subscriptions page the account dashboard.
Expand All @@ -30,12 +35,12 @@ public static void Run()

var lookup = new Lookup
{
InputId = "24601", // Optional ID from you system
InputId = "24601", // Optional ID from your system
Addressee = "John Doe",
Street = "1600 Amphitheatre Pkwy",
Street2 = "closet under the stairs",
Secondary = "APT 2",
Urbanization = "", // Only applies to Pue rto Rico addresses
Urbanization = "", // Only applies to Puerto Rico addresses
City = "Mountain View",
State = "CA",
ZipCode = "21229",
Expand Down
60 changes: 0 additions & 60 deletions src/examples/USStreetSingleAddressExample.vb

This file was deleted.

12 changes: 9 additions & 3 deletions src/examples/USZipCodeMultipleLookupsExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
{
using System;
using System.IO;
using SmartyStreets;
using System.Net;
using SmartyStreets;
using SmartyStreets.USZipCodeApi;

internal static class USZipCodeMultipleLookupsExample
{
public static void Run()
{
// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
// specifies the TLS protocoll to use - this is TLS 1.2
const SecurityProtocolType tlsProtocol1_2 = (SecurityProtocolType)3072;

// You don't have to store your keys in environment variables, but we recommend it.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
ServicePointManager.SecurityProtocol = tlsProtocol1_2;

var client = new ClientBuilder(authId, authToken).BuildUsZipCodeApiClient();

var lookup1 = new Lookup
Expand Down
Loading

0 comments on commit 1afebf1

Please sign in to comment.