本文整理汇总了C#中Mozu.Api.Test.Helpers.ServiceClientMessageHandler类的典型用法代码示例。如果您正苦于以下问题:C# ServiceClientMessageHandler类的具体用法?C# ServiceClientMessageHandler怎么用?C# ServiceClientMessageHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceClientMessageHandler类属于Mozu.Api.Test.Helpers命名空间,在下文中一共展示了ServiceClientMessageHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformTreeDocumentContent
/// <summary>
///
/// <example>
/// <code>
/// var result = DocumentTreeFactory.TransformTreeDocumentContent(handler : handler, documentListName : documentListName, documentName : documentName, width : width, height : height, max : max, maxWidth : maxWidth, maxHeight : maxHeight, crop : crop, quality : quality, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<Stream/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static System.IO.Stream TransformTreeDocumentContent(ServiceClientMessageHandler handler,
string documentListName, string documentName, int? width = null, int? height = null, int? max = null, int? maxWidth = null, int? maxHeight = null, string crop = null, int? quality = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Content.Documentlists.DocumentTreeClient.TransformTreeDocumentContentClient(
documentListName : documentListName, documentName : documentName, width : width, height : height, max : max, maxWidth : maxWidth, maxHeight : maxHeight, crop : crop, quality : quality );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例2: GetProductVariationLocalizedDeltaPrices
/// <summary>
///
/// <example>
/// <code>
/// var result = ProductVariationFactory.GetProductVariationLocalizedDeltaPrices(handler : handler, productCode : productCode, variationKey : variationKey, dataViewMode: dataViewMode, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<List<ProductVariationDeltaPrice>/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static List<Mozu.Api.Contracts.ProductAdmin.ProductVariationDeltaPrice> GetProductVariationLocalizedDeltaPrices(ServiceClientMessageHandler handler,
string productCode, string variationKey, DataViewMode dataViewMode= DataViewMode.Live,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.GetProductVariationLocalizedDeltaPricesClient(
productCode : productCode, variationKey : variationKey, dataViewMode: dataViewMode );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例3: ApplyShippingAdjustment
/// <summary>
/// Applies a shipping adjustment to the specified order.
/// <example>
/// <code>
/// var result = AdjustmentFactory.ApplyShippingAdjustment(handler : handler, adjustment : adjustment, orderId : orderId, updateMode : updateMode, version : version, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<Order/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.CommerceRuntime.Orders.Order ApplyShippingAdjustment(ServiceClientMessageHandler handler,
Mozu.Api.Contracts.CommerceRuntime.Commerce.Adjustment adjustment, string orderId, string updateMode = null, string version = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Orders.AdjustmentClient.ApplyShippingAdjustmentClient(
adjustment : adjustment, orderId : orderId, updateMode : updateMode, version : version );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例4: DeleteOption
/// <summary>
/// Removes an option attribute definition for the specified product type.
/// <example>
/// <code>
/// var result = ProductTypeOptionFactory.DeleteOption(handler : handler, productTypeId : productTypeId, attributeFQN : attributeFQN, dataViewMode: dataViewMode, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<void/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static void DeleteOption(ServiceClientMessageHandler handler,
int productTypeId, string attributeFQN, DataViewMode dataViewMode= DataViewMode.Live,
HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Admin.Attributedefinition.Producttypes.ProductTypeOptionClient.DeleteOptionClient(
productTypeId : productTypeId, attributeFQN : attributeFQN, dataViewMode: dataViewMode );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
}
var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例5: GetThirdPartyPaymentWorkflows
/// <summary>
/// Retrieves the details of the third-party payment service workflows configured for the site.
/// <example>
/// <code>
/// var result = PaymentSettingsFactory.GetThirdPartyPaymentWorkflows(handler : handler, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<List<ExternalPaymentWorkflowDefinition>/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static List<Mozu.Api.Contracts.SiteSettings.Order.ExternalPaymentWorkflowDefinition> GetThirdPartyPaymentWorkflows(ServiceClientMessageHandler handler,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Settings.Checkout.PaymentSettingsClient.GetThirdPartyPaymentWorkflowsClient(
);
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例6: ConfiguredProduct
/// <summary>
/// Creates a new product selection. A create occurs each time a shopper selects a product option as they configure a product. Once all the required product options are configured, the product can be added to a cart.
/// <example>
/// <code>
/// var result = ProductFactory.ConfiguredProduct(handler : handler, productOptionSelections : productOptionSelections, productCode : productCode, includeOptionDetails : includeOptionDetails, skipInventoryCheck : skipInventoryCheck, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<ConfiguredProduct/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ProductRuntime.ConfiguredProduct ConfiguredProduct(ServiceClientMessageHandler handler,
Mozu.Api.Contracts.ProductRuntime.ProductOptionSelections productOptionSelections, string productCode, bool? includeOptionDetails = null, bool? skipInventoryCheck = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Storefront.ProductClient.ConfiguredProductClient(
productOptionSelections : productOptionSelections, productCode : productCode, includeOptionDetails : includeOptionDetails, skipInventoryCheck : skipInventoryCheck );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例7: GetRates
/// <summary>
///
/// <example>
/// <code>
/// var result = ObjectFactory.GetRates(handler : handler, rateRequest : rateRequest, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<RatesResponse/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ShippingRuntime.RatesResponse GetRates(ServiceClientMessageHandler handler,
Mozu.Api.Contracts.ShippingRuntime.RateRequest rateRequest,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Storefront.ObjectClient.GetRatesClient(
rateRequest : rateRequest );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例8: GenerateProductVariations
/// <summary>
/// Generates the variations possible for a product associated with the product type based on the option values supplied in the request.
/// <example>
/// <code>
/// var result = ProductTypeVariationFactory.GenerateProductVariations(handler : handler, productOptionsIn : productOptionsIn, productTypeId : productTypeId, productCode : productCode, startIndex : startIndex, pageSize : pageSize, sortBy : sortBy, filter : filter, dataViewMode: dataViewMode, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<ProductVariationPagedCollection/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ProductAdmin.ProductVariationPagedCollection GenerateProductVariations(ServiceClientMessageHandler handler,
List<Mozu.Api.Contracts.ProductAdmin.ProductOption> productOptionsIn, int productTypeId, string productCode = null, int? startIndex = null, int? pageSize = null, string sortBy = null, string filter = null, DataViewMode dataViewMode= DataViewMode.Live,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Admin.Attributedefinition.Producttypes.ProductTypeVariationClient.GenerateProductVariationsClient(
productOptionsIn : productOptionsIn, productTypeId : productTypeId, productCode : productCode, startIndex : startIndex, pageSize : pageSize, sortBy : sortBy, filter : filter, dataViewMode: dataViewMode );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例9: CreatePackageShipments
/// <summary>
/// Creates a shipment from one or more packages associated with a return replacement.
/// <example>
/// <code>
/// var result = ShipmentFactory.CreatePackageShipments(handler : handler, packageIds : packageIds, returnId : returnId, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<List<Package>/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static List<Mozu.Api.Contracts.CommerceRuntime.Fulfillment.Package> CreatePackageShipments(ServiceClientMessageHandler handler,
List<string> packageIds, string returnId,
HttpStatusCode expectedCode = HttpStatusCode.Created, HttpStatusCode successCode = HttpStatusCode.Created)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Returns.ShipmentClient.CreatePackageShipmentsClient(
packageIds : packageIds, returnId : returnId );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例10: RefreshDeveloperAuthTicket
/// <summary>
/// Generates a new developer account authentication ticket for the specified tenant by supplying the defined refresh token information.
/// <example>
/// <code>
/// var result = PublicDeveloperAdminAuthTicketFactory.RefreshDeveloperAuthTicket(handler : handler, existingAuthTicket : existingAuthTicket, developerAccountId : developerAccountId, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<DeveloperAdminUserAuthTicket/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.AdminUser.DeveloperAdminUserAuthTicket RefreshDeveloperAuthTicket(ServiceClientMessageHandler handler,
Mozu.Api.Contracts.AdminUser.DeveloperAdminUserAuthTicket existingAuthTicket, int? developerAccountId = null, string responseFields = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Platform.Developer.DeveloperAdminUserAuthTicketClient.RefreshDeveloperAuthTicketClient(
existingAuthTicket : existingAuthTicket, developerAccountId : developerAccountId, responseFields : responseFields );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例11: Suggest
/// <summary>
/// Suggests possible search terms as the shopper enters search text.
/// <example>
/// <code>
/// var result = ProductSearchResultFactory.Suggest(handler : handler, query : query, groups : groups, pageSize : pageSize, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<SearchSuggestionResult/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ProductRuntime.SearchSuggestionResult Suggest(ServiceClientMessageHandler handler,
string query = null, string groups = null, int? pageSize = null, string responseFields = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Storefront.ProductSearchResultClient.SuggestClient(
query : query, groups : groups, pageSize : pageSize, responseFields : responseFields );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例12: UpdateApplication
/// <summary>
///
/// <example>
/// <code>
/// var result = ApplicationFactory.UpdateApplication(handler : handler, application : application, appId : appId, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<Application/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.InstalledApplications.Application UpdateApplication(ServiceClientMessageHandler handler,
Mozu.Api.Contracts.InstalledApplications.Application application, string appId,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Platform.ApplicationClient.UpdateApplicationClient(
application : application, appId : appId );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例13: GetDeliveryAttemptSummary
/// <summary>
///
/// <example>
/// <code>
/// var result = EventDeliverySummaryFactory.GetDeliveryAttemptSummary(handler : handler, subscriptionId : subscriptionId, id : id, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<EventDeliverySummary/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.Event.EventDeliverySummary GetDeliveryAttemptSummary(ServiceClientMessageHandler handler,
string subscriptionId, int? id = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Event.Push.Subscriptions.EventDeliverySummaryClient.GetDeliveryAttemptSummaryClient(
subscriptionId : subscriptionId, id : id );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例14: GetProductInventory
/// <summary>
/// Retrieves the active inventory level information associated with the product or location specified in the request.
/// <example>
/// <code>
/// var result = ProductFactory.GetProductInventory(handler : handler, productCode : productCode, locationCodes : locationCodes, responseFields : responseFields, dataViewMode: dataViewMode, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<LocationInventoryCollection/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ProductRuntime.LocationInventoryCollection GetProductInventory(ServiceClientMessageHandler handler,
string productCode, string locationCodes = null, string responseFields = null, DataViewMode dataViewMode= DataViewMode.Live,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Storefront.ProductClient.GetProductInventoryClient(
productCode : productCode, locationCodes : locationCodes, responseFields : responseFields, dataViewMode: dataViewMode );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}
示例15: Search
/// <summary>
/// Searches the categories displayed on the web storefront for products or product options that the shopper types in a search query.
/// <example>
/// <code>
/// var result = ProductSearchResultFactory.Search(handler : handler, query : query, filter : filter, facetTemplate : facetTemplate, facetTemplateSubset : facetTemplateSubset, facet : facet, facetFieldRangeQuery : facetFieldRangeQuery, facetHierPrefix : facetHierPrefix, facetHierValue : facetHierValue, facetHierDepth : facetHierDepth, facetStartIndex : facetStartIndex, facetPageSize : facetPageSize, facetSettings : facetSettings, facetValueFilter : facetValueFilter, sortBy : sortBy, pageSize : pageSize, startIndex : startIndex, searchSettings : searchSettings, enableSearchTuningRules : enableSearchTuningRules, searchTuningRuleContext : searchTuningRuleContext, searchTuningRuleCode : searchTuningRuleCode, facetTemplateExclude : facetTemplateExclude, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode);
/// var optionalCasting = ConvertClass<ProductSearchResult/>(result);
/// return optionalCasting;
/// </code>
/// </example>
/// </summary>
public static Mozu.Api.Contracts.ProductRuntime.ProductSearchResult Search(ServiceClientMessageHandler handler,
string query = null, string filter = null, string facetTemplate = null, string facetTemplateSubset = null, string facet = null, string facetFieldRangeQuery = null, string facetHierPrefix = null, string facetHierValue = null, string facetHierDepth = null, string facetStartIndex = null, string facetPageSize = null, string facetSettings = null, string facetValueFilter = null, string sortBy = null, int? pageSize = null, int? startIndex = null, string searchSettings = null, bool? enableSearchTuningRules = null, string searchTuningRuleContext = null, string searchTuningRuleCode = null, string facetTemplateExclude = null, string responseFields = null,
HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
{
SetSdKparameters();
var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Debug.WriteLine(currentMethodName + '.' + currentMethodName );
var apiClient = Mozu.Api.Clients.Commerce.Catalog.Storefront.ProductSearchResultClient.SearchClient(
query : query, filter : filter, facetTemplate : facetTemplate, facetTemplateSubset : facetTemplateSubset, facet : facet, facetFieldRangeQuery : facetFieldRangeQuery, facetHierPrefix : facetHierPrefix, facetHierValue : facetHierValue, facetHierDepth : facetHierDepth, facetStartIndex : facetStartIndex, facetPageSize : facetPageSize, facetSettings : facetSettings, facetValueFilter : facetValueFilter, sortBy : sortBy, pageSize : pageSize, startIndex : startIndex, searchSettings : searchSettings, enableSearchTuningRules : enableSearchTuningRules, searchTuningRuleContext : searchTuningRuleContext, searchTuningRuleCode : searchTuningRuleCode, facetTemplateExclude : facetTemplateExclude, responseFields : responseFields );
try
{
apiClient.WithContext(handler.ApiContext).Execute();
}
catch (ApiException ex)
{
// Custom error handling for test cases can be placed here
Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
if (customException != null)
throw customException;
return null;
}
return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
? (apiClient.Result())
: null;
}