Class BatchService
Class representing a set of batch-related functionality.
Inherited Members
Namespace: EasyPost.Services
Assembly: EasyPost.dll
Syntax
public class BatchService : EasyPostService, IEasyPostService
  Methods
| Improve this Doc View SourceAddShipments(String, Dictionary<String, Object>, CancellationToken)
Add Shipments to a Batch. Related API documentation.
Declaration
public async Task<Batch> AddShipments(string id, Dictionary<string, object> parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| Dictionary<System.String, System.Object> | parameters | Parameters for the Shipments to add.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
AddShipments(String, AddShipments, CancellationToken)
Add Shipments to a Batch. Related API documentation.
Declaration
public async Task<Batch> AddShipments(string id, AddShipments parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| AddShipments | parameters | Parameters for the Shipments to add.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
AddShipments(String, IEnumerable<String>, CancellationToken)
Add Shipments to a Batch. Related API documentation.
Declaration
public async Task<Batch> AddShipments(string id, IEnumerable<string> shipmentIds, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| IEnumerable<System.String> | shipmentIds | |
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
AddShipments(String, List<Shipment>, CancellationToken)
Add Shipments to a Batch. Related API documentation.
Declaration
public async Task<Batch> AddShipments(string id, List<Shipment> shipmentsToAdd, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| List<Shipment> | shipmentsToAdd | |
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
All(All, CancellationToken)
List all Batch objects. Related API documentation.
Declaration
public async Task<BatchCollection> All(All parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| All | parameters | All parameter set.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<BatchCollection> | A BatchCollection instance.  | 
      
All(Nullable<Dictionary<String, Object>>, CancellationToken)
List all Batch objects. Related API documentation.
Declaration
public async Task<BatchCollection> All(Dictionary<string, object>? parameters = null, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Nullable<Dictionary<System.String, System.Object>> | parameters | Dictionary containing parameters to filter the result list with.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<BatchCollection> | A BatchCollection instance.  | 
      
Buy(String, CancellationToken)
Purchase all Shipments within a Batch. The State must be "created" before purchasing. Related API documentation.
Declaration
public async Task<Batch> Buy(string id, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
Create(Create, CancellationToken)
Create a Batch. Related API documentation.
Declaration
public async Task<Batch> Create(Create parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Create | parameters | Data to use to create the Batch.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | A Batch object.  | 
      
Create(Nullable<Dictionary<String, Object>>, CancellationToken)
Create a Batch. Related API documentation.
Declaration
public async Task<Batch> Create(Dictionary<string, object>? parameters = null, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Nullable<Dictionary<System.String, System.Object>> | parameters | Data to use to create the Batch.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | A Batch object.  | 
      
GenerateLabel(String, GenerateLabel, CancellationToken)
Asynchronously generate a PostageLabel containing all of the Shipment labels belonging to this Batch. Related API documentation.
Declaration
public async Task<Batch> GenerateLabel(string id, GenerateLabel parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | The ID of the Batch to generate a label for.  | 
      
| GenerateLabel | parameters | GenerateLabel parameter set.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
GenerateLabel(String, String, CancellationToken)
Asynchronously generate a PostageLabel containing all of the Shipment labels belonging to a Batch. Related API documentation.
Declaration
public async Task<Batch> GenerateLabel(string id, string fileFormat, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | The ID of the Batch to generate a label for.  | 
      
| System.String | fileFormat | Format to generate the label in. Must be "pdf" or "zpl".  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
GenerateScanForm(String, GenerateScanForm, CancellationToken)
Asynchronously generate a ScanForm for this Batch. Related API documentation.
Declaration
public async Task<Batch> GenerateScanForm(string id, GenerateScanForm parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | String representing a Batch. Starts with "batch_".  | 
      
| GenerateScanForm | parameters | GenerateScanForm parameter set.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | This updated Batch instance.  | 
      
GenerateScanForm(String, String, CancellationToken)
Asynchronously generate a ScanForm for a Batch. Related API documentation.
Declaration
public async Task<Batch> GenerateScanForm(string id, string fileFormat, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | String representing a Batch. Starts with "batch_".  | 
      
| System.String | fileFormat | Format to generate the label in. Valid formats: "pdf", "zpl" and "epl2".  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch instance.  | 
      
RemoveShipments(String, Dictionary<String, Object>, CancellationToken)
Remove Shipments from a Batch. Related API documentation.
Declaration
public async Task<Batch> RemoveShipments(string id, Dictionary<string, object> parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| Dictionary<System.String, System.Object> | parameters | Parameters for the Shipments to remove.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
RemoveShipments(String, RemoveShipments, CancellationToken)
Remove Shipments from a Batch. Related API documentation.
Declaration
public async Task<Batch> RemoveShipments(string id, RemoveShipments parameters, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| RemoveShipments | parameters | Parameters for the Shipments to remove.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
RemoveShipments(String, IEnumerable<String>, CancellationToken)
Remove Shipments from a Batch. Related API documentation.
Declaration
public async Task<Batch> RemoveShipments(string id, IEnumerable<string> shipmentIds, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| IEnumerable<System.String> | shipmentIds | |
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
RemoveShipments(String, List<Shipment>, CancellationToken)
Remove Shipments from a Batch. Related API documentation.
Declaration
public async Task<Batch> RemoveShipments(string id, List<Shipment> shipmentsToRemove, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | |
| List<Shipment> | shipmentsToRemove | |
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | An updated Batch object.  | 
      
Retrieve(String, CancellationToken)
Retrieve a Batch. Related API documentation.
Declaration
public async Task<Batch> Retrieve(string id, CancellationToken cancellationToken = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | id | The ID of the Batch to retrieve.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<Batch> | The requested Batch.  |