Skip to content

Commit

Permalink
Merge pull request #118 from EasyPost/remove_carbon_offset
Browse files Browse the repository at this point in the history
chore: new major release examples, remove carbon offset
  • Loading branch information
Justintime50 authored Dec 11, 2023
2 parents 3d6fafc + e8fa549 commit e7b0cad
Show file tree
Hide file tree
Showing 741 changed files with 12,963 additions and 223 deletions.
36 changes: 36 additions & 0 deletions official/docs/csharp/v5/addresses/create-and-verify.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "417 Montgomery Street",
Street2 = "FL 5",
City = "San Francisco",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
};

Address address = await client.Address.CreateAndVerify(parameters);

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
36 changes: 36 additions & 0 deletions official/docs/csharp/v5/addresses/create.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
};

Address address = await client.Address.Create(parameters);

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
29 changes: 29 additions & 0 deletions official/docs/csharp/v5/addresses/list.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.All parameters = new()
{
PageSize = 5
};

AddressCollection addressCollection = await client.Address.All(parameters);

Console.WriteLine(JsonConvert.SerializeObject(addressCollection, Formatting.Indented));
}
}
}
23 changes: 23 additions & 0 deletions official/docs/csharp/v5/addresses/retrieve.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Address address = await client.Address.Retrieve("adr_...");

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
36 changes: 36 additions & 0 deletions official/docs/csharp/v5/addresses/verify-failure.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "UNDELIVERABLE ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
};

Address address = await client.Address.Create(parameters);

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
37 changes: 37 additions & 0 deletions official/docs/csharp/v5/addresses/verify-param.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
Verify = true
};

Address address = await client.Address.Create(parameters);

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
37 changes: 37 additions & 0 deletions official/docs/csharp/v5/addresses/verify-strict-param.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
VerifyStrict = true
};

Address address = await client.Address.Create(parameters);

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
38 changes: 38 additions & 0 deletions official/docs/csharp/v5/addresses/verify.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
};

Address address = await client.Address.Create(parameters);

address = await client.Address.Verify(address.Id)

Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
}
}
}
29 changes: 29 additions & 0 deletions official/docs/csharp/v5/api-keys/retrieve.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

// Retrieve all API keys including children
List<ApiKey> apiKeys = await client.ApiKey.All();

Console.WriteLine(JsonConvert.SerializeObject(apiKeys, Formatting.Indented));

// Retrieve API keys for a specific child user
List<ApiKey> childApiKeys = await client.ApiKey.RetrieveApiKeysForUser("user_...");

Console.WriteLine(JsonConvert.SerializeObject(childApiKeys, Formatting.Indented));
}
}
}
33 changes: 33 additions & 0 deletions official/docs/csharp/v5/batches/add-shipments.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Shipment shipment = await client.Shipment.Retrieve("shp_...");

Batch batch = await client.Batch.Retrieve("batch_...");

Parameters.Batch.AddShipments parameters = new()
{
Shipments = new List<Shipment> { shipment },
};

batch = await client.Batch.AddShipments(batch.Id, parameters);

Console.WriteLine(JsonConvert.SerializeObject(batch, Formatting.Indented));
}
}
}
25 changes: 25 additions & 0 deletions official/docs/csharp/v5/batches/buy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Batch batch = await client.Batch.Retrieve("batch_...");

batch = await client.Batch.Buy(batch.Id);

Console.WriteLine(JsonConvert.SerializeObject(batch, Formatting.Indented));
}
}
}
Loading

0 comments on commit e7b0cad

Please sign in to comment.