Class EasyPostService
Base class for all EasyPost services (collection of related methods).
Inheritance
Namespace: EasyPost._base
Assembly: EasyPost.dll
Syntax
public abstract class EasyPostService : object, IEasyPostService
  Constructors
| Improve this Doc View SourceEasyPostService(EasyPostClient)
Initializes a new instance of the EasyPostService class.
Declaration
protected EasyPostService(EasyPostClient client)
  Parameters
| Type | Name | Description | 
|---|---|---|
| EasyPostClient | client | The EasyPostClient to use when this service makes API requests.  | 
      
Fields
| Improve this Doc View SourceClient
The EasyPostClient that this service will use to make API requests.
Declaration
protected readonly EasyPostClient Client
  Field Value
| Type | Description | 
|---|---|
| EasyPostClient | 
Methods
| Improve this Doc View SourceDispose()
Dispose of this object.
Declaration
public void Dispose()
  Dispose(Boolean)
Dispose of this object.
Declaration
protected virtual void Dispose(bool disposing)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Boolean | disposing | Whether this object is being disposed.  | 
      
Finalize()
Finalizes an instance of the EasyPostService class.
Declaration
protected void Finalize()
  RequestAsync(Method, String, CancellationToken, Nullable<Dictionary<String, Object>>, ApiVersion)
Make a non-response HTTP request to the EasyPost API.
Declaration
protected async Task RequestAsync(Method method, string endpoint, CancellationToken cancellationToken, Dictionary<string, object>? parameters = null, ApiVersion overrideApiVersion = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Method | method | HTTP Method to use for the request.  | 
      
| System.String | endpoint | EasyPost API endpoint to use for the request.  | 
      
| CancellationToken | cancellationToken | |
| System.Nullable<Dictionary<System.String, System.Object>> | parameters | Optional parameters to use for the request.  | 
      
| ApiVersion | overrideApiVersion | Override the default ApiVersion (Current) to use for the request.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | None.  | 
      
RequestAsync<T>(Method, String, CancellationToken, Nullable<Dictionary<String, Object>>, Nullable<String>, ApiVersion)
Make an HTTP request to the EasyPost API and deserialize the response JSON into an object.
Declaration
protected async Task<T> RequestAsync<T>(Method method, string endpoint, CancellationToken cancellationToken, Dictionary<string, object>? parameters = null, string? rootElement = null, ApiVersion overrideApiVersion = null)
    where T : class
  Parameters
| Type | Name | Description | 
|---|---|---|
| Method | method | HTTP Method to use for the request.  | 
      
| System.String | endpoint | EasyPost API endpoint to use for the request.  | 
      
| CancellationToken | cancellationToken | |
| System.Nullable<Dictionary<System.String, System.Object>> | parameters | Optional parameters to use for the request.  | 
      
| System.Nullable<System.String> | rootElement | Optional JSON key to start at when deserializing the resultant JSON into an object.  | 
      
| ApiVersion | overrideApiVersion | Override the default ApiVersion (Current) to use for the request.  | 
      
Returns
| Type | Description | 
|---|---|
| Task<T> | A T-type object.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | Type of object to return from request.  |