Files
bnhtrade/src/Amazon-SP-API-CSharp/Source/FikaAmazonAPI/AmazonSpApiSDK/Api/Sales/SalesApi.cs
2024-04-11 12:26:13 +01:00

400 lines
48 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Selling Partner API for Sales
*
* The Selling Partner API for Sales provides APIs related to sales performance.
*
* OpenAPI spec version: v1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using FikaAmazonAPI.AmazonSpApiSDK.Clients;
using FikaAmazonAPI.AmazonSpApiSDK.Models.Sales;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace FikaAmazonAPI.AmazonSpApiSDK.Api.Sales
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface ISalesApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </remarks>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>GetOrderMetricsResponse</returns>
GetOrderMetricsResponse GetOrderMetrics(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null);
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </remarks>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>ApiResponse of GetOrderMetricsResponse</returns>
ApiResponse<GetOrderMetricsResponse> GetOrderMetricsWithHttpInfo(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </remarks>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>Task of GetOrderMetricsResponse</returns>
System.Threading.Tasks.Task<GetOrderMetricsResponse> GetOrderMetricsAsync(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null);
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </remarks>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>Task of ApiResponse (GetOrderMetricsResponse)</returns>
System.Threading.Tasks.Task<ApiResponse<GetOrderMetricsResponse>> GetOrderMetricsAsyncWithHttpInfo(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null);
#endregion Asynchronous Operations
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class SalesApi : ISalesApi
{
private ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="SalesApi"/> class.
/// </summary>
/// <returns></returns>
public SalesApi(string basePath)
{
Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="SalesApi"/> class
/// using Configuration object
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <returns></returns>
public SalesApi(Configuration configuration = null)
{
if (configuration == null) // use the default one in Configuration
Configuration = Configuration.Default;
else
Configuration = configuration;
ExceptionFactory = Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
public string GetBasePath()
{
return Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(string basePath)
{
// do nothing
}
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
public Configuration Configuration { get; set; }
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
public ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
/// <summary>
/// Gets the default header.
/// </summary>
/// <returns>Dictionary of HTTP header</returns>
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
public IDictionary<string, string> DefaultHeader()
{
return new ReadOnlyDictionary<string, string>(Configuration.DefaultHeader);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
Configuration.AddDefaultHeader(key, value);
}
/// <summary>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>GetOrderMetricsResponse</returns>
public GetOrderMetricsResponse GetOrderMetrics(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null)
{
ApiResponse<GetOrderMetricsResponse> localVarResponse = GetOrderMetricsWithHttpInfo(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku);
return localVarResponse.Data;
}
/// <summary>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>ApiResponse of GetOrderMetricsResponse</returns>
public ApiResponse<GetOrderMetricsResponse> GetOrderMetricsWithHttpInfo(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null)
{
// verify the required parameter 'marketplaceIds' is set
if (marketplaceIds == null)
throw new ApiException(400, "Missing required parameter 'marketplaceIds' when calling SalesApi->GetOrderMetrics");
// verify the required parameter 'interval' is set
if (interval == null)
throw new ApiException(400, "Missing required parameter 'interval' when calling SalesApi->GetOrderMetrics");
// verify the required parameter 'granularity' is set
if (granularity == null)
throw new ApiException(400, "Missing required parameter 'granularity' when calling SalesApi->GetOrderMetrics");
var localVarPath = "/sales/v1/orderMetrics";
var localVarPathParams = new Dictionary<string, string>();
var localVarQueryParams = new List<KeyValuePair<string, string>>();
var localVarHeaderParams = new Dictionary<string, string>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<string, string>();
var localVarFileParams = new Dictionary<string, FileParameter>();
object localVarPostBody = null;
// to determine the Content-Type header
string[] localVarHttpContentTypes = new string[] {
"application/json"
};
string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
string[] localVarHttpHeaderAccepts = new string[] {
"application/json"
};
string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (marketplaceIds != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "marketplaceIds", marketplaceIds)); // query parameter
if (interval != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "interval", interval)); // query parameter
if (granularityTimeZone != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "granularityTimeZone", granularityTimeZone)); // query parameter
if (granularity != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "granularity", granularity)); // query parameter
if (buyerType != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "buyerType", buyerType)); // query parameter
if (fulfillmentNetwork != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "fulfillmentNetwork", fulfillmentNetwork)); // query parameter
if (firstDayOfWeek != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "firstDayOfWeek", firstDayOfWeek)); // query parameter
if (asin != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "asin", asin)); // query parameter
if (sku != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "sku", sku)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int)localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetOrderMetrics", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<GetOrderMetricsResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(GetOrderMetricsResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(GetOrderMetricsResponse)));
}
/// <summary>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>Task of GetOrderMetricsResponse</returns>
public async System.Threading.Tasks.Task<GetOrderMetricsResponse> GetOrderMetricsAsync(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null)
{
ApiResponse<GetOrderMetricsResponse> localVarResponse = await GetOrderMetricsAsyncWithHttpInfo(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku);
return localVarResponse.Data;
}
/// <summary>
/// Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | - -- - | - -- - | | .5 | 15 | For more information, see \&quot;Usage Plans and Rate Limits\&quot; in the Selling Partner API documentation.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="marketplaceIds">A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.</param>
/// <param name="interval">A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00- -2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.</param>
/// <param name="granularity">The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity&#x3D;Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity&#x3D;Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date dont align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.</param>
/// <param name="granularityTimeZone">An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)</param>
/// <param name="buyerType">Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)</param>
/// <param name="fulfillmentNetwork">Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)</param>
/// <param name="firstDayOfWeek">Specifies the day that the week starts on when granularity&#x3D;Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)</param>
/// <param name="asin">Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)</param>
/// <param name="sku">Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)</param>
/// <returns>Task of ApiResponse (GetOrderMetricsResponse)</returns>
public async System.Threading.Tasks.Task<ApiResponse<GetOrderMetricsResponse>> GetOrderMetricsAsyncWithHttpInfo(List<string> marketplaceIds, string interval, string granularity, string granularityTimeZone = null, string buyerType = null, string fulfillmentNetwork = null, string firstDayOfWeek = null, string asin = null, string sku = null)
{
// verify the required parameter 'marketplaceIds' is set
if (marketplaceIds == null)
throw new ApiException(400, "Missing required parameter 'marketplaceIds' when calling SalesApi->GetOrderMetrics");
// verify the required parameter 'interval' is set
if (interval == null)
throw new ApiException(400, "Missing required parameter 'interval' when calling SalesApi->GetOrderMetrics");
// verify the required parameter 'granularity' is set
if (granularity == null)
throw new ApiException(400, "Missing required parameter 'granularity' when calling SalesApi->GetOrderMetrics");
var localVarPath = "/sales/v1/orderMetrics";
var localVarPathParams = new Dictionary<string, string>();
var localVarQueryParams = new List<KeyValuePair<string, string>>();
var localVarHeaderParams = new Dictionary<string, string>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<string, string>();
var localVarFileParams = new Dictionary<string, FileParameter>();
object localVarPostBody = null;
// to determine the Content-Type header
string[] localVarHttpContentTypes = new string[] {
"application/json"
};
string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
string[] localVarHttpHeaderAccepts = new string[] {
"application/json"
};
string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (marketplaceIds != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "marketplaceIds", marketplaceIds)); // query parameter
if (interval != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "interval", interval)); // query parameter
if (granularityTimeZone != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "granularityTimeZone", granularityTimeZone)); // query parameter
if (granularity != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "granularity", granularity)); // query parameter
if (buyerType != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "buyerType", buyerType)); // query parameter
if (fulfillmentNetwork != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "fulfillmentNetwork", fulfillmentNetwork)); // query parameter
if (firstDayOfWeek != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "firstDayOfWeek", firstDayOfWeek)); // query parameter
if (asin != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "asin", asin)); // query parameter
if (sku != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "sku", sku)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int)localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetOrderMetrics", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<GetOrderMetricsResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(GetOrderMetricsResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(GetOrderMetricsResponse)));
}
}
}