-
Notifications
You must be signed in to change notification settings - Fork 7
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 #141 from EasyPost/smartrate
- Loading branch information
Showing
29 changed files
with
787 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
official/docs/csharp/current/smartrate/retrieve-recommend-ship-date.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,27 @@ | ||
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() | ||
{ | ||
var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
||
Parameters.Shipment.RecommendShipDateForShipment parameters = new() | ||
{ | ||
DesiredDeliveryDate = "2024-07-18", | ||
}; | ||
|
||
List<RecommendShipDateForShipmentResult> rates = await client.Shipment.RecommendShipDate("shp_...", parameters); | ||
|
||
Console.WriteLine(JsonConvert.SerializeObject(rates, Formatting.Indented)); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
official/docs/csharp/current/smartrate/retrieve-standalone-smartrate-deliver-by.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,30 @@ | ||
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() | ||
{ | ||
var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
||
Parameters.SmartRate.EstimateDeliveryDateForZipPair estimateDeliveryDateForZipPairParameters = new() | ||
{ | ||
OriginPostalCode = address1Parameters.Zip, | ||
DestinationPostalCode = address2Parameters.Zip, | ||
PlannedShipDate = Fixtures.PlannedShipDate, | ||
Carriers = ["USPS"], | ||
}; | ||
|
||
EstimateDeliveryDateForZipPairResult results = await client.SmartRate.EstimateDeliveryDate(estimateDeliveryDateForZipPairParameters); | ||
|
||
Console.WriteLine(JsonConvert.SerializeObject(results, Formatting.Indented)); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
official/docs/csharp/current/smartrate/retrieve-standalone-smartrate-deliver-on.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,30 @@ | ||
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() | ||
{ | ||
var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
||
Parameters.SmartRate.RecommendShipDateForZipPair recommendShipDateForZipPairParameters = new() | ||
{ | ||
OriginPostalCode = address1Parameters.Zip, | ||
DestinationPostalCode = address2Parameters.Zip, | ||
DesiredDeliveryDate = Fixtures.DesiredDeliveryDate, | ||
Carriers = ["USPS"], | ||
}; | ||
|
||
RecommendShipDateForZipPairResult results = await client.SmartRate.RecommendShipDate(recommendShipDateForZipPairParameters); | ||
|
||
Console.WriteLine(JsonConvert.SerializeObject(results, Formatting.Indented)); | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
official/docs/curl/current/smartrate/retrieve-recommend-ship-date.sh
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,2 @@ | ||
curl -X GET https://api.easypost.com/v2/shipments/shp_.../smartrate/precision_shipping?desired_delivery_date=yyyy-mm-dd \ | ||
-u "EASYPOST_API_KEY": |
9 changes: 9 additions & 0 deletions
9
official/docs/curl/current/smartrate/retrieve-standalone-smartrate-deliver-by.sh
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,9 @@ | ||
curl -X POST https://api.easypost.com/v2/smartrate/deliver_by \ | ||
-u "EASYPOST_API_KEY": \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"from_zip": "10001", | ||
"planned_ship_date": "2024-07-18", | ||
"to_zip": "10002", | ||
"carriers": [UPS], | ||
}' |
9 changes: 9 additions & 0 deletions
9
official/docs/curl/current/smartrate/retrieve-standalone-smartrate-deliver-on.sh
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,9 @@ | ||
curl -X POST https://api.easypost.com/v2/smartrate/deliver_on \ | ||
-u "EASYPOST_API_KEY": \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"from_zip": "10001", | ||
"desired_delivery_date": "2024-07-18", | ||
"to_zip": "10002", | ||
"carriers": [UPS], | ||
}' |
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
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
15 changes: 15 additions & 0 deletions
15
official/docs/golang/current/smartrate/retrieve-recommend-ship-date.go
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,15 @@ | ||
package example | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/EasyPost/easypost-go/v4" | ||
) | ||
|
||
func main() { | ||
client := easypost.New("EASYPOST_API_KEY") | ||
|
||
rates, _ := client.RecommendShipDateForShipment("shp_...", "YYYY-MM-DD") | ||
|
||
fmt.Println(rates) | ||
} |
22 changes: 22 additions & 0 deletions
22
official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-by.go
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,22 @@ | ||
package example | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/EasyPost/easypost-go/v4" | ||
) | ||
|
||
func main() { | ||
client := easypost.New("EASYPOST_API_KEY") | ||
|
||
params := &easypost.EstimateDeliveryDateForZipPairParams{ | ||
OriginPostalCode: "10001", | ||
DestinationPostalCode: "10002", | ||
Carriers: []string{"UPS", "FedEx"}, | ||
PlannedShipDate: "2024-07-18", | ||
} | ||
|
||
estimates, _ := client.EstimateDeliveryDateForZipPair(params) | ||
|
||
fmt.Println(estimates) | ||
} |
22 changes: 22 additions & 0 deletions
22
official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-on.go
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,22 @@ | ||
package example | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/EasyPost/easypost-go/v4" | ||
) | ||
|
||
func main() { | ||
client := easypost.New("EASYPOST_API_KEY") | ||
|
||
params := &easypost.RecommendShipDateForZipPairParams{ | ||
OriginPostalCode: "10001", | ||
DestinationPostalCode: "10002", | ||
Carriers: []string{"UPS", "FedEx"}, | ||
DesiredDeliveryDate: "2024-07-18", | ||
} | ||
|
||
recommendations, _ := client.RecommendShipDateForZipPair(params) | ||
|
||
fmt.Println(recommendations) | ||
} |
20 changes: 20 additions & 0 deletions
20
official/docs/java/current/smartrate/retrieve-recommend-ship-date.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,20 @@ | ||
package shipments; | ||
|
||
import com.easypost.exception.EasyPostException; | ||
import com.easypost.model.Shipment; | ||
import com.easypost.model.RecommendShipDateForShipmentResult; | ||
import com.easypost.service.EasyPostClient; | ||
|
||
import java.util.List; | ||
|
||
public class RetrieveRecommendShipDate { | ||
public static void main(String[] args) throws EasyPostException { | ||
EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
|
||
Shipment shipment = client.shipment.retrieve("shp_..."); | ||
List<RecommendShipDateForShipmentResult> rates = client.shipment | ||
.recommendShipDate(shipment.getId(), "YYYY-MM-DD"); | ||
|
||
System.out.println(rates); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
official/docs/java/current/smartrate/retrieve-standalone-smartrate-deliver-by.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,25 @@ | ||
package shipments; | ||
|
||
import com.easypost.exception.EasyPostException; | ||
import com.easypost.model.EstimateDeliveryDateForZipPairResult; | ||
import com.easypost.service.EasyPostClient; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class RetrieveRecommendShipDate { | ||
public static void main(String[] args) throws EasyPostException { | ||
EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
Map<String, Object> params = new HashMap<String, Object>(); | ||
params.put("from_zip", "10001"); | ||
params.put("to_zip", "10002"); | ||
params.put("planned_ship_date", "2024-07-18"); | ||
params.put("carriers", Collections.singletonList("UPS")); | ||
|
||
EstimateDeliveryDateForZipPairResult results = client.smartRate | ||
.estimateDeliveryDate(params); | ||
|
||
System.out.println(results); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
official/docs/java/current/smartrate/retrieve-standalone-smartrate-deliver-on.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,25 @@ | ||
package shipments; | ||
|
||
import com.easypost.exception.EasyPostException; | ||
import com.easypost.model.RecommendShipDateForZipPairResult; | ||
import com.easypost.service.EasyPostClient; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class RetrieveRecommendShipDate { | ||
public static void main(String[] args) throws EasyPostException { | ||
EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
Map<String, Object> params = new HashMap<String, Object>(); | ||
params.put("from_zip", "10001"); | ||
params.put("to_zip", "10002"); | ||
params.put("desired_delivery_date", "2024-07-18"); | ||
params.put("carriers", Collections.singletonList("UPS")); | ||
|
||
RecommendShipDateForZipPairResult results = client.smartRate | ||
.recommendShipDate(params); | ||
|
||
System.out.println(results); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
official/docs/node/current/smartrate/retrieve-recommend-ship-date.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,9 @@ | ||
const EasyPostClient = require('@easypost/api'); | ||
|
||
const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
(async () => { | ||
const rates = await client.Shipment.recommendShipDate('shp_...', 'YYYY-MM-DD'); | ||
|
||
console.log(rates); | ||
})(); |
16 changes: 16 additions & 0 deletions
16
official/docs/node/current/smartrate/retrieve-standalone-smartrate-deliver-by.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,16 @@ | ||
const EasyPostClient = require('@easypost/api'); | ||
|
||
const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
const params = { | ||
from_zip: '10001', | ||
to_zip: '10002', | ||
planned_ship_date: '2024-07-18', | ||
carriers: ['UPS'], | ||
}; | ||
|
||
(async () => { | ||
const results = await client.SmartRate.estimateDeliveryDate(params); | ||
|
||
console.log(results); | ||
})(); |
16 changes: 16 additions & 0 deletions
16
official/docs/node/current/smartrate/retrieve-standalone-smartrate-deliver-on.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,16 @@ | ||
const EasyPostClient = require('@easypost/api'); | ||
|
||
const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
const params = { | ||
from_zip: '10001', | ||
to_zip: '10002', | ||
desired_delivery_date: '2024-07-18', | ||
carriers: ['UPS'], | ||
}; | ||
|
||
(async () => { | ||
const results = await client.SmartRate.recommendShipDate(params); | ||
|
||
console.log(results); | ||
})(); |
7 changes: 7 additions & 0 deletions
7
official/docs/php/current/smartrate/retrieve-recommend-ship-date.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,7 @@ | ||
<?php | ||
|
||
$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
$rates = $client->shipment->recommendShipDate('shp_...', 'YYYY-MM-DD'); | ||
|
||
echo $rates; |
14 changes: 14 additions & 0 deletions
14
official/docs/php/current/smartrate/retrieve-standalone-smartrate-deliver-by.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,14 @@ | ||
<?php | ||
|
||
$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
$params = [ | ||
'from_zip' => '10001', | ||
'to_zip' => '10002', | ||
'planned_ship_date' => '2024-07-18', | ||
'carriers' => ['UPS'], | ||
]; | ||
|
||
$results = $client->smartRate->estimateDeliveryDate($params); | ||
|
||
echo $results; |
14 changes: 14 additions & 0 deletions
14
official/docs/php/current/smartrate/retrieve-standalone-smartrate-deliver-on.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,14 @@ | ||
<?php | ||
|
||
$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
||
$params = [ | ||
'from_zip' => '10001', | ||
'to_zip' => '10002', | ||
'desired_delivery_date' => '2024-07-18', | ||
'carriers' => ['UPS'], | ||
]; | ||
|
||
$results = $client->smartRate->recommendShipDate($params); | ||
|
||
echo $results; |
10 changes: 10 additions & 0 deletions
10
official/docs/python/current/smartrate/retrieve-recommend-ship-date.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,10 @@ | ||
import easypost | ||
|
||
client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
||
estimated_delivery_dates = client.shipment.recommend_ship_date( | ||
"shp_...", | ||
desired_delivery_date="YYYY-MM-DD", | ||
) | ||
|
||
print(estimated_delivery_dates) |
14 changes: 14 additions & 0 deletions
14
official/docs/python/current/smartrate/retrieve-standalone-smartrate-deliver-by.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,14 @@ | ||
import easypost | ||
|
||
client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
||
params = { | ||
"from_zip": "10001", | ||
"to_zip": "10002", | ||
"planned_ship_date": "2024-07-18", | ||
"carriers": ["usps"], | ||
} | ||
|
||
results = client.smartrate.estimate_delivery_date(**params) | ||
|
||
print(results) |
14 changes: 14 additions & 0 deletions
14
official/docs/python/current/smartrate/retrieve-standalone-smartrate-deliver-on.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,14 @@ | ||
import easypost | ||
|
||
client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
||
params = { | ||
"from_zip": "10001", | ||
"to_zip": "10002", | ||
"desired_delivery_date": "2024-07-18", | ||
"carriers": ["usps"], | ||
} | ||
|
||
results = client.smartrate.recommend_ship_date(**params) | ||
|
||
print(results) |
Oops, something went wrong.