Skip to content

Commit

Permalink
[chore] Re-record JSON responses for docs (#120)
Browse files Browse the repository at this point in the history
- Re-record JSON responses for docs
- Add JSON response generation tool
- Fix GET requests using query parameters
  • Loading branch information
nwithan8 committed Jan 25, 2024
1 parent 2f162ee commit b83bc05
Show file tree
Hide file tree
Showing 169 changed files with 7,645 additions and 3,835 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ venv
/.dummy
/.eslintignore
*.sw*
/official/tools/build_doc_json_responses/responses/
/official/tools/build_doc_json_responses/tests/cassettes/
13 changes: 6 additions & 7 deletions official/docs/csharp/current/addresses/create-and-verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public static async Task Main()

Parameters.Address.Create parameters = new()
{
Street1 = "417 Montgomery Street",
Street2 = "FL 5",
City = "San Francisco",
State = "CA",
Zip = "94104",
Street1 = "000 unknown street",
City = "Not A City",
State = "ZZ",
Zip = "00001",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
Email = "test@example.com",
Phone = "5555555555",
};

Address address = await client.Address.CreateAndVerify(parameters);
Expand Down
13 changes: 6 additions & 7 deletions official/docs/csharp/current/addresses/verify-failure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public static async Task Main()

Parameters.Address.Create parameters = new()
{
Street1 = "UNDELIVERABLE ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Street1 = "000 unknown street",
City = "Not A City",
State = "ZZ",
Zip = "00001",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
Email = "test@example.com",
Phone = "5555555555",
};

Address address = await client.Address.Create(parameters);
Expand Down
13 changes: 6 additions & 7 deletions official/docs/csharp/current/addresses/verify-param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public static async Task Main()

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Street1 = "000 unknown street",
City = "Not A City",
State = "ZZ",
Zip = "00001",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
Email = "test@example.com",
Phone = "5555555555",
Verify = true
};

Expand Down
13 changes: 6 additions & 7 deletions official/docs/csharp/current/addresses/verify-strict-param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public static async Task Main()

Parameters.Address.Create parameters = new()
{
Street1 = "417 MONTGOMERY ST",
Street2 = "FLOOR 5",
City = "SAN FRANCISCO",
State = "CA",
Zip = "94104",
Street1 = "000 unknown street",
City = "Not A City",
State = "ZZ",
Zip = "00001",
Country = "US",
Company = "EasyPost",
Phone = "415-123-4567",
Email = "test@example.com",
Phone = "5555555555",
VerifyStrict = true
};

Expand Down
13 changes: 6 additions & 7 deletions official/docs/curl/current/addresses/create-and-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ curl -X POST https://api.easypost.com/v2/addresses/create_and_verify \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 Montgomery Street",
"street2": "FL 5",
"city": "San Francisco",
"state": "CA",
"zip": "94104",
"street1": "000 unknown street",
"city": "Not A City",
"state": "ZZ",
"zip": "00001",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
"email": "test@example.com",
"phone": "5555555555"
}
}'
12 changes: 6 additions & 6 deletions official/docs/curl/current/addresses/verify-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ curl -X POST https://api.easypost.com/v2/addresses \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "UNDELIVERABLE ST",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"street1": "000 unknown street",
"city": "Not A City",
"state": "ZZ",
"zip": "00001",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
"email": "test@example.com",
"phone": "5555555555"
}
}'
13 changes: 6 additions & 7 deletions official/docs/curl/current/addresses/verify-param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ curl -X POST https://api.easypost.com/v2/addresses \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 MONTGOMERY ST",
"street2": "FLOOR 5",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"street1": "000 unknown street",
"city": "Not A City",
"state": "ZZ",
"zip": "00001",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
"email": "test@example.com",
"phone": "5555555555"
},
"verify": true
}'
13 changes: 6 additions & 7 deletions official/docs/curl/current/addresses/verify-strict-param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ curl -X POST https://api.easypost.com/v2/addresses \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 MONTGOMERY ST",
"street2": "FLOOR 5",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"street1": "000 unknown street",
"city": "Not A City",
"state": "ZZ",
"zip": "00001",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
"email": "test@example.com",
"phone": "5555555555"
},
"verify_strict": true
}'
3 changes: 1 addition & 2 deletions official/docs/curl/current/endshipper/list.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
curl -X GET https://api.easypost.com/v2/end_shippers?page_size=5 \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json'
-u "$EASYPOST_API_KEY":
3 changes: 1 addition & 2 deletions official/docs/curl/current/endshipper/retrieve.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
curl -X GET https://api.easypost.com/v2/end_shippers/es_... \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json'
-u "$EASYPOST_API_KEY":
8 changes: 2 additions & 6 deletions official/docs/curl/current/shipments/label.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
curl -X GET https://api.easypost.com/v2/shipments/shp_.../label \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"file_format": "ZPL"
}'
curl -X GET https://api.easypost.com/v2/shipments/shp_.../label?file_format=ZPL \
-u "$EASYPOST_API_KEY":
13 changes: 6 additions & 7 deletions official/docs/golang/current/addresses/create-and-verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ func main() {

address, _ := client.CreateAndVerifyAddress(
&easypost.Address{
Street1: "417 Montgomery Street",
Street2: "FL 5",
City: "San Francisco",
State: "CA",
Zip: "94104",
Street1: "000 unknown street",
City: "Not A City",
State: "ZZ",
Zip: "00001",
Country: "US",
Company: "EasyPost",
Phone: "415-123-4567",
Email: "test@example.com",
Phone: "5555555555",
},
&easypost.CreateAddressOptions{},
)
Expand Down
12 changes: 6 additions & 6 deletions official/docs/golang/current/addresses/verify-failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ func main() {

address, _ := client.CreateAddress(
&easypost.Address{
Street1: "UNDELIVERABLE ST",
City: "SAN FRANCISCO",
State: "CA",
Zip: "94104",
Street1: "000 unknown street",
City: "Not A City",
State: "ZZ",
Zip: "00001",
Country: "US",
Company: "EasyPost",
Phone: "415-123-4567",
Email: "test@example.com",
Phone: "5555555555",
},
&easypost.CreateAddressOptions{},
)
Expand Down
13 changes: 6 additions & 7 deletions official/docs/golang/current/addresses/verify-param.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ func main() {

address, _ := client.CreateAddress(
&easypost.Address{
Street1: "417 Montgomery Street",
Street2: "FLOOR 5",
City: "SAN FRANCISCO",
State: "CA",
Zip: "94104",
Street1: "000 unknown street",
City: "Not A City",
State: "ZZ",
Zip: "00001",
Country: "US",
Company: "EasyPost",
Phone: "415-123-4567",
Email: "test@example.com",
Phone: "5555555555",
},
&easypost.CreateAddressOptions{
Verify: []string{"true"},
Expand Down
13 changes: 6 additions & 7 deletions official/docs/golang/current/addresses/verify-strict-param.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ func main() {

address, _ := client.CreateAddress(
&easypost.Address{
Street1: "417 MONTGOMERY ST",
Street2: "FLOOR 5",
City: "SAN FRANCISCO",
State: "CA",
Zip: "94104",
Street1: "000 unknown street",
City: "Not A City",
State: "ZZ",
Zip: "00001",
Country: "US",
Company: "EasyPost",
Phone: "415-123-4567",
Email: "test@example.com",
Phone: "5555555555",
},
&easypost.CreateAddressOptions{
VerifyStrict: []string{"true"},
Expand Down
13 changes: 6 additions & 7 deletions official/docs/java/current/addresses/create-and-verify.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ public static void main(String[] args) throws EasyPostException {

HashMap<String, Object> params = new HashMap<String, Object>();

params.put("street1", "417 Montgomery Street");
params.put("street2", "FL 5");
params.put("city", "San Francisco");
params.put("state", "CA");
params.put("zip", "94104");
params.put("street1", "000 unknown street");
params.put("city", "Not A City");
params.put("state", "ZZ");
params.put("zip", "00001");
params.put("country", "US");
params.put("company", "EasyPost");
params.put("phone", "415-123-4567");
params.put("email", "test@example.com");
params.put("phone", "5555555555");

Address address = client.address.createAndVerify(params);

Expand Down
12 changes: 6 additions & 6 deletions official/docs/java/current/addresses/verify-failure.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public static void main(String[] args) throws EasyPostException {

HashMap<String, Object> params = new HashMap<String, Object>();

params.put("street1", "UNDELIVERABLE ST");
params.put("city", "SAN FRANCISCO");
params.put("state", "CA");
params.put("zip", "94104");
params.put("street1", "000 unknown street");
params.put("city", "Not A City");
params.put("state", "ZZ");
params.put("zip", "00001");
params.put("country", "US");
params.put("company", "EasyPost");
params.put("phone", "415-123-4567");
params.put("email", "test@example.com");
params.put("phone", "5555555555");

Address address = client.address.create(params);

Expand Down
13 changes: 6 additions & 7 deletions official/docs/java/current/addresses/verify-param.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ public static void main(String[] args) throws EasyPostException {

HashMap<String, Object> params = new HashMap<String, Object>();

params.put("street1", "417 Montgomery Street");
params.put("street2", "5");
params.put("city", "SF");
params.put("state", "CA");
params.put("zip", "94104");
params.put("street1", "000 unknown street");
params.put("city", "Not A City");
params.put("state", "ZZ");
params.put("zip", "00001");
params.put("country", "US");
params.put("company", "EasyPost");
params.put("phone", "415-123-4567");
params.put("email", "test@example.com");
params.put("phone", "5555555555");
params.put("verify", true);

Address address = client.address.create(params);
Expand Down
12 changes: 6 additions & 6 deletions official/docs/java/current/addresses/verify-strict-param.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public static void main(String[] args) throws EasyPostException {

HashMap<String, Object> params = new HashMap<String, Object>();

params.put("street1", "417 Montgomery Street");
params.put("city", "SF");
params.put("state", "CA");
params.put("zip", "94104");
params.put("street1", "000 unknown street");
params.put("city", "Not A City");
params.put("state", "ZZ");
params.put("zip", "00001");
params.put("country", "US");
params.put("company", "EasyPost");
params.put("phone", "415-123-4567");
params.put("email", "test@example.com");
params.put("phone", "5555555555");
params.put("verify_strict", true);

Address address = client.address.create(params);
Expand Down
13 changes: 6 additions & 7 deletions official/docs/node/current/addresses/create-and-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ const client = new EasyPostClient(process.env.EASYPOST_API_KEY);

(async () => {
const address = await client.Address.createAndVerify({
street1: '417 montgomery street',
street2: 'FL 5',
city: 'San Francisco',
state: 'CA',
zip: '94104',
street1: '000 unknown street',
city: 'Not A City',
state: 'ZZ',
zip: '00001',
country: 'US',
company: 'EasyPost',
phone: '415-123-4567',
email: 'test@example.com',
phone: '5555555555',
});

console.log(address);
Expand Down
12 changes: 6 additions & 6 deletions official/docs/node/current/addresses/verify-failure.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const client = new EasyPostClient(process.env.EASYPOST_API_KEY);

(async () => {
const address = await client.Address.create({
street1: 'UNDELIVERABLE ST',
city: 'SAN FRANCISCO',
state: 'CA',
zip: '94104',
street1: '000 unknown street',
city: 'Not A City',
state: 'ZZ',
zip: '00001',
country: 'US',
company: 'EasyPost',
phone: '415-123-4567',
email: 'test@example.com',
phone: '5555555555',
});

console.log(address);
Expand Down

0 comments on commit b83bc05

Please sign in to comment.