Class ProductsAndPricingClient
A client of the products and pricing API.
Inheritance
System.Object
ProductsAndPricingClient
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: EC.ProductsAndPricing.Client
Assembly: EC.ProductsAndPricing.Client.dll
Syntax
public class ProductsAndPricingClient
Examples
The client uses IReturn<T>
to infer the return type of messages safely.
public class ExampleRequest : IReturn<ExampleResponse> {}
public class ExampleResponse {}
public class Program
{
public static void Main()
{
ProductsAndPricingClientConfig config = new ProductsAndPricingClientConfig();
config.BaseUri = new Uri("https://example.ecenglish.com");
ProductsAndPricingClient apiClient = new ProductsAndPricingClien(config);
ProductsAndPricingClient apiClient = GetClient();
ExampleReqeuest request = new ExampleRequest();
ExampleResponse response = apiClient.Post(request);
}
}
Constructors
View SourceProductsAndPricingClient(ProductsAndPricingClientConfig)
Create a new api client.
Declaration
public ProductsAndPricingClient(ProductsAndPricingClientConfig config)
Parameters
Type | Name | Description |
---|---|---|
ProductsAndPricingClientConfig | config | Config used to setup the client |
Remarks
This class is thread safe
Methods
View SourceFetch<T>(ApiLink<T>)
Declaration
public T Fetch<T>(ApiLink<T> link)
Parameters
Type | Name | Description |
---|---|---|
ApiLink<T> | link |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
FetchAsync<T>(ApiLink<T>)
Fetch a linked resource
Declaration
public Task<T> FetchAsync<T>(ApiLink<T> link)
Parameters
Type | Name | Description |
---|---|---|
ApiLink<T> | link | A link to the resource |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | The resource fetched |
Type Parameters
Name | Description |
---|---|
T | The type of the lined resource |
Send<T>(IReturn<T>)
Send the specified message to the API
Declaration
public T Send<T>(IReturn<T> message)
Parameters
Type | Name | Description |
---|---|---|
IReturn<T> | message | The message to post |
Returns
Type | Description |
---|---|
T | The result of calling the api |
Type Parameters
Name | Description |
---|---|
T | The type of result that the client will return. |
Exceptions
Type | Condition |
---|---|
ProductsAndPricingException |
SendAsync<T>(IReturn<T>)
Declaration
public Task<T> SendAsync<T>(IReturn<T> message)
Parameters
Type | Name | Description |
---|---|---|
IReturn<T> | message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> |
Type Parameters
Name | Description |
---|---|
T |