Repository: VirtoCommerce/vc-storefront Branch: dev Commit: 5242024b5236 Files: 451 Total size: 4.0 MB Directory structure: gitextract_go6x876s/ ├── .deployment/ │ └── storefront-app/ │ └── argoDeploy.json ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE.md │ ├── pull_request_template.md │ └── workflows/ │ ├── deploy.yml │ ├── main.yml │ ├── msteams.yml │ ├── pr-ci.yml │ ├── pr-deploy.yml │ ├── release-branch.yml │ └── release.yml ├── .gitignore ├── .nuke ├── CONTRIBUTING.md ├── Directory.Build.props ├── LICENSE ├── README.md ├── VirtoCommerce.LiquidThemeEngine/ │ ├── Converters/ │ │ └── CountryConverter.cs │ ├── Exceptions/ │ │ └── SaasCompileException.cs │ ├── Extensions/ │ │ ├── GraphQLResponseExtensions.cs │ │ ├── StringExtensions.cs │ │ └── UriExtensions.cs │ ├── Filters/ │ │ ├── ArrayFilters.cs │ │ ├── CommerceFilters.cs │ │ ├── CommonFilters.cs │ │ ├── DynamicDataSourceFilters.cs │ │ ├── FeatureFilter.cs │ │ ├── HtmlFilters.cs │ │ ├── MathFilters.cs │ │ ├── MoneyFilters.cs │ │ ├── StandardFilters.cs │ │ ├── StringFilters.cs │ │ ├── TranslationFilter.cs │ │ └── UrlFilters.cs │ ├── ILiquidThemeEngine.cs │ ├── ILiquidViewEngine.cs │ ├── ISassFileManager.cs │ ├── JsonConverters/ │ │ └── MutablePagedListAsArrayJsonConverter.cs │ ├── LiquidThemeEngineOptions.cs │ ├── LiquidThemedView.cs │ ├── LiquidThemedViewEngine.cs │ ├── Objects/ │ │ ├── Paginate.cs │ │ └── Part.cs │ ├── SassFileManager.cs │ ├── Scriban/ │ │ └── WorkContextConverter.cs │ ├── SettingsManager.cs │ ├── ShopifyLiquidThemeEngine.cs │ ├── ThemeEngineCacheRegion.cs │ └── VirtoCommerce.LiquidThemeEngine.csproj ├── VirtoCommerce.Storefront/ │ ├── .bowerrc │ ├── AutoRestClients/ │ │ ├── !readme.txt │ │ ├── CatalogModuleApi.cs │ │ ├── ContentModuleApi.cs │ │ ├── CoreModuleApi.cs │ │ ├── CustomerModuleApi.cs │ │ ├── NotificationsModuleApi.cs │ │ ├── PlatformModuleApi.cs │ │ ├── SitemapsModuleApi.cs │ │ ├── StoreModuleApi.cs │ │ └── array-in-query-fix.yml │ ├── Caching/ │ │ ├── Redis/ │ │ │ ├── RedisCachingMessage.cs │ │ │ ├── RedisCachingOptions.cs │ │ │ └── RedisStorefrontMemoryCache.cs │ │ ├── ServiceCollectionExtensions.cs │ │ └── StorefrontMemoryCache.cs │ ├── Connected Services/ │ │ └── Application Insights/ │ │ └── ConnectedService.json │ ├── Controllers/ │ │ ├── AccountController.cs │ │ ├── Api/ │ │ │ ├── ApiAccountController.cs │ │ │ ├── ApiBlogController.cs │ │ │ ├── ApiCommonController.cs │ │ │ ├── ApiStaticContentController.cs │ │ │ └── ApiThemeController.cs │ │ ├── AssetController.cs │ │ ├── CommonController.cs │ │ ├── DesignerPreviewController.cs │ │ ├── ErrorController.cs │ │ ├── HomeController.cs │ │ ├── SitemapController.cs │ │ └── StorefrontControllerBase.cs │ ├── DependencyInjection/ │ │ └── ServiceCollectionExtension.cs │ ├── Domain/ │ │ ├── Common/ │ │ │ ├── AddressConverter.cs │ │ │ ├── ContactUsFormConverter.cs │ │ │ ├── CurrencyConverter.cs │ │ │ ├── DynamicPropertyConverter.cs │ │ │ ├── NotificationConverter.cs │ │ │ ├── SeoInfoConverter.cs │ │ │ ├── SettingConverter.cs │ │ │ └── ToolsConverter.cs │ │ ├── ContentBlobProviders/ │ │ │ ├── AzureBlobContentOptions.cs │ │ │ ├── AzureBlobContentProvider.cs │ │ │ ├── BlobConnectionString.cs │ │ │ ├── ContentBlobCacheRegion.cs │ │ │ ├── FileSystemBlobContentOptions.cs │ │ │ └── FileSystemContentBlobProvider.cs │ │ ├── Countries/ │ │ │ ├── CountriesWorkContextBuilderExtensions.cs │ │ │ ├── FileSystemCountriesOptions.cs │ │ │ └── FileSystemCountriesService.cs │ │ ├── CurrencyService.cs │ │ ├── Customer/ │ │ │ ├── CutomerCacheRegion.cs │ │ │ ├── Handlers/ │ │ │ │ └── SecurityEventsHandler.cs │ │ │ ├── MemberConverter.cs │ │ │ └── MemberService.cs │ │ ├── IWorkContextBuilder.cs │ │ ├── Security/ │ │ │ ├── AnonymousUserForStoreAuthorizationRequirement.cs │ │ │ ├── CanEditOrganizationResourceAuthorizationHandler.cs │ │ │ ├── CanImpersonateAuthorizationHandler.cs │ │ │ ├── CanReadContentItemAuthorizationHandler.cs │ │ │ ├── CustomCookieAuthenticationEvents.cs │ │ │ ├── CustomSignInManager.cs │ │ │ ├── CustomUserManager.cs │ │ │ ├── Notifications/ │ │ │ │ ├── ChangePhoneNumberSmsNotification.cs │ │ │ │ ├── EmailConfirmationNotification.cs │ │ │ │ ├── RegistrationEmailNotification.cs │ │ │ │ ├── RegistrationInvitationNotification.cs │ │ │ │ ├── RemindUserNameNotification.cs │ │ │ │ ├── ResetPasswordEmailNotification.cs │ │ │ │ ├── ResetPasswordSmsNotification.cs │ │ │ │ ├── TwoFactorEmailNotification.cs │ │ │ │ └── TwoFactorSmsNotification.cs │ │ │ ├── OnlyRegisteredUserAuthorizationHandler.cs │ │ │ ├── PermissionAuthorizationHandler.cs │ │ │ ├── PermissionAuthorizationPolicyProvider.cs │ │ │ ├── PermissionAuthorizationRequirement.cs │ │ │ ├── PollingApiUserChangeToken.cs │ │ │ ├── SecurityCacheRegion.cs │ │ │ ├── SecurityConverter.cs │ │ │ ├── SecurityWorkContextBuilderExtensions.cs │ │ │ └── UserStoreStub.cs │ │ ├── SeoInfoService.cs │ │ ├── SpaRouteService.cs │ │ ├── StaticContent/ │ │ │ ├── LinkListConverter.cs │ │ │ ├── LinkListServiceImpl.cs │ │ │ ├── MarkdownContentLoader.cs │ │ │ ├── PageBuilderContentLoader.cs │ │ │ ├── StaticContentCacheRegion.cs │ │ │ ├── StaticContentItemFactory.cs │ │ │ ├── StaticContentLoader.cs │ │ │ ├── StaticContentLoaderFactory.cs │ │ │ ├── StaticContentService.cs │ │ │ └── StaticContentWorkContextBuilderExtensions.cs │ │ ├── Stores/ │ │ │ ├── SelectCurrentCurrencyPolicy.cs │ │ │ ├── SelectCurrentLanguagePolicy.cs │ │ │ ├── SelectCurrentStorePolicy.cs │ │ │ ├── StoreCacheRegion.cs │ │ │ ├── StoreConverter.cs │ │ │ ├── StoreService.cs │ │ │ └── StoreWorkContextBuilderExtensions.cs │ │ ├── WorkContextAccessor.cs │ │ └── WorkContextBuilder.cs │ ├── Extensions/ │ │ ├── ClaimsPrincipalExtensions.cs │ │ ├── HostingEnviromentExtension.cs │ │ ├── ObjectExtensions.cs │ │ ├── PathStringExtensions.cs │ │ ├── QueryCollectionExtensions.cs │ │ └── SeoExtensions.cs │ ├── Filters/ │ │ ├── AngularAntiforgeryCookieResultFilterAttribute.cs │ │ └── AnonymousUserForStoreAuthorizationFilter.cs │ ├── IISUrlRewrite.xml │ ├── Infrastructure/ │ │ ├── ApiAuthMode.cs │ │ ├── ApiChangesWatcher.cs │ │ ├── ApplicationInsights/ │ │ │ ├── ServiceCollectionExtension.cs │ │ │ ├── SnapshotCollectorTelemetryProcessorFactory.cs │ │ │ └── UserTelemetryInitializer.cs │ │ ├── Autorest/ │ │ │ ├── ApiKeySecretAuthHandler.cs │ │ │ ├── AuthenticationHandlerFactory.cs │ │ │ ├── BaseAuthHandler.cs │ │ │ ├── ClientCredentialsAuthHandler.cs │ │ │ ├── EmptyServiceClientCredentials.cs │ │ │ └── UserPasswordAuthHandler.cs │ │ ├── BlobChangeToken.cs │ │ ├── BlobChangesWatcher.cs │ │ ├── Exceptions/ │ │ │ ├── NoStoresException.cs │ │ │ └── NoThemeException.cs │ │ ├── HealthCheck/ │ │ │ └── PlatformConnectionHealthChecker.cs │ │ ├── HmacUtility.cs │ │ ├── IApiChangesWatcher.cs │ │ ├── IBlobChangesWatcher.cs │ │ ├── PlatformEndpointOptions.cs │ │ ├── PollingApiChangeToken.cs │ │ ├── RequireHttpsOptions.cs │ │ ├── StorefrontOptions.cs │ │ ├── StorefrontUrlBuilder.cs │ │ └── Swagger/ │ │ ├── ApiExplorerApiControllersConvention.cs │ │ ├── ArrayInQueryParametersFilter.cs │ │ ├── AuthResponsesOperationFilter.cs │ │ ├── ConsumeFromBodyFilter.cs │ │ ├── EnumSchemaFilter.cs │ │ ├── FileResponseTypeFilter.cs │ │ ├── FileUploadOperationFilter.cs │ │ ├── NewtonsoftJsonIgnoreFilter.cs │ │ ├── OptionalParametersFilter.cs │ │ ├── SwaggerFileResponseAttribute.cs │ │ ├── SwaggerOptionalAttribute.cs │ │ └── UploadFileAttribute.cs │ ├── Middleware/ │ │ ├── NoLiquidThemeMiddleware.cs │ │ ├── StoreMaintenanceMiddleware.cs │ │ └── WorkContextBuildMiddleware.cs │ ├── Models/ │ │ ├── NoThemeViewModel.cs │ │ └── ResetCacheModel.cs │ ├── Program.cs │ ├── Properties/ │ │ └── launchSettings.json │ ├── Routing/ │ │ ├── ISlugRouteService.cs │ │ ├── MapStorefrontRouteBuilderExtension.cs │ │ ├── RoutingCacheRegion.cs │ │ ├── SlugRoute.cs │ │ ├── SlugRouteResponse.cs │ │ ├── SlugRouteService.cs │ │ ├── StorefrontApiRouteAttribute.cs │ │ ├── StorefrontRoute.cs │ │ └── StorefrontRouteAttribute.cs │ ├── Startup.cs │ ├── Views/ │ │ ├── Common/ │ │ │ ├── Maintenance.cshtml │ │ │ └── NoTheme.cshtml │ │ ├── Error/ │ │ │ ├── 404.cshtml │ │ │ ├── 500.cshtml │ │ │ ├── AccessDenied.cshtml │ │ │ ├── Error.cshtml │ │ │ └── NoStore.cshtml │ │ ├── Shared/ │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── VirtoCommerce.Storefront.csproj │ ├── appsettings.Development.json │ ├── appsettings.Production.json │ ├── appsettings.json │ ├── bower.json │ ├── bundleconfig.json │ ├── bundleconfig.json.bindings │ ├── web.config │ └── wwwroot/ │ ├── countries.json │ ├── css/ │ │ └── site.css │ ├── js/ │ │ └── site.js │ └── lib/ │ ├── bootstrap/ │ │ ├── .bower.json │ │ ├── LICENSE │ │ └── dist/ │ │ ├── css/ │ │ │ ├── bootstrap-theme.css │ │ │ └── bootstrap.css │ │ └── js/ │ │ ├── bootstrap.js │ │ └── npm.js │ ├── jquery/ │ │ ├── .bower.json │ │ ├── LICENSE.txt │ │ └── dist/ │ │ └── jquery.js │ ├── jquery-validation/ │ │ ├── .bower.json │ │ ├── LICENSE.md │ │ └── dist/ │ │ ├── additional-methods.js │ │ └── jquery.validate.js │ └── jquery-validation-unobtrusive/ │ ├── .bower.json │ └── jquery.validate.unobtrusive.js ├── VirtoCommerce.Storefront.Model/ │ ├── Address.cs │ ├── AddressType.cs │ ├── AmountType.cs │ ├── Attachment.cs │ ├── BankCardInfo.cs │ ├── Caching/ │ │ └── IStorefrontMemoryCache.cs │ ├── Common/ │ │ ├── AnonymousComparer.cs │ │ ├── ArrayExtensions.cs │ │ ├── AsyncLock.cs │ │ ├── Breadcrumb.cs │ │ ├── Bus/ │ │ │ ├── IHandlerRegistrar.cs │ │ │ └── InProcessBus.cs │ │ ├── Caching/ │ │ │ ├── CacheCancellableTokensRegistry.cs │ │ │ ├── CacheKey.cs │ │ │ ├── CancellableCacheRegion.cs │ │ │ ├── GlobalCacheRegion.cs │ │ │ ├── ICacheKey.cs │ │ │ ├── MemoryCacheExtensions.cs │ │ │ └── TokenCancelledEventArgs.cs │ │ ├── CollectionExtensions.cs │ │ ├── DefaultableDictionary.cs │ │ ├── DynamicPropertyExtension.cs │ │ ├── EmptyDisposable.cs │ │ ├── Entity.cs │ │ ├── EntryState.cs │ │ ├── EnumUtility.cs │ │ ├── EnumerableExtension.cs │ │ ├── EventThrottlingExtensions.cs │ │ ├── Events/ │ │ │ ├── DomainEvent.cs │ │ │ ├── ICancellableEventHandler.cs │ │ │ ├── IEvent.cs │ │ │ ├── IEventHandler.cs │ │ │ └── IEventPublisher.cs │ │ ├── Exceptions/ │ │ │ └── StorefrontException.cs │ │ ├── GenericSearchResult.cs │ │ ├── GeoPoint.cs │ │ ├── IAccessibleByIndexKey.cs │ │ ├── IEntity.cs │ │ ├── IHasBreadcrumbs.cs │ │ ├── IHasQueryKeyValues.cs │ │ ├── IMutablePagedList.cs │ │ ├── IQueryableExtensions.cs │ │ ├── IStorefrontUrlBuilder.cs │ │ ├── IValueObject.cs │ │ ├── LocalizationExtensions.cs │ │ ├── Messages/ │ │ │ ├── ICancellableHandler.cs │ │ │ ├── IHandler.cs │ │ │ └── IMessage.cs │ │ ├── Money/ │ │ │ ├── Currency.cs │ │ │ ├── IConvertible.cs │ │ │ └── Money.cs │ │ ├── MutablePagedList.cs │ │ ├── MutablePagedListExtensions.cs │ │ ├── Notifications/ │ │ │ ├── EmailNotificationBase.cs │ │ │ ├── NotificationBase.cs │ │ │ └── SmsNotificationBase.cs │ │ ├── NumericRange.cs │ │ ├── ObjectExtensions.cs │ │ ├── PagedSearchCriteria.cs │ │ ├── PathUtils.cs │ │ ├── ReflectionExtension.cs │ │ ├── SettingsExtension.cs │ │ ├── SortInfo.cs │ │ ├── Specifications/ │ │ │ └── ISpecification.cs │ │ ├── StreamExtensions.cs │ │ ├── StringExtensions.cs │ │ ├── TreeNode.cs │ │ ├── TypeExtensions.cs │ │ └── ValueObject.cs │ ├── ContactForm.cs │ ├── Country.cs │ ├── CountryRegion.cs │ ├── Customer/ │ │ ├── Contact.cs │ │ ├── Member.cs │ │ ├── Organization.cs │ │ ├── OrganizationContactsSearchCriteria.cs │ │ ├── SecurityAccount.cs │ │ └── Services/ │ │ └── IMemberService.cs │ ├── DynamicProperty.cs │ ├── DynamicPropertyDictionaryItem.cs │ ├── DynamicPropertyName.cs │ ├── EditorialReview.cs │ ├── Features/ │ │ ├── Exceptions/ │ │ │ └── FeaturesException.cs │ │ ├── Feature.cs │ │ ├── FeatureExtensions.cs │ │ ├── FeaturesAgent.cs │ │ └── IFeaturesAgent.cs │ ├── Form.cs │ ├── FormError.cs │ ├── ICountriesService.cs │ ├── ICurrencyService.cs │ ├── IHasLanguage.cs │ ├── IHasSettings.cs │ ├── ISeoInfoService.cs │ ├── ISpaRouteService.cs │ ├── IWorkContextAccessor.cs │ ├── Image.cs │ ├── Interaction/ │ │ ├── Client.cs │ │ ├── Page.cs │ │ ├── UserEvent.cs │ │ └── UserSession.cs │ ├── Language.cs │ ├── LinkList/ │ │ ├── CategoryMenuLink.cs │ │ ├── MenuLink.cs │ │ ├── MenuLinkList.cs │ │ ├── ProductMenuLink.cs │ │ └── Services/ │ │ └── ILinkListService.cs │ ├── LocalizedString.cs │ ├── LoginProvider.cs │ ├── Security/ │ │ ├── AccountState.cs │ │ ├── ChangePassword.cs │ │ ├── ChangeTwoFactorAuthenticationModel.cs │ │ ├── ChangeTwoFactorAuthenticationResult.cs │ │ ├── ConfirmEmailModel.cs │ │ ├── CustomSignInResult.cs │ │ ├── Events/ │ │ │ ├── UserDeletedEvent.cs │ │ │ ├── UserLoginEvent.cs │ │ │ └── UserRegisteredEvent.cs │ │ ├── ExternalUserLoginInfo.cs │ │ ├── ForgotPassword.cs │ │ ├── ForgotPasswordModel.cs │ │ ├── Login.cs │ │ ├── OrganizationRegistration.cs │ │ ├── OrganizationUserRegistration.cs │ │ ├── PasswordChangeResult.cs │ │ ├── RemovePhoneNumberResult.cs │ │ ├── ResetPassword.cs │ │ ├── ResetPasswordByCodeModel.cs │ │ ├── ResetPasswordModel.cs │ │ ├── Role.cs │ │ ├── SecurityConstants.cs │ │ ├── SecurityErrorDescriber.cs │ │ ├── Specifications/ │ │ │ ├── CanUserLoginToStoreSpecification.cs │ │ │ ├── IsUserLockedByRequiredEmailVerificationSpecification.cs │ │ │ ├── IsUserLockedOutSpecification.cs │ │ │ ├── IsUserPasswordExpiredSpecification.cs │ │ │ ├── IsUserSuspendedSpecification.cs │ │ │ └── IsUserTemporaryLockedOutSpecification.cs │ │ ├── UpdatePhoneNumberModel.cs │ │ ├── UpdatePhoneNumberResult.cs │ │ ├── User.cs │ │ ├── UserActionIdentityResult.cs │ │ ├── UserRegistration.cs │ │ ├── UserRegistrationByInvitation.cs │ │ ├── UserSearchResult.cs │ │ ├── UserUpdateInfo.cs │ │ ├── UsersInvitation.cs │ │ ├── ValidateTokenModel.cs │ │ ├── VerifyCodeViewModel.cs │ │ └── VerifyPhoneNumberModel.cs │ ├── SeoInfo.cs │ ├── SeoLinksType.cs │ ├── SettingEntry.cs │ ├── SlugInfoRequest.cs │ ├── SlugInfoResult.cs │ ├── SlugRoutingData.cs │ ├── SpaThemeContext.cs │ ├── StaticContent/ │ │ ├── Blog.cs │ │ ├── BlogArticle.cs │ │ ├── BlogSearchCriteria.cs │ │ ├── ContentInThemeSearchCriteria.cs │ │ ├── ContentItem.cs │ │ ├── ContentPage.cs │ │ ├── IContentBlobProvider.cs │ │ ├── IStaticContentItemFactory.cs │ │ ├── IStaticContentLoader.cs │ │ ├── IStaticContentLoaderFactory.cs │ │ ├── IStaticContentService.cs │ │ └── StaticContentSearchCriteria.cs │ ├── StorefrontNotification.cs │ ├── StorefrontNotificationType.cs │ ├── Stores/ │ │ ├── IStoreService.cs │ │ ├── Store.cs │ │ └── StoreStatus.cs │ ├── SwaggerCustomSchemaIdAttribute.cs │ ├── Term.cs │ ├── TermExtensions.cs │ ├── VirtoCommerce.Storefront.Model.csproj │ └── WorkContext.cs ├── VirtoCommerce.Storefront.Tests/ │ ├── Features/ │ │ ├── CustomServiceCollection.cs │ │ ├── FeaturesAgentTests.cs │ │ └── Samples/ │ │ ├── empty_data.json │ │ ├── empty_file.json │ │ ├── full_data.json │ │ ├── full_data_with_conflicts.json │ │ ├── full_data_with_disabled_feature.json │ │ ├── full_data_without_replaces.json │ │ └── test_data.json │ ├── JsonConverterTests.cs │ ├── LiquidThemeEngine/ │ │ └── ShopifyLiquidThemeEngineTests.cs │ ├── Model/ │ │ └── MoneyOperationTests.cs │ ├── ResponseCaching/ │ │ └── ResponseCachingTests.cs │ ├── Routing/ │ │ ├── Infrastructure/ │ │ │ ├── DummyAntiforgery.cs │ │ │ ├── RoutingDataResult.cs │ │ │ └── RoutingTestingActionFilter.cs │ │ └── PathStringExtensionsTests.cs │ ├── Scriban/ │ │ ├── ScribanTests.cs │ │ └── test.liquid │ ├── ValueObjectTests.cs │ └── VirtoCommerce.Storefront.Tests.csproj ├── VirtoCommerce.Storefront.sln └── azuredeploy.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .deployment/storefront-app/argoDeploy.json ================================================ { "artifactKey": "docker.pkg.github.com/virtocommerce/vc-storefront/storefront", "deployRepo": "vc-deploy-dev", "cmPath": "storefront-app/resources/kustomization.yaml", "dev": { "deployAppName": "storefront-dev", "deployBranch": "dev", "environmentId" : "dev", "environmentName" : "Development", "environmentType" : "staging", "environmentUrl" : "https://st-storefront.dev.govirto.com/" }, "qa": { "deployAppName": "storefront-qa", "deployBranch": "qa", "environmentId" : "qa", "environmentName" : "QA", "environmentType" : "testing", "environmentUrl" : "https://st-storefront.qa.govirto.com/" }, "prod": { "deployAppName": "storefront-demo", "deployBranch": "demo", "environmentId" : "demo", "environmentName" : "Demo", "environmentType" : "production", "environmentUrl" : "https://st-storefront.demo.govirto.com/" } } ================================================ FILE: .editorconfig ================================================ root = true [*] charset = utf-8 indent_style = space indent_size = 4 end_of_line = crlf trim_trailing_whitespace = true insert_final_newline = true # Project files [*.csproj] indent_size = 2 # JSON files [*.json] indent_size = 2 # Dotnet code style settings [*.{cs,vb}] # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true # Avoid "this." and "Me." if not necessary dotnet_style_qualification_for_field = false:suggestion dotnet_style_qualification_for_property = false:suggestion dotnet_style_qualification_for_method = false:suggestion dotnet_style_qualification_for_event = false:suggestion # Use language keywords instead of framework type names for type references dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion dotnet_style_predefined_type_for_member_access = true:suggestion # Use explicit accessibility modifiers dotnet_style_require_accessibility_modifiers = true:suggestion # Suggest more modern language features when available dotnet_style_object_initializer = true:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion dotnet_style_explicit_tuple_names = true:suggestion dotnet_prefer_inferred_tuple_names = true:suggestion dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion # CSharp code style settings [*.cs] # Prefer curly braces even for one line of code csharp_prefer_braces = true:suggestion # Prefer "var" everywhere csharp_style_var_for_built_in_types = true:suggestion csharp_style_var_when_type_is_apparent = true:suggestion csharp_style_var_elsewhere = true:suggestion # Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = false:none csharp_style_expression_bodied_constructors = false:none csharp_style_expression_bodied_operators = false:none # Prefer property-like constructs to have an expression-body csharp_style_expression_bodied_properties = true:none csharp_style_expression_bodied_indexers = true:none csharp_style_expression_bodied_accessors = true:none # Suggest more modern language features when available csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_inlined_variable_declaration = true:suggestion csharp_style_throw_expression = true:suggestion csharp_style_conditional_delegate_call = true:suggestion csharp_prefer_simple_default_expression = true:suggestion csharp_style_deconstructed_variable_declaration = true:suggestion csharp_style_pattern_local_over_anonymous_function = true:suggestion # Newline settings csharp_new_line_before_open_brace = all csharp_new_line_before_else = true csharp_new_line_before_catch = true csharp_new_line_before_finally = true csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_between_query_expression_clauses = true csharp_indent_case_contents = true csharp_indent_switch_labels = true csharp_indent_labels = flush_left csharp_space_after_cast = false csharp_space_after_keywords_in_control_flow_statements = true csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_method_call_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_preserve_single_line_statements = false csharp_preserve_single_line_blocks = true ================================================ FILE: .gitattributes ================================================ ############################################################################### # Set default behavior to automatically normalize line endings. ############################################################################### * text=auto *.bat text eol=crlf *.cmd text eol=crlf *.config text eol=crlf ############################################################################### # Set default behavior for command prompt diff. # # This is need for earlier builds of msysgit that does not have it on by # default for csharp files. # Note: This is only used by command line ############################################################################### #*.cs diff=csharp ############################################################################### # Set the merge driver for project and solution files # # Merging from the command prompt will add diff markers to the files if there # are conflicts (Merging from VS is not affected by the settings below, in VS # the diff markers are never inserted). Diff markers may cause the following # file extensions to fail to load in VS. An alternative would be to treat # these files as binary and thus will always conflict and require user # intervention with every merge. To do so, just uncomment the entries below ############################################################################### #*.sln merge=binary #*.csproj merge=binary #*.vbproj merge=binary #*.vcxproj merge=binary #*.vcproj merge=binary #*.dbproj merge=binary #*.fsproj merge=binary #*.lsproj merge=binary #*.wixproj merge=binary #*.modelproj merge=binary #*.sqlproj merge=binary #*.wwaproj merge=binary ############################################################################### # behavior for image files # # image files are treated as binary by default. ############################################################################### #*.jpg binary #*.png binary #*.gif binary ############################################################################### # diff behavior for common document formats # # Convert binary document formats to text before diffing them. This feature # is only available from the command line. Turn it on by uncommenting the # entries below. ############################################################################### #*.doc diff=astextplain #*.DOC diff=astextplain #*.docx diff=astextplain #*.DOCX diff=astextplain #*.dot diff=astextplain #*.DOT diff=astextplain #*.pdf diff=astextplain #*.PDF diff=astextplain #*.rtf diff=astextplain #*.RTF diff=astextplain ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ Please provide detailed information about your issue, thank you! Version info: - Browser version: - Platform version: - Storefront version: ### Expected behavior ### Actual behavior ### Steps to reproduce 1. 2. 3. ================================================ FILE: .github/pull_request_template.md ================================================ Description: -- QA-test: Demo-test: Download artifact URL: ================================================ FILE: .github/workflows/deploy.yml ================================================ # v1.3.0 name: VC deployment on: workflow_dispatch: inputs: artifactUrl: description: 'Full link to artifact docker image or artifact download url' required: true deployEnvironment: description: 'Deployment environment type. Allowed values: dev, qa, prod' required: true default: 'dev' deployConfigPath: description: 'Full path to argoDeploy.json' required: true default: 'argoDeploy.json' jiraKeys: description: 'Deployed artifact Jira keys (for cycle time report)' required: false default: '' jobs: cd: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}} CLIENT_ID: ${{secrets.CLIENT_ID}} CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} SLEEP_TIME: '5m' ARGO_SERVER: 'argo.govirto.com' steps: - name: Install vc-build run: | dotnet tool install --global VirtoCommerce.GlobalTool - name: Set Output id: app-name run: | if [ ${{ github.ref }} == 'refs/heads/master' ]; then echo "IS master branch" echo "APP=vcptcore-qa" >> $GITHUB_OUTPUT elif [ ${{ github.ref }} == 'refs/heads/dev' ]; then echo "IS dev branch" echo "APP=vcst-dev" >> $GITHUB_OUTPUT fi - name: Read deployment config uses: VirtoCommerce/vc-github-actions/get-deploy-param@master id: deployConfig with: envName: ${{ github.event.inputs.deployEnvironment }} deployConfigPath: ${{ github.event.inputs.deployConfigPath }} - name: Start deployment uses: VirtoCommerce/vc-github-actions/gh-deployments@master id: deployment with: step: start token: ${{ secrets.GITHUB_TOKEN }} env: ${{ steps.deployConfig.outputs.environmentName }} no_override: false - name: Update vcptcore-qa environment if: ${{ github.ref == 'refs/heads/master' }} run: | vc-build CloudEnvSetParameter -EnvironmentName ${{ steps.app-name.outputs.APP }} -CloudToken ${{ secrets.VCPTCORE_PLATFORM_TOKEN }} -HelmParameters storefront.image.tag=${{ github.event.inputs.artifactUrl }} - name: Update vcst-dev environment if: ${{ github.ref == 'refs/heads/dev' }} run: | vc-build CloudEnvSetParameter -EnvironmentName ${{ steps.app-name.outputs.APP }} -CloudToken ${{ secrets.VCST_PLATFORM_TOKEN }} -HelmParameters storefront.image.tag=${{ github.event.inputs.artifactUrl }} - name: DEPLOY_STATE::successful if: success() run: echo "DEPLOY_STATE=successful" >> $GITHUB_ENV - name: DEPLOY_STATE::failed if: failure() run: echo "DEPLOY_STATE=failed" >> $GITHUB_ENV - name: Update GitHub deployment status uses: VirtoCommerce/vc-github-actions/gh-deployments@master if: always() with: step: finish token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} deployment_id: ${{ steps.deployment.outputs.deployment_id }} - name: Push Deployment Info to Jira if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && github.event.inputs.jiraKeys != '' && always() }} id: push_deployment_info_to_jira uses: VirtoCommerce/jira-upload-deployment-info@master env: CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}} CLIENT_ID: ${{secrets.CLIENT_ID}} CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} with: cloud-instance-base-url: ${{ secrets.CLOUD_INSTANCE_BASE_URL }} client-id: ${{ secrets.CLIENT_ID }} client-secret: ${{ secrets.CLIENT_SECRET }} deployment-sequence-number: ${{ github.run_id }} update-sequence-number: ${{ github.run_id }} issue-keys: ${{ github.event.inputs.jiraKeys }} display-name: ${{ steps.deployConfig.outputs.deployAppName }} url: ${{ steps.deployConfig.outputs.environmentUrl }} description: 'Deployment to the ${{ steps.deployConfig.outputs.environmentName }} environment' last-updated: '${{github.event.head_commit.timestamp}}' state: '${{ env.DEPLOY_STATE }}' pipeline-id: '${{ github.repository }} ${{ github.workflow }}' pipeline-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})' pipeline-url: '${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}' environment-id: ${{ steps.deployConfig.outputs.environmentId }} environment-display-name: ${{ steps.deployConfig.outputs.environmentName }} environment-type: ${{ steps.deployConfig.outputs.environmentType }} ================================================ FILE: .github/workflows/main.yml ================================================ # v1.2.1 name: Storefront CI on: workflow_dispatch: inputs: forceLatest: description: "Flag to set dev-linux-latest flag on workflow_dispatch event. Allowed values true or false." required: false default: "false" push: paths-ignore: - '.github/**' - 'docs/**' - 'build/**' - 'README.md' - 'LICENSE' - '**/argoDeploy.json' branches: [ master, dev ] jobs: ci: if: ${{ github.actor != 'dependabot[bot]' && (github.event.pull_request.head.repo.full_name == github.repository || github.event.pull_request.head.repo.full_name == '') }} # Check that PR not from forked repo and not from Dependabot runs-on: ubuntu-latest env: CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}} CLIENT_ID: ${{secrets.CLIENT_ID}} CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} NUGET_KEY: ${{ secrets.NUGET_KEY }} BLOB_SAS: ${{ secrets.BLOB_TOKEN }} IMAGE_NAME: 'storefront' PACKAGE_SERVER: 'ghcr.io' PUBLISH_TO_DOCKER: 'true' UPDATE_LATEST_TAG: 'true' VERSION_SUFFIX: '' BUILD_STATE: 'failed' RELEASE_STATUS: 'false' BUILD_DOCKER: 'false' outputs: artifactUrl: ${{ steps.image.outputs.taggedVersion }} jira-keys: ${{ steps.jira_keys.outputs.jira-keys }} steps: - name: Set up Node 20 uses: actions/setup-node@v4 with: node-version: '20' - name: Set up Java 17 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' - name: Set variables if: ${{ github.event_name == 'workflow_dispatch' }} run: | echo "PUBLISH_TO_DOCKER=false" >> $GITHUB_ENV echo "UPDATE_LATEST_TAG=${{ github.event.inputs.forceLatest }}" >> $GITHUB_ENV - name: Set RELEASE_STATUS if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} run: | echo "RELEASE_STATUS=true" >> $GITHUB_ENV - name: Set BUILD_DOCKER if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-dockerenv' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }} run: | echo "BUILD_DOCKER=true" >> $GITHUB_ENV - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install VirtoCommerce.GlobalTool uses: VirtoCommerce/vc-github-actions/setup-vcbuild@master - name: Install dotnet-sonarscanner run: dotnet tool install --global dotnet-sonarscanner - name: Get Image Version uses: VirtoCommerce/vc-github-actions/get-image-version@master id: image - name: Get changelog id: changelog uses: VirtoCommerce/vc-github-actions/changelog-generator@master - name: Set VERSION_SUFFIX variable run: | if [ '${{ github.event_name }}' = 'workflow_dispatch' ]; then echo "VERSION_SUFFIX=${{ steps.image.outputs.fullSuffix }}" >> $GITHUB_ENV else echo "VERSION_SUFFIX=${{ steps.image.outputs.suffix }}" >> $GITHUB_ENV fi; - name: Add version suffix if: ${{ github.ref != 'refs/heads/master' }} uses: VirtoCommerce/vc-github-actions/add-version-suffix@master with: versionSuffix: ${{ env.VERSION_SUFFIX }} - name: SonarCloud Begin uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master - name: Build run: vc-build Compile - name: Unit Tests run: vc-build Test -TestsFilter "Category=Unit|Category=CI" -skip - name: BUILD_STATE::successful if: success() run: echo "BUILD_STATE=successful" >> $GITHUB_ENV - name: SonarCloud End uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@master - name: Quality Gate uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@master with: login: ${{secrets.SONAR_TOKEN}} - name: Packaging run: vc-build Compress -skip Clean+Restore+Compile+Test - name: Set artifactUrl value id: artifactUrl run: | echo "DOCKER_URL=${{ env.PACKAGE_SERVER }}/${{github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }}" >> $GITHUB_OUTPUT - name: Build Docker Image if: ${{ env.BUILD_DOCKER == 'true' }} id: dockerBuild uses: VirtoCommerce/vc-github-actions/build-docker-image@master with: tag: ${{ steps.image.outputs.taggedVersion }} imageName: ${{ env.IMAGE_NAME }} dockerFiles: 'https://raw.githubusercontent.com/VirtoCommerce/vc-docker/feat/net8/linux/storefront/Dockerfile' - name: Publish Github Release if: ${{ github.ref == 'refs/heads/master' }} with: changelog: ${{ steps.changelog.outputs.changelog }} uses: VirtoCommerce/vc-github-actions/publish-github-release@master - name: Docker Login if: ${{ env.BUILD_DOCKER == 'true' }} uses: docker/login-action@v3 with: registry: ${{ env.PACKAGE_SERVER }} username: $GITHUB_ACTOR password: ${{ secrets.GITHUB_TOKEN }} - name: Publish Docker Image if: ${{ env.BUILD_DOCKER == 'true' }} uses: VirtoCommerce/vc-github-actions/publish-docker-image@master with: image: ${{ steps.dockerBuild.outputs.imageName }} tag: ${{ steps.image.outputs.taggedVersion }} docker_user: ${{ secrets.DOCKER_USERNAME }} docker_token: ${{ secrets.DOCKER_TOKEN }} docker_hub: ${{ env.PUBLISH_TO_DOCKER }} update_latest: ${{ env.UPDATE_LATEST_TAG }} - name: Publish to SaaS ACR if: ${{ github.ref == 'refs/heads/master' }} run: | docker login virtopaasregistrymain.azurecr.io -u VirtoPaaSRegistryMain -p ${{secrets.ACR_PASSWORD}} docker tag ghcr.io/virtocommerce/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} virtopaasregistrymain.azurecr.io/saas/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} docker push virtopaasregistrymain.azurecr.io/saas/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} - name: Publish to ACR run: | docker login virtopaasregistrymain.azurecr.io -u vcst-token -p ${{ secrets.VCST_ACR_DOCKER_PASSWORD }} docker tag ghcr.io/virtocommerce/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} virtopaasregistrymain.azurecr.io/vcst/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} docker push virtopaasregistrymain.azurecr.io/vcst/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.taggedVersion }} - name: Add link to PR if: ${{ github.event_name == 'pull_request' }} uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master with: artifactUrl: ${{ steps.artifactUrl.outputs.DOCKER_URL }} - name: Parse Jira Keys from All Commits uses: VirtoCommerce/vc-github-actions/get-jira-keys@master if: always() id: jira_keys with: release: ${{ env.RELEASE_STATUS }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Push Build Info to Jira if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && steps.jira_keys.outputs.jira-keys != '' && always() }} id: push_build_info_to_jira uses: VirtoCommerce/jira-upload-build-info@master with: cloud-instance-base-url: '${{ secrets.CLOUD_INSTANCE_BASE_URL }}' client-id: '${{ secrets.CLIENT_ID }}' client-secret: '${{ secrets.CLIENT_SECRET }}' pipeline-id: '${{ github.repository }} ${{ github.workflow }}' build-number: ${{ github.run_number }} build-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})' build-state: '${{ env.BUILD_STATE }}' build-url: '${{github.event.repository.url}}/actions/runs/${{github.run_id}}' update-sequence-number: '${{ github.run_id }}' last-updated: '${{github.event.head_commit.timestamp}}' issue-keys: '${{ steps.jira_keys.outputs.jira-keys }}' commit-id: '${{ github.sha }}' repo-url: '${{ github.event.repository.url }}' build-ref-url: '${{ github.event.repository.url }}/actions/runs/${{ github.run_id }}' - name: Confirm Jira Build Output if: success() run: | echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}" deploy: if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')}} needs: ci runs-on: ubuntu-latest env: CONFIG_PATH: '.deployment/storefront-app/argoDeploy.json' steps: - name: Set deployment environment id: deployEnv run: | if [ '${{ github.ref }}' = 'refs/heads/master' ]; then echo "NAME=prod" >> $GITHUB_OUTPUT else echo "NAME=dev" >> $GITHUB_OUTPUT fi; - name: Invoke Module deployment workflow uses: benc-uk/workflow-dispatch@v1 with: workflow: VC deployment token: ${{ secrets.REPO_TOKEN }} inputs: '{ "artifactUrl": "${{ needs.ci.outputs.artifactUrl }}", "deployEnvironment": "${{ steps.deployEnv.outputs.NAME }}", "deployConfigPath": "${{ env.CONFIG_PATH }}", "jiraKeys":"${{ needs.ci.outputs.jira-keys }}" }' ================================================ FILE: .github/workflows/msteams.yml ================================================ name: Send message to Teams (regression PR) on: pull_request: branches: [regression] jobs: notify: runs-on: ubuntu-latest steps: - name: Send a message to Microsoft Teams uses: VirtoCommerce/vc-github-actions/msteams-send-message@master with: body: '{ "@type": "MessageCard", "@context": "http://schema.org/extensions", "themeColor": "0076D7", "summary": "On ${{github.repository}} repository", "sections": [ { "activityTitle": "Regression PR created/updated", "activitySubtitle": "By [${{ github.event.pull_request.user.login }}](${{ github.event.pull_request.user.url }}) on **[${{github.repository}}](${{github.server_url}}/${{github.repository}})** repository", "activityImage":"${{ github.event.pull_request.user.avatar_url }}", "facts": [ { "name": "Repository", "value": "[${{github.repository}}](${{github.server_url}}/${{github.repository}})" }, { "name": "Pull request", "value": "[${{ github.event.pull_request.number }}](${{ github.event.pull_request._links.html.href }})" }, { "name": "Pull request title", "value": "${{ github.event.pull_request.title }}" } ], "markdown": true } ], "potentialAction": [ { "@type": "OpenUri", "name": "View Pull Request", "targets": [{ "os": "default", "uri": "${{ github.event.pull_request._links.html.href }}" }] }] }' # the body of the message webhook_uri: ${{ secrets.PLATFORM_TEAMS_URI }} ================================================ FILE: .github/workflows/pr-ci.yml ================================================ # v3.800.4 name: PR build on: workflow_dispatch: pull_request: branches: [ master, dev ] paths-ignore: - '.github/**' - 'docs/**' - 'build/**' - 'README.md' - 'LICENSE' - '**/argoDeploy.json' jobs: test: uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.4 secrets: sonarToken: ${{ secrets.SONAR_TOKEN }} build: uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.4 with: uploadDocker: 'true' imageName: 'storefront' dockerFiles: 'https://raw.githubusercontent.com/VirtoCommerce/vc-docker/feat/net8/linux/storefront/Dockerfile' secrets: envPAT: ${{ secrets.REPO_TOKEN }} ================================================ FILE: .github/workflows/pr-deploy.yml ================================================ # v3.800.4 name: PR deploy on: pull_request: branches: [ master, dev ] types: [ labeled ] jobs: get-deployment-data: if: ${{ github.event.label.name == 'deploy-qa' }} runs-on: ubuntu-latest env: ARTIFACT_NAME: ${{ github.event.repository.name }} DOCKER_CACHE_KEY: '' DOCKER_TAR: 'image.tar' outputs: dockerShortKey: ${{ steps.cache-key.outputs.dockerShortKey }} dockerFullKey: ${{ steps.cache-key.outputs.dockerFullKey }} packageShortKey: ${{ steps.cache-key.outputs.packageShortKey }} packageFullKey: ${{ steps.cache-key.outputs.packageFullKey }} dockerTar: ${{ env.DOCKER_TAR }} jiraKey: ${{ steps.jiraKey.outputs.qaTaskNumber }} steps: - uses: actions/checkout@v4 - name: Get Artifact Version uses: VirtoCommerce/vc-github-actions/get-image-version@master id: artifactVer - name: Get cache key uses: VirtoCommerce/vc-github-actions/cache-get-key@master id: cache-key with: runnerOs: ${{ runner.os }} artifactName: ${{ env.ARTIFACT_NAME }} - name: Gets Jira key from PR body id: jiraKey uses: VirtoCommerce/vc-github-actions/pr-body-get-link@master with: skipArtifactUrl: 'true' githubToken: ${{ secrets.REPO_TOKEN }} publish: needs: get-deployment-data uses: VirtoCommerce/.github/.github/workflows/publish-docker.yml@v3.800.4 with: fullKey: ${{ needs.get-deployment-data.outputs.dockerFullKey }} shortKey: '${{ needs.get-deployment-data.outputs.dockerShortKey }}-' dockerTar: ${{ needs.get-deployment-data.outputs.dockerTar }} secrets: envPAT: ${{ secrets.GITHUB_TOKEN }} dockerUser: ${{ secrets.DOCKER_USERNAME }} dockerToken: ${{ secrets.DOCKER_TOKEN }} deploy: needs: [publish, get-deployment-data] uses: VirtoCommerce/.github/.github/workflows/deploy.yml@v3.800.4 with: argoServer: 'argo.govirto.com' artifactUrl: ${{ needs.publish.outputs.imagePath }} matrix: '{"include":[{"envName": "qa", "confPath": ".deployment/storefront-app/argoDeploy.json"}]}' taskNumber: ${{ needs.get-deployment-data.outputs.jiraKey }} forceCommit: false secrets: envPAT: ${{ secrets.REPO_TOKEN }} argoLogin: ${{ secrets.ARGOCD_LOGIN }} argoPassword: ${{ secrets.ARGOCD_PASSWORD }} comment-publish: if: ${{ always() && github.event.label.name == 'deploy-qa' }} needs: publish env: MESSAGE_BODY: ':x: Docker image publish filed.' runs-on: ubuntu-latest steps: - name: Set MESSAGE_BODY if: ${{ needs.publish.result == 'success' }} run: | echo "MESSAGE_BODY=:heavy_check_mark: Docker image ${{ needs.publish.outputs.imagePath }} published" >> $GITHUB_ENV - name: Add link to PR if: ${{ needs.publish.result == 'success' }} env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master with: artifactUrl: ${{ needs.publish.outputs.imagePath }} - uses: actions/github-script@v7 if: ${{ !(contains('skipped, cancelled', needs.publish.result )) }} with: #github-token: ${{secrets.GITHUB_TOKEN}} script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '${{ env.MESSAGE_BODY }}' }) comment-deploy: if: ${{ always() && github.event.label.name == 'deploy-qa' }} needs: [ deploy, publish ] runs-on: ubuntu-latest env: MESSAGE_BODY: ':x: QA deployment failed.' steps: - name: Set MESSAGE_BODY if: ${{ needs.deploy.result == 'success' }} run: | echo "MESSAGE_BODY=:heavy_check_mark: Docker image ${{ needs.publish.outputs.imagePath }} deployed to QA" >> $GITHUB_ENV - uses: actions/github-script@v7 if: ${{ !(contains('skipped, cancelled', needs.deploy.result )) }} with: #github-token: ${{secrets.GITHUB_TOKEN}} script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '${{ env.MESSAGE_BODY }}' }) ================================================ FILE: .github/workflows/release-branch.yml ================================================ # v3.800.5 name: Release - branch on: workflow_dispatch: inputs: incrementVersion: description: 'Increment automatically minor\patch version before release created. If "none" version will not be incremented.' required: true default: 'none' type: choice options: - none jobs: test: uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.2 secrets: sonarToken: ${{ secrets.SONAR_TOKEN }} build: uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.2 with: uploadPackage: 'true' uploadDocker: 'true' eventName: ${{ github.event_name }} imageName: 'storefront' dockerFiles: 'https://raw.githubusercontent.com/VirtoCommerce/vc-docker/feat/net8/linux/storefront/Dockerfile' forceVersionSuffix: 'false' secrets: envPAT: ${{ secrets.REPO_TOKEN }} get-metadata: runs-on: ubuntu-latest env: DOCKER_CACHE_KEY: '' DOCKER_TAR: 'image.tar' outputs: dockerShortKey: ${{ steps.cache-key.outputs.dockerShortKey }} dockerFullKey: ${{ steps.cache-key.outputs.dockerFullKey }} packageShortKey: ${{ steps.cache-key.outputs.packageShortKey }} packageFullKey: ${{ steps.cache-key.outputs.packageFullKey }} dockerTar: ${{ env.DOCKER_TAR }} changelog: ${{ steps.changelog.outputs.changelog }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get Changelog id: changelog uses: VirtoCommerce/vc-github-actions/changelog-generator@master - name: Get Artifact Version uses: VirtoCommerce/vc-github-actions/get-image-version@master id: artifactVer - name: Get cache key uses: VirtoCommerce/vc-github-actions/cache-get-key@master id: cache-key with: runnerOs: ${{ runner.os }} artifactName: ${{ github.event.repository.name }} publish-docker: needs: [build, test, get-metadata] uses: VirtoCommerce/.github/.github/workflows/publish-docker.yml@v3.800.2 with: fullKey: ${{ needs.get-metadata.outputs.dockerFullKey }} shortKey: '${{ needs.get-metadata.outputs.dockerShortKey }}-' dockerTar: ${{ needs.get-metadata.outputs.dockerTar }} publishToDocker: 'true' secrets: envPAT: ${{ secrets.GITHUB_TOKEN }} dockerUser: ${{ secrets.DOCKER_USERNAME }} dockerToken: ${{ secrets.DOCKER_TOKEN }} publish-github-release: needs: [build, test, get-metadata] uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.2 with: fullKey: ${{ needs.get-metadata.outputs.packageFullKey }} shortKey: '${{ needs.get-metadata.outputs.packageShortKey }}-' changeLog: '${{ needs.get-metadata.outputs.changeLog }}' forceNuget: false secrets: envPAT: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/release.yml ================================================ # v1.0.0 name: Release - Quick release on: workflow_dispatch: jobs: release: uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.2 secrets: envPAT: ${{ secrets.REPO_TOKEN }} ================================================ FILE: .gitignore ================================================ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.userosscache *.sln.docstates # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ # Visual Studio 2015 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* # NUNIT *.VisualState.xml TestResult.xml # Build Results of an ATL Project [Dd]ebugPS/ [Rr]eleasePS/ dlldata.c # DNX project.lock.json project.fragment.lock.json artifacts/ *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc # Chutzpah Test files _Chutzpah* # Visual C++ cache files ipch/ *.aps *.ncb *.opendb *.opensdf *.sdf *.cachefile *.VC.db *.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx *.sap # TFS 2012 Local Workspace $tf/ # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user # JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # Visual Studio code coverage results *.coverage *.coveragexml # NCrunch _NCrunch_* .*crunch*.local.xml nCrunchTemp_* # MightyMoose *.mm.* AutoTest.Net/ # Web workbench (sass) .sass-cache/ # Installshield output folder [Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html # Click-Once directory publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml # TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to # checkin your Azure Web App publish settings, but sensitive information contained # in these scripts will be unencrypted PublishScripts/ # NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. !**/packages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config # NuGet v3's project.json files produces more ignoreable files *.nuget.props *.nuget.targets # Microsoft Azure Build Output csx/ *.build.csdef # Microsoft Azure Emulator ecf/ rcf/ # Windows Store app package directories and files AppPackages/ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache !*.[Cc]ache/ # Others ClientBin/ ~$* *~ *.dbmdl *.dbproj.schemaview *.jfm *.pfx *.publishsettings node_modules/ orleans.codegen.cs # Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #bower_components/ # RIA/Silverlight projects Generated_Code/ # Backup & report files from converting an old project file # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files *.mdf *.ldf # Business Intelligence projects *.rdl.data *.bim.layout *.bim_*.settings # Microsoft Fakes FakesAssemblies/ # GhostDoc plugin setting file *.GhostDoc.xml # Node.js Tools for Visual Studio .ntvs_analysis.dat # Visual Studio 6 build log *.plg # Visual Studio 6 workspace options file *.opt # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts **/*.DesktopClient/ModelManifest.xml **/*.Server/GeneratedArtifacts **/*.Server/ModelManifest.xml _Pvt_Extensions # Paket dependency manager .paket/paket.exe paket-files/ # FAKE - F# Make .fake/ # JetBrains Rider .idea/ *.sln.iml # CodeRush .cr/ # Python Tools for Visual Studio (PTVS) __pycache__/ *.pyc # Cake - Uncomment if you are using it # tools/ /VirtoCommerce.Storefront/wwwroot/cms-content .vscode VirtoCommerce.Storefront/wwwroot/js/designer.bundle.js* ================================================ FILE: .nuke ================================================ VirtoCommerce.Storefront.sln ================================================ FILE: CONTRIBUTING.md ================================================ Contributing ----------- We welcome & recognize contributors to Virto Commerce. There are many benefits available for our contributers, from special licensing to project involvement and access to private repositories. Follow the guide below to contribute: 1. Before starting work on a new contribution, take a moment and search the commits and issues for similar proposals. 2. Fork the Virto Commerce repository into your account according to GitHub Fork a Repo document. 3. Make your changes. Use `dev` branch because it contains the latest stable code. We also recommend you test your code before contributing. 4. Once ready to commit your changes, create a pull request to `dev` branch according to GitHub Create a Pull Request. 5. Once received, the Virto Commerce development team will review your contribution and if approved, will pull your request to the appropriate branch. ================================================ FILE: Directory.Build.props ================================================ VirtoCommerce Copyright © 2011-2024 Virto Commerce. All rights reserved VirtoCommerce 8.3.0 $(VersionSuffix)-$(BuildNumber) ================================================ FILE: LICENSE ================================================ Copyright (c) Virto Solutions LTD.  All rights reserved. Licensed under the Virto Commerce Open Software License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://virtocommerce.com/open-source-license Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ================================================ FILE: README.md ================================================ # Virto Commerce Storefront Kit [![CI status](https://github.com/VirtoCommerce/vc-storefront/workflows/Storefront%20CI/badge.svg?branch=dev)](https://github.com/VirtoCommerce/vc-storefront/actions?query=workflow%3A"Storefront+CI") [![Quality gate](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&metric=alert_status&branch=dev)](https://sonarcloud.io/dashboard?id=VirtoCommerce_vc-storefront) [![Reliability rating](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&metric=reliability_rating&branch=dev)](https://sonarcloud.io/dashboard?id=VirtoCommerce_vc-storefront) [![Security rating](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&metric=security_rating&branch=dev)](https://sonarcloud.io/dashboard?id=VirtoCommerce_vc-storefront) [![Sqale rating](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&metric=sqale_rating&branch=dev)](https://sonarcloud.io/dashboard?id=VirtoCommerce_vc-storefront) [![Lines of code](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&branch=dev&metric=ncloc)](https://sonarcloud.io/api/project_badges/measure?project=VirtoCommerce_vc-storefront&branch=dev&metric=ncloc)  [![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FVirtoCommerce%2Fvc-storefront%2Fmaster%2Fazuredeploy.json) The Virto Commerce Storefront Kit is the official online shopping website based on the Virto Commerce Platform, written on ASP.NET 8. The website serves as a client application for the VC Platform and communicates solely through public APIs. The Storefront Kit enables the creation of multiple distinct stores (websites) on top of the Virto Commerce Platform. Each store may have its own theme with specific layouts, yet still be based on the same catalog and customer data. This allows for versatile store configurations, such as: * Different designs for various product categories. * Regional-specific sites offering tailored product sets. * Integration with multiple touchpoints for a true omnichannel experience. ## Key features - Launch and host e-commerce themes on top of the Virto Commerce Platform. - XAPI Gateway. - Caching mechanism. - Multi-store support. - Multi-theme support. - Server-side rendering. And more. ## Architecture For detailed information about the Virto Storefront Architecture, please refer to our [developer guide](https://docs.virtocommerce.org/storefront/developer-guide/) ## Technologies and frameworks used - ASP.NET 8 - ASP.NET Identity Core ## Setup For detailed setup information, please refer to [Quick Start](https://docs.virtocommerce.org/storefront/developer-guide/getting-started/quickstart-on-windows/) to deploy and run. ## Themes ### B2B Theme View [B2B theme on GitHub](https://github.com/VirtoCommerce/vc-theme-b2b-vue). ![image](https://user-images.githubusercontent.com/7639413/170992875-fbfa2093-ebbf-4404-8140-c952d9f0f0f4.png) ### FAQ #### Running the Storefront only on HTTP schema - In order to run the platform only at HTTP schema in production mode, it's enough to pass only HTTP URLs in `--urls` argument of the `dotnet` command. ```console dotnet VirtoCommerce.Storefront.dll --urls=http://localhost:5002 ``` #### Running the Platform on HTTPS schema - Install and trust HTTPS certificate Run to trust the .NET Core SDK HTTPS development certificate: ```console dotnet dev-certs https --trust ``` Read more about [enforcing HTTPS in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-3.0&tabs=visual-studio#trust) ```console dotnet VirtoCommerce.Storefront.dll --urls=https://localhost:4302/ ``` - Trust the .Net Core Development Self-Signed Certificate. More details on trusting the self-signed certificate can be found [here](https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis-express-self-signed-certificate/) #### Forward the scheme for Linux and non-IIS reverse proxies Apps that call UseHttpsRedirection and UseHsts put a site into an infinite loop if deployed to an Azure Linux App Service, Azure Linux virtual machine (VM), Linux container or behind any other reverse proxy besides IIS. TLS is terminated by the reverse proxy, and Kestrel isn't made aware of the correct request scheme. OAuth and OIDC also fail in this configuration because they generate incorrect redirects. UseIISIntegration adds and configures Forwarded Headers Middleware when running behind IIS, but there's no matching automatic configuration for Linux (Apache or Nginx integration). To forward the scheme from the proxy in non-IIS scenarios, set `ASPNETCORE_FORWARDEDHEADERS_ENABLED` environment variable to `true`. For more details on how it works, see the Microsoft [documentation](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-5.0#forward-the-scheme-for-linux-and-non-iis-reverse-proxies). ## References - Virto Commerce Documentation: https://docs.virtocommerce.org - Home: https://virtocommerce.com - Community: https://www.virtocommerce.org - [Download Latest Release](https://github.com/VirtoCommerce/vc-storefront/releases/latest) ## License Copyright (c) Virto Solutions LTD. All rights reserved. Licensed under the Virto Commerce Open Software License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Converters/CountryConverter.cs ================================================ using System.Globalization; using System.Linq; using System.Web; using Newtonsoft.Json; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.LiquidThemeEngine.Converters { public static class CountryConverter { public static string ToOptionTag(this Country country) { var regions = "[]"; if (country.Regions != null) { regions = JsonConvert.SerializeObject(country.Regions.Select(r => r.Name)); } return string.Format(CultureInfo.InvariantCulture, "", HttpUtility.HtmlAttributeEncode(country.Name), HttpUtility.HtmlAttributeEncode(regions) ); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Exceptions/SaasCompileException.cs ================================================ using System; using System.IO; using System.Runtime.Serialization; namespace DotLiquid.ViewEngine.Exceptions { [Serializable] public class SaasCompileException : Exception { [Obsolete(DiagnosticId = "SYSLIB0051")] protected SaasCompileException(SerializationInfo info, StreamingContext context) : base(info, context) { SassLine = info.GetString("SassLine"); } public override string Message { get { return base.Message + "\n\r" + this.ToString(); } } public string SassLine { get; private set; } public override string ToString() { return String.Format("Line: {0}\n\rCompiler error: {1}", SassLine, _innerException != null ? _innerException.ToString() : ""); } private Exception _innerException; public SaasCompileException(string filename, string sass, Exception innerException) : base("Failed to compile sass file \"" + filename + "\"") { _innerException = innerException; if (innerException.Message.StartsWith("stdin")) { var lineNumber = Int32.Parse(innerException.Message.Split(':')[1]); this.SassLine = ReadLine(sass, lineNumber); } } private static string ReadLine(string text, int lineNumber) { var reader = new StringReader(text); string line; int currentLineNumber = 0; do { currentLineNumber += 1; line = reader.ReadLine(); } while (line != null && currentLineNumber < lineNumber); return (currentLineNumber == lineNumber) ? line : string.Empty; } [Obsolete(DiagnosticId = "SYSLIB0051")] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("SassLine", SassLine); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Extensions/GraphQLResponseExtensions.cs ================================================ using System; using GraphQL; using Newtonsoft.Json; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.LiquidThemeEngine.Extensions { public static class GraphQLResponseExtensions { public static void ThrowIfHasErrors(this IGraphQLResponse response) { if (response == null) { throw new ArgumentNullException(nameof(response)); } if (!response.Errors.IsNullOrEmpty()) { throw new StorefrontException(JsonConvert.SerializeObject(response.Errors, Formatting.Indented)); } } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Extensions/StringExtensions.cs ================================================ using System.Globalization; namespace DotLiquid.ViewEngine.Extensions { public static class StringExtensions { public static string TrimQuotes(this string input) { return input.Trim('\'', '\"'); } public static CultureInfo TryGetCultureInfo(this string languageCode) { try { return !string.IsNullOrEmpty(languageCode) ? CultureInfo.CreateSpecificCulture(languageCode) : null; } catch { return null; } } public static int SafeParseInt(this string input, int defaultValue = default) { return int.TryParse(input, out var result) ? result : defaultValue; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Extensions/UriExtensions.cs ================================================ using System; using System.Linq; using System.Web; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Extensions { public static class UriExtensions { /// /// Sets the given parameter value in the query string. /// /// /// Name of the parameter to set. /// Value for the parameter to set. Pass null to remove the parameter with given name. /// Url with given parameter value. public static Uri SetQueryParameter(this Uri url, string name, string value) { var qs = HttpUtility.ParseQueryString(url.Query); if (value != null) { qs[name] = value; } else { qs.Remove(name); } var result = new UriBuilder(url) { Query = string.Join("&", qs.AllKeys.Select(key => string.Join("=", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(qs[key])))) }; return result.Uri; } public static Uri SetQueryParameters(this Uri uri, IHasQueryKeyValues hasQueryKeyValues) { if (uri == null) { throw new ArgumentNullException(nameof(uri)); } if (hasQueryKeyValues == null) { throw new ArgumentNullException(nameof(hasQueryKeyValues)); } foreach (var keyValue in hasQueryKeyValues.GetQueryKeyValues()) { uri = uri.SetQueryParameter(keyValue.Key, keyValue.Value); } return uri; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/ArrayFilters.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static partial class ArrayFilters { public static object Tree(object input, string propName, string titlePropName, string delimiter, string sortByPropName) { var tree = new List(); var enumerable = input as IEnumerable; if (enumerable != null) { var elementType = enumerable.GetType().GetEnumerableType(); var propInfo = elementType.GetProperty(propName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var titlePropInfo = elementType.GetProperty(titlePropName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var sortByPropInfo = elementType.GetProperty(sortByPropName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); if (propInfo != null) { var charDelimiter = delimiter.ToCharArray(); foreach (var element in enumerable) { var path = propInfo.GetValue(element) as string; var parts = path.Split(charDelimiter); for (var i = parts.Length; i > 0; i--) { path = string.Join(delimiter, parts.Take(i)); var treeNode = tree.FirstOrDefault(n => n.Path == path); if (treeNode == null) { tree.Add(new TreeNode { Level = i, ParentPath = string.Join(delimiter, parts.Take(Math.Max(0, i - 1))), Path = path, Priority = sortByPropInfo != null ? sortByPropInfo.GetValue(element) as int? : null, Title = titlePropInfo != null ? titlePropInfo.GetValue(element) as string : null }); } } } foreach (var treeNode in tree.OrderBy(n => n.Priority)) { if (!string.IsNullOrEmpty(treeNode.ParentPath)) { var parent = tree.FirstOrDefault(n => n.Path == treeNode.ParentPath); if (parent != null) { treeNode.Parent = parent; parent.Children.Add(treeNode); } } treeNode.AllChildren = tree.Where(n => n.Path.StartsWith(treeNode.Path + delimiter)).ToList(); } } } return tree; } /// /// Filter the elements of an array by a given condition /// {% assign sorted = pages | where:"propName","==","value" %} /// /// /// /// public static object Where(object input, string propName, string op, string value) { var retVal = input; var enumerable = retVal as IEnumerable; if (enumerable != null) { var queryable = enumerable.AsQueryable(); var elementType = enumerable.GetType().GetEnumerableType(); var paramX = Expression.Parameter(elementType, "x"); var propInfo = elementType.GetProperty(propName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var left = Expression.Property(paramX, propInfo); var objValue = ParseString(value); var right = Expression.Constant(objValue); BinaryExpression binaryOp; if (op.EqualsInvariant("==")) binaryOp = Expression.Equal(left, right); else if (op.EqualsInvariant("!=")) binaryOp = Expression.NotEqual(left, right); else if (op.EqualsInvariant(">")) binaryOp = Expression.GreaterThan(left, right); else if (op.EqualsInvariant(">=")) binaryOp = Expression.GreaterThanOrEqual(left, right); else if (op.EqualsInvariant("=<")) binaryOp = Expression.LessThan(left, right); else if (op.EqualsInvariant("contains")) { Expression expr = null; if (propInfo.PropertyType == typeof(string)) { var containsMethod = typeof(string).GetMethods().First(x => x.Name == "Contains"); expr = Expression.Call(left, containsMethod, right); } else { var containsMethod = typeof(Enumerable).GetMethods().First(x => x.Name == "Contains" && x.GetParameters().Count() == 2).MakeGenericMethod(new Type[] { objValue.GetType() }); expr = Expression.Call(containsMethod, left, right); } //where(x=> x.Tags.Contains(y)) binaryOp = Expression.Equal(expr, Expression.Constant(true)); } else binaryOp = Expression.LessThanOrEqual(left, right); var delegateType = typeof(Func<,>).MakeGenericType(elementType, typeof(bool)); //Construct Func = (x) => x.propName == value expression var lambda = Expression.Lambda(delegateType, binaryOp, paramX); //Find Queryable.Where(Expression>) method var whereMethod = typeof(Queryable).GetMethods() .Where(x => x.Name == "Where") .Select(x => new { M = x, P = x.GetParameters() }) .Where(x => x.P.Length == 2 && x.P[0].ParameterType.IsGenericType && x.P[0].ParameterType.GetGenericTypeDefinition() == typeof(IQueryable<>) && x.P[1].ParameterType.IsGenericType && x.P[1].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>)) .Select(x => new { x.M, A = x.P[1].ParameterType.GetGenericArguments() }) .Where(x => x.A[0].IsGenericType && x.A[0].GetGenericTypeDefinition() == typeof(Func<,>)) .Select(x => new { x.M, A = x.A[0].GetGenericArguments() }) .Where(x => x.A[0].IsGenericParameter && x.A[1] == typeof(bool)) .Select(x => x.M) .SingleOrDefault(); retVal = whereMethod.MakeGenericMethod(elementType).Invoke(null, new object[] { queryable, lambda }); } return retVal; } /// /// Sorts the elements of an array by a given attribute of an element in the array. /// {% assign sorted = pages | sort:"date:desc;name" %} /// /// /// /// public static object SortList(object input, string sort) { var retVal = input; IEnumerable enumerable = retVal as IEnumerable; IMutablePagedList muttablePagedList = input as IMutablePagedList; var sortInfos = SortInfo.Parse(sort).ToList(); if (muttablePagedList != null) { muttablePagedList.Slice(muttablePagedList.PageNumber, muttablePagedList.PageSize, sortInfos); } if (enumerable != null) { //Queryable.Cast(input).OrderBySortInfos(sortInfos) call by reflection var queryable = enumerable.AsQueryable(); var elementType = enumerable.GetType().GetEnumerableType(); MethodInfo castMethodInfo = typeof(Queryable).GetMethods().First(x => x.Name == "Cast" && x.IsGenericMethod); castMethodInfo = castMethodInfo.MakeGenericMethod(new Type[] { elementType }); var genericQueryable = castMethodInfo.Invoke(null, new object[] { queryable }); var orderBySortInfosMethodInfo = typeof(IQueryableExtensions).GetMethod("OrderBySortInfos"); orderBySortInfosMethodInfo = orderBySortInfosMethodInfo.MakeGenericMethod(new Type[] { elementType }); retVal = orderBySortInfosMethodInfo.Invoke(null, new object[] { genericQueryable, sortInfos.ToArray() }); } return retVal; } private static object ParseString(string str) { int intValue; double doubleValue; char charValue; bool boolValue; TimeSpan timespan; DateTime dateTime; // Place checks higher if if-else statement to give higher priority to type. if (int.TryParse(str, out intValue)) return intValue; else if (double.TryParse(str, out doubleValue)) return doubleValue; else if (TimeSpan.TryParse(str, out timespan)) return timespan; else if (DateTime.TryParse(str, out dateTime)) return dateTime; else if (char.TryParse(str, out charValue)) return charValue; else if (bool.TryParse(str, out boolValue)) return boolValue; return str; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/CommerceFilters.cs ================================================ using System; using System.Globalization; using System.Linq; using System.Threading; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static partial class CommerceFilters { #region Static Fields private static readonly Lazy _cultures = new Lazy( CreateCultures, LazyThreadSafetyMode.ExecutionAndPublication); #endregion #region Public Properties public static CultureInfo[] Cultures { get { return _cultures.Value; } } #endregion #region Public Methods and Operators /// /// Return the three letter ISO currency code for the current thread. /// /// current currency code in String public static string CurrentCurrencyCode() { return new RegionInfo(Thread.CurrentThread.CurrentCulture.Name).ISOCurrencySymbol; } public static string CurrentCurrencyCode(string cultureName) { return new RegionInfo(cultureName).ISOCurrencySymbol; } /// /// Return the object which represents the place and language which matches the currency code which /// the database is able to support. Fall back to Current Thread's culture if the currencyCode we requested doesn't /// match. /// /// the currency code to be matched for the culture /// > /// CultureInfo object public static CultureInfo EffectiveCulture(string currencyCode) { var retVal = CultureInfo.CurrentCulture; if (!CurrentCurrencyCode().Equals(currencyCode, StringComparison.OrdinalIgnoreCase)) { // Find currency culture var info = Cultures.FirstOrDefault( i => new RegionInfo(i.Name).ISOCurrencySymbol.Equals( currencyCode, StringComparison.OrdinalIgnoreCase)); retVal = info ?? retVal; } //.NET for swiss currency returns Fr where normally it should be CHF if (retVal.Name.Equals("de-CH", StringComparison.InvariantCultureIgnoreCase)) { retVal.NumberFormat.CurrencySymbol = "CHF"; } return retVal; } /// /// Attempt to format the currency based on the browser's locale, but if that currency /// is not in the database, then fallback to current thread's culture. /// /// the amount to be formated /// /// currency code which will be used to find the /// effective culture /// /// Formatted currency in String public static string FormatCurrency(decimal amount, string currencyCode) { return string.Format(EffectiveCulture(currencyCode), "{0:c}", amount); } #endregion #region Methods private static CultureInfo[] CreateCultures() { return CultureInfo.GetCultures(CultureTypes.SpecificCultures); } #endregion } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/CommonFilters.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.IO; using System.Linq; using System.Text.Encodings.Web; using DotLiquid.ViewEngine.Extensions; using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using PagedList.Core; using Scriban; using Scriban.Runtime; using Scriban.Syntax; using VirtoCommerce.LiquidThemeEngine.Extensions; using VirtoCommerce.LiquidThemeEngine.JsonConverters; using VirtoCommerce.LiquidThemeEngine.Objects; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static partial class CommonFilters { private static readonly string[] _poweredLinks = { ".NET ecommerce platform by Virto", "Shopping Cart by Virto", ".NET Shopping Cart by Virto", "ASP.NET Shopping Cart by Virto", ".NET ecommerce by Virto", ".NET ecommerce framework by Virto", "ASP.NET ecommerce by Virto Commerce", "ASP.NET ecommerce platform by Virto", "ASP.NET ecommerce framework by Virto", "Enterprise ecommerce by Virto", "Enterprise ecommerce platform by Virto", }; private static readonly JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy(), }, Converters = new List { new MutablePagedListAsArrayJsonConverter(), }, }; public static object Default(object input, object value) { return input ?? value; } public static string Json(object input) { var serializedString = input != null ? JsonConvert.SerializeObject(input, _jsonSerializerSettings) : null; return serializedString; } public static object ParseJson(string input) { var result = input != null ? JsonConvert.DeserializeObject(input, _jsonSerializerSettings) : null; return result; } public static string PoweredBy(string signature) { var hashCode = (uint)signature.GetHashCode(); return _poweredLinks[hashCode % _poweredLinks.Length]; } public static string Render(TemplateContext context, string input) { if (input == null) { return null; } var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; var result = themeEngine.RenderTemplateAsync(input, null, context.CurrentGlobal).GetAwaiter().GetResult(); return result; } public static string Antiforgery(TemplateContext context) { var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; var httpContext = themeEngine.HttpContext; var antiforgery = httpContext.RequestServices.GetService(); var htmlContent = antiforgery.GetHtml(httpContext); var writer = new StringWriter(); htmlContent.WriteTo(writer, HtmlEncoder.Default); return writer.ToString(); } public static string Layout(TemplateContext context, string layout) { if (!string.IsNullOrEmpty(layout)) { var layoutSetter = (Action)context.GetValue(new ScriptVariableGlobal("layout_setter")); layoutSetter(layout); } return null; } public static Paginate Paginate(TemplateContext context, object source, int pageSize = 20, string filterJson = null) { var pagedList = source as IPagedList; var requestUrl = context.GetValue(new ScriptVariableGlobal("request_url")) as Uri; var pageNumber = context.GetValue(new ScriptVariableGlobal("page_number"))?.ToString().SafeParseInt(1) ?? 1; var effectivePageSize = context.GetValue(new ScriptVariableGlobal("page_size"))?.ToString().SafeParseInt(pageSize) ?? pageSize; var @params = new NameValueCollection(); if (!string.IsNullOrEmpty(filterJson)) { var values = JsonConvert.DeserializeObject>(filterJson); foreach (var pair in values) { @params.Add(pair.Key, pair.Value); } } switch (source) { case IMutablePagedList mutablePagedList: mutablePagedList.Slice(pageNumber, effectivePageSize, mutablePagedList.SortInfos, @params); pagedList = mutablePagedList; break; case ScriptObject scriptObject when scriptObject.Keys.Contains("total_count"): pagedList = new StaticPagedList(Array.Empty(), pageNumber, effectivePageSize, scriptObject["total_count"].ToString().SafeParseInt(0)); break; case ICollection collection: pagedList = new PagedList(collection.OfType().AsQueryable(), pageNumber, effectivePageSize); break; } if (pagedList == null) { return null; } var result = new Paginate(pagedList); for (var i = 1; i <= pagedList.PageCount; i++) { var page = i > 1 ? i.ToString() : null; var part = new Part { IsLink = i != pagedList.PageNumber, Title = i.ToString(), Url = requestUrl != null ? requestUrl.SetQueryParameter("page", page).ToString() : i.ToString() }; result.Parts.Add(part); } return result; } public static string Setting(TemplateContext context, string key) { var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; var settings = themeEngine.GetSettings(); settings.TryGetValue(key, out var result); return result?.ToString(); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/DynamicDataSourceFilters.cs ================================================ using System.Collections; using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; using System.Text; using GraphQL; using Scriban; using Scriban.Runtime; using VirtoCommerce.LiquidThemeEngine.Extensions; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static class DataSourceFilter { public static ScriptObject GraphqlDataSource(TemplateContext context, string fileName) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; var query = themeAdaptor.GetAssetStreamAsync(Path.Combine("graphql", fileName)).GetAwaiter().GetResult().ReadToString(); var graphQLRequest = new GraphQLRequest(query); var response = themeAdaptor.GraphQLClient.SendQueryAsync(graphQLRequest).GetAwaiter().GetResult(); response.ThrowIfHasErrors(); var result = BuildScriptObject(response.Data); return result; } private static ScriptObject BuildScriptObject(ExpandoObject expando) { var dict = (IDictionary)expando; var scriptObject = new ScriptObject(); foreach (var kv in dict) { var renamedKey = GraphQLMemberRenamer.Rename(kv.Key); if (kv.Value is ExpandoObject expandoValue) { scriptObject.Add(renamedKey, BuildScriptObject(expandoValue)); } else if (kv.Value is IList array) { var firstValue = array.Count > 0 ? array[0] : null; if (firstValue is ExpandoObject expandoObj) { scriptObject.Add(renamedKey, array.OfType().Select(x => BuildScriptObject(x)).ToArray()); } else { scriptObject.Add(renamedKey, array); } } else { scriptObject.Add(renamedKey, kv.Value); } } return scriptObject; } private class GraphQLMemberRenamer { protected GraphQLMemberRenamer() { } /// /// Renames a camel/pascalcase member to a lowercase and `_` name. e.g `ThisIsAnExample` becomes `this_is_an_example`. /// /// The member to rename /// The member name renamed public static string Rename(string name) { var builder = new StringBuilder(); var previousUpper = false; for (var i = 0; i < name.Length; i++) { var c = name[i]; if (char.IsUpper(c)) { if (i > 0 && !previousUpper) { builder.Append("_"); } builder.Append(char.ToLowerInvariant(c)); previousUpper = true; } else { builder.Append(c); previousUpper = false; } } return builder.ToString(); } } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/FeatureFilter.cs ================================================ using System.Collections.Generic; using global::Scriban; using Newtonsoft.Json.Linq; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static class FeatureFilter { public static bool IsFeatureActive(TemplateContext context, string key, params object[] variables) { if (string.IsNullOrEmpty(key)) { return false; } if (context.TemplateLoader is ShopifyLiquidThemeEngine themeEngine) { return themeEngine.IsFeatureActive(key); } return false; } public static string IsFeaturesActive(TemplateContext context, string key, params object[] featureNames) { if (!string.IsNullOrEmpty(key)) { return string.Empty; } switch (context.TemplateLoader) { case ShopifyLiquidThemeEngine themeEngine: { var featuresStateJsonObject = BuildFeaturesStateJsonObject(themeEngine, featureNames); return featuresStateJsonObject.ToString(); } default: return string.Empty; } } private static JObject BuildFeaturesStateJsonObject(ShopifyLiquidThemeEngine themeEngine, IEnumerable featureNames) { var result = new JObject(); foreach (string featureName in featureNames) { var featureActive = themeEngine.IsFeatureActive(featureName); result.Add(featureName, featureActive); } return result; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/HtmlFilters.cs ================================================ namespace VirtoCommerce.LiquidThemeEngine.Filters { /// /// https://docs.shopify.com/themes/liquid-documentation/filters/html-filters /// public static partial class HtmlFilters { /// /// Generates a script tag. /// {{ 'shop.js' | asset_url | script_tag }} /// /// /// public static string ScriptTag(string input) { return string.Format("", input); } /// /// Generates async script tag. /// {{ 'shop.js' | asset_url | script_tag_async }} /// /// /// public static string ScriptTagAsync(string input) { return string.Format("", input); } /// /// Generates defer script tag. /// {{ 'shop.js' | asset_url | script_tag_defer }} /// /// /// public static string ScriptTagDefer(string input) { return string.Format("", input); } /// /// Generates module script tag. /// {{ 'shop.js' | asset_url | script_tag_module }} /// /// /// public static string ScriptTagModule(string input) { return string.Format("", input); } /// /// Generates a stylesheet tag. /// {{ 'shop.css' | asset_url | stylesheet_tag }} /// /// /// /// public static string StylesheetTag(string input, string media = "all") { return string.Format("", input, media); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/MathFilters.cs ================================================ using System; using System.Globalization; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static partial class MathFilters { public static object Round(object input, int digits = 0) { if (input != null) { input = Math.Round(Convert.ToDouble(input, CultureInfo.InvariantCulture), digits); } return input; } public static object Ceil(object input) { if (input != null) { input = Math.Ceiling(Convert.ToDouble(input, CultureInfo.InvariantCulture)); } return input; } public static object Floor(object input) { if (input != null) { input = Math.Floor(Convert.ToDouble(input, CultureInfo.InvariantCulture)); } return input; } public static object Abs(object input) { if (input != null) { input = Math.Abs(Convert.ToDouble(input, CultureInfo.InvariantCulture)); } return input; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/MoneyFilters.cs ================================================ using System; using System.Globalization; using Scriban; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { /// /// https://docs.shopify.com/themes/liquid-documentation/filters/money-filters /// public static partial class MoneyFilters { /// /// Formats the price based on the shop's HTML without currency setting. /// {{ 145 | money }} /// /// /// /// public static string Money(TemplateContext context, object input, string currencyCode = null) { var money = GetMoney(context, input, currencyCode); return money == null ? null : money.ToString(); } public static string MoneyWithoutDecimalPart(TemplateContext context, object input, string currencyCode = null) { var money = GetMoney(context, input, currencyCode); return money == null ? null : money.FormattedAmountWithoutPoint; } public static string MoneyWithCurrency(TemplateContext context, object input, string currencyCode = null) { return Money(context, input, currencyCode); } public static string MoneyWithoutCurrency(TemplateContext context, object input, string currencyCode = null) { var money = GetMoney(context, input, currencyCode); return money == null ? null : money.FormattedAmountWithoutCurrency; } private static Money GetMoney(TemplateContext context, object input, string currencyCode = null) { if (input == null) { return null; } var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; if (input is Money money) { return money; } else { var amount = Convert.ToDecimal(input, CultureInfo.InvariantCulture); var currency = currencyCode == null ? themeEngine.WorkContext.CurrentCurrency : new Currency(themeEngine.WorkContext.CurrentLanguage, currencyCode); return new Money(amount, currency); } } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/StandardFilters.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Net; using System.Text.RegularExpressions; using System.Xml.XPath; using Scriban; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { public static partial class StandardFilters { /// /// Return the size of an array or of an string /// /// /// public static int Size(object input) { if (input is string str) { return str.Length; } return input is IEnumerable enumerable ? enumerable.Cast().Count() : 0; } /// /// Return a Part of a String /// /// /// /// /// public static string Slice(string input, int start, int len = 1) { if (input == null || start > input.Length) { return null; } if (start < 0) { start += input.Length; } if (start + len > input.Length) { len = input.Length - start; } return input.Substring(start, len); } /// /// convert a input string to DOWNCASE /// /// /// public static string Downcase(string input) { return input == null ? input : input.ToLower(); } /// /// convert a input string to UPCASE /// /// /// public static string Upcase(string input) { return input == null ? input : input.ToUpper(); } /// /// capitalize words in the input sentence /// /// /// public static string Capitalize(string input) { if (input.IsNullOrWhiteSpace()) { return input; } return string.IsNullOrEmpty(input) ? input : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(input); } public static string Escape(string input) { if (string.IsNullOrEmpty(input)) { return input; } try { return WebUtility.HtmlEncode(input); } catch { return input; } } public static string H(string input) { return Escape(input); } /// /// Truncates a string down to x characters /// /// /// /// /// public static string Truncate(string input, int length = 50, string truncateString = "...") { if (string.IsNullOrEmpty(input)) { return input; } var l = length - truncateString.Length; var startIndex = l < 0 ? 0 : l; return input.Length > length ? input.Substring(0, startIndex) + truncateString : input; } public static string Truncatewords(string input, int words = 15, string truncateString = "...") { if (string.IsNullOrEmpty(input)) { return input; } var wordList = input.Split(' ').ToList(); var l = words < 0 ? 0 : words; return wordList.Count > l ? string.Join(" ", wordList.Take(l).ToArray()) + truncateString : input; } /// /// Split input string into an array of substrings separated by given pattern. /// /// /// /// public static string[] Split(string input, string pattern) { return input.IsNullOrWhiteSpace() ? new[] { input } : input.Split(new[] { pattern }, StringSplitOptions.RemoveEmptyEntries); } public static string StripHtml(object input) { if (input == null) { return string.Empty; } var inputString = input.ToString(); return inputString.IsNullOrWhiteSpace() ? inputString : Regex.Replace(inputString, @"<.*?>", string.Empty); } /// /// Remove all newlines from the string /// /// /// public static string StripNewlines(string input) { return input.IsNullOrWhiteSpace() ? input : Regex.Replace(input, @"(\r?\n)", string.Empty); } /// /// Join elements of the array with a certain character between them /// /// /// /// public static string Join(IEnumerable input, string glue = " ") { if (input == null) { return null; } var castInput = input.Cast(); return string.Join(glue, castInput); } /// /// Sort elements of the array /// provide optional property with which to sort an array of hashes or drops /// /// /// /// public static IEnumerable Sort(object input, string property = null) { var ary = input is IEnumerable enumerable ? enumerable.Flatten().Cast().ToList() : new List(new[] { input }); if (!ary.Any()) { return ary; } if (string.IsNullOrEmpty(property)) { ary.Sort(); } else if ((ary.All(o => o is IDictionary)) && ((IDictionary)ary.First()).Contains(property)) { ary.Sort((a, b) => Comparer.Default.Compare(((IDictionary)a)[property], ((IDictionary)b)[property])); } else if (ary.All(o => o.RespondTo(property))) { ary.Sort((a, b) => Comparer.Default.Compare(a.Send(property), b.Send(property))); } return ary; } /// /// Map/collect on a given property /// /// /// /// public static IEnumerable Map(IEnumerable input, string property) { if (input == null) { return input; } var ary = input.Cast().ToList(); if (!ary.Any()) { return ary; } if ((ary.All(o => o is IDictionary)) && ((IDictionary)ary.First()).Contains(property)) { return ary.Select(e => ((IDictionary)e)[property]); } return ary.All(o => o.RespondTo(property)) ? ary.Select(e => e.Send(property)) : ary; } /// /// Replace occurrences of a string with another /// /// /// /// /// public static string Replace(object input, string @string, string replacement = "") { if (input == null) { return null; } if (string.IsNullOrEmpty(input.ToString()) || string.IsNullOrEmpty(@string)) { return input.ToString(); } input = input.ToString().Replace(@string, replacement); return input.ToString(); } /// /// Replace the first occurence of a string with another /// /// /// /// /// public static string ReplaceFirst(string input, string @string, string replacement = "") { if (string.IsNullOrEmpty(input) || string.IsNullOrEmpty(@string)) { return input; } var doneReplacement = false; return Regex.Replace(input, @string, m => { if (doneReplacement) { return m.Value; } doneReplacement = true; return replacement; }); } /// /// Remove a substring /// /// /// /// public static string Remove(string input, string @string) { return input.IsNullOrWhiteSpace() ? input : input.Replace(@string, string.Empty); } /// /// Remove the first occurrence of a substring /// /// /// /// public static string RemoveFirst(string input, string @string) { return input.IsNullOrWhiteSpace() ? input : ReplaceFirst(input, @string, string.Empty); } /// /// Add one string to another /// /// /// /// public static string Append(object input, object @string) { return input + @string.ToSafeString(); } /// /// Prepend a string to another /// /// /// /// public static string Prepend(object input, object @string) { return @string.ToSafeString() + input; } /// /// Add
tags in front of all newlines in input string ///
/// /// public static string NewlineToBr(string input) { return input.IsNullOrWhiteSpace() ? input : Regex.Replace(input, @"(\r?\n)", "
$1"); } /// /// Formats a date using a .NET date format string /// /// /// /// public static string Date(TemplateContext context, object input, string format) { if (input == null) { return null; } if (format.IsNullOrWhiteSpace()) { return input.ToString(); } switch (format) { case "long": format = "f"; break; } var result = input.ToString(); DateTime date; var dateParsed = false; if (input.ToString().Equals("now", StringComparison.OrdinalIgnoreCase)) { date = DateTime.Now; dateParsed = true; } else if (DateTime.TryParse(input.ToString(), out date)) { dateParsed = true; } if (Regex.IsMatch(format, @"^[\w\d_\-]+$")) { var key = string.Concat("date_formats.", format); var newFormat = TranslationFilter.T(context, key); if (!newFormat.IsNullOrEmpty() && newFormat != key) { format = newFormat; } } if (dateParsed) { var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; TryFormatDateTime(date, format, out result, CultureInfo.GetCultureInfo(themeEngine.WorkContext.CurrentLanguage.CultureName)); } return result; } /// /// Get the first element of the passed in array /// /// Example: /// {{ product.images | first | to_img }} /// /// /// public static object First(IEnumerable array) { return array?.Cast().FirstOrDefault(); } /// /// Get the last element of the passed in array /// /// Example: /// {{ product.images | last | to_img }} /// /// /// public static object Last(IEnumerable array) { return array?.Cast().LastOrDefault(); } /// /// Addition /// /// /// /// public static object Plus(object input, object operand) { return DoMathsOperation(input, operand, Expression.Add); } /// /// Subtraction /// /// /// /// public static object Minus(object input, object operand) { return DoMathsOperation(input, operand, Expression.Subtract); } /// /// Multiplication /// /// /// /// public static object Times(object input, object operand) { return DoMathsOperation(input, operand, Expression.Multiply); } /// /// Division /// /// /// /// public static object DividedBy(object input, object operand) { return DoMathsOperation(input, operand, Expression.Divide); } public static object Modulo(object input, object operand) { return DoMathsOperation(input, operand, Expression.Modulo); } private static object DoMathsOperation(object input, object operand, Func operation) { input = input.ToNumber(); operand = operand.ToNumber(); return input == null || operand == null ? null : ExpressionUtility.CreateExpression(operation, input.GetType(), operand.GetType(), input.GetType(), true) .DynamicInvoke(input, operand); } private static void TryFormatDateTime(DateTime input, string format, out string formated, IFormatProvider formatProvider = null) { if (format == null) { throw new ArgumentNullException(nameof(input)); } formated = null; try { formated = input.ToString(format, formatProvider); } catch { //Swallow any exception } } } /// /// Some of this code was taken from http://www.yoda.arachsys.com/csharp/miscutil/usage/genericoperators.html. /// General purpose Expression utilities /// internal static class ExpressionUtility { /// /// Create a function delegate representing a binary operation /// /// Body factory /// /// /// /// /// If no matching operation is possible, attempt to convert /// TArg1 and TArg2 to TResult for a match? For example, there is no /// "decimal operator /(decimal, int)", but by converting TArg2 (int) to /// TResult (decimal) a match is found. /// /// Compiled function delegate public static Delegate CreateExpression(Func body, Type leftType, Type rightType, Type resultType, bool castArgsToResultOnFailure) { var lhs = Expression.Parameter(leftType, "lhs"); var rhs = Expression.Parameter(rightType, "rhs"); Expression lhsExpression = lhs; Expression rhsExpression = rhs; UpdateVisit(ref lhsExpression, ref rhsExpression); try { try { return Expression.Lambda(body(lhsExpression, rhsExpression), lhs, rhs).Compile(); } catch (InvalidOperationException) { if (castArgsToResultOnFailure && !( // if we show retry leftType == resultType && // and the args aren't rightType == resultType)) { // already "TValue, TValue, TValue"... // convert both lhs and rhs to TResult (as appropriate) var castLhs = leftType == resultType ? lhs : (Expression)Expression.Convert(lhs, resultType); var castRhs = rightType == resultType ? rhs : (Expression)Expression.Convert(rhs, resultType); return Expression.Lambda(body(castLhs, castRhs), lhs, rhs).Compile(); } throw; } } catch (Exception ex) { var msg = ex.Message; // avoid capture of ex itself return (Action)(delegate { throw new InvalidOperationException(msg); }); } } private static void UpdateVisit(ref Expression left, ref Expression right) { var leftTypeCode = Type.GetTypeCode(left.Type); var rightTypeCode = Type.GetTypeCode(right.Type); if (leftTypeCode == rightTypeCode) { return; } if (leftTypeCode > rightTypeCode && leftTypeCode != TypeCode.String) { right = Expression.Convert(right, left.Type); } else { left = Expression.Convert(left, right.Type); } } } internal static class ObjectExtensionMethods { public static bool RespondTo(this object value, string member, bool ensureNoParameters = true) { if (value == null) { throw new ArgumentNullException("value"); } var type = value.GetType(); var methodInfo = type.GetMethod(member); if (methodInfo != null && (!ensureNoParameters || !methodInfo.GetParameters().Any())) { return true; } var propertyInfo = type.GetProperty(member); return propertyInfo != null && propertyInfo.CanRead; } public static object Send(this object value, string member, object[] parameters = null) { if (value == null) { throw new ArgumentNullException("value"); } var type = value.GetType(); var methodInfo = type.GetMethod(member); if (methodInfo != null) { return methodInfo.Invoke(value, parameters); } var propertyInfo = type.GetProperty(member); return propertyInfo?.GetValue(value, null); } } internal static class StringExtensions { public static bool IsNullOrWhiteSpace(this string s) { return string.IsNullOrEmpty(s) || s.Trim().Length == 0; } public static string ToSafeString(this object s) { return s == null ? "" : s.ToString(); } public static object ToNumber(this object s) { if (s is double) { return s; } else if (s is float) { return s; } else if (s is decimal) { return s; } else if (s is int) { return s; } else if (s is Money money) { return money.Amount; } else if (s is string) { var match = Regex.Match(s as string, string.Format("(?-mix:{0})", @"^([+-]?\d[\d\.|\,]+)$")); if (match.Success) { // For cultures with "," as the decimal separator, allow // both "," and "." to be used as the separator. // First try to parse using current culture. if (float.TryParse(match.Groups[1].Value, out var result)) { return result; } // If that fails, try to parse using invariant culture. return float.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); } match = Regex.Match(s as string, string.Format("(?-mix:{0})", @"^([+-]?\d+).*$")); if (match.Success) { return Convert.ToInt32(match.Groups[1].Value); } } return 0; } private static double Evaluate(string expression) { var xsltExpression = string.Format("number({0})", new Regex(@"([\+\-\*])").Replace(expression, " ${1} ") .Replace("/", " div ") .Replace("%", " mod ")); return (double)new XPathDocument (new StringReader("")) .CreateNavigator() .Evaluate(xsltExpression); } } internal static class EnumerableExtensionMethods { public static IEnumerable Flatten(this IEnumerable array) { foreach (var item in array) { if (item is string) { yield return item; } else if (item is IEnumerable enumerableItem) { foreach (var subItem in Flatten(enumerableItem)) { yield return subItem; } } else { yield return item; } } } public static void EachWithIndex(this IEnumerable array, Action callback) { var index = 0; foreach (var item in array) { callback(item, index); ++index; } } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/StringFilters.cs ================================================ using System.Security.Cryptography; using System.Text; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { /// /// String filters are used to manipulate outputs and variables of the string type. /// https://docs.shopify.com/themes/liquid-documentation/filters/string-filters /// public static partial class StringFilters { /// /// Converts a string into CamelCase. /// {{ 'coming-soon' | camelcase }} /// Result - ComingSoon /// /// /// public static string Camelize(string input) { if (string.IsNullOrEmpty(input)) { return input; } var result = new StringBuilder(); var strArray = input.Split(separator: '_', '-'); foreach (var word in strArray) { result.Append(word.Substring(0, 1).ToUpper() + word.Substring(1)); } return result.ToString(); } public static string Handle(string input) { return Handleize(input); } /// /// Formats a string into a handle. /// Input ///{{ '100% M & Ms!!!' | handleize }} /// Output /// 100-m-ms /// /// /// public static string Handleize(string input) { if (string.IsNullOrEmpty(input)) { return input; } return input.Handelize(); } /// /// Converts a string into an MD5 hash. /// /// /// public static string Md5(string input) { if (string.IsNullOrEmpty(input)) { return input; } byte[] hash; using (var md5 = MD5.Create()) { hash = md5.ComputeHash(Encoding.UTF8.GetBytes(input)); } return hash.ToHex(upperCase: false); } /// /// Outputs the singular or plural version of a string based on the value of a number. The first parameter is the singular string and the second parameter is the plural string. /// /// /// /// /// public static string Pluralize(int input, string singular, string plural) { return input == 1 ? singular : plural; } /// /// Strips tabs, spaces, and newlines (all whitespace) from the left and right side of a string. /// /// /// public static string Strip(string input) { if (string.IsNullOrEmpty(input)) { return input; } return input.Trim(); } public static string Format(object input, string format) { if (input == null) return null; else if (string.IsNullOrWhiteSpace(format)) return input.ToString(); return string.Format("{0:" + format + "}", input); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/TranslationFilter.cs ================================================ using Scriban; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Filters { /// /// Filter used for localization /// public static partial class TranslationFilter { public static string T(TemplateContext context, string key, params object[] variables) { var result = key; var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; var localization = themeAdaptor.ReadLocalization(); if (localization != null) { //Backward compatibility "" | t returns entire localization JSON if (string.IsNullOrEmpty(key)) { result = localization.ToString(); } else if (key.IsValidJsonPath()) { result = (localization.SelectToken(key, errorWhenNoMatch: false) ?? key).ToString(); if (!variables.IsNullOrEmpty()) { result = string.Format(result, variables); } } } return result; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Filters/UrlFilters.cs ================================================ using System; using System.Linq; using Scriban; using VirtoCommerce.LiquidThemeEngine.Extensions; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; using storefrontModel = VirtoCommerce.Storefront.Model; namespace VirtoCommerce.LiquidThemeEngine.Filters { /// /// https://docs.shopify.com/themes/liquid-documentation/filters/url-filters /// public static partial class UrlFilters { public static string SizeImageLink(string input, string size) { if (input != null) { input = input.AddSuffixToFileUrl("_" + size.TrimStart('_')); } return input; } /// /// Returns the URL of an image. Accepts an image size as a parameter. The img_url filter can be used on the following objects: /// product, variant, line item, collection, image /// /// /// /// public static string ImgUrl(object input, string type = null) { if (input == null) { return null; } var retVal = input.ToString(); if (!string.IsNullOrEmpty(retVal)) { if (!string.IsNullOrEmpty(type)) { retVal = retVal.AddSuffixToFileUrl(string.Format("_{0}", type)); } retVal = retVal.RemoveLeadingUriScheme(); } return retVal; } /// /// Generates an HTML link. The first parameter is the URL of the link, and the optional second parameter is the title of the link. /// /// /// /// /// public static string LinkTo(object input, string link, string title = "") { return string.Format("{2}", link, title, input); } /// /// Returns the URL of a file in the "assets" folder of a theme. /// {{ 'shop.css' | asset_url }} /// /// /// public static string AssetUrl(TemplateContext context, string input) { string retVal = null; if (input != null) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; retVal = themeAdaptor.GetAssetAbsoluteUrl(input); } return retVal; } /// /// Returns the URL of a file in the "assets/static" folder of a theme. /// {{ 'shop.css' | static_asset_url }} /// /// /// public static string StaticAssetUrl(TemplateContext context, string input) { string retVal = null; if (input != null) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; retVal = themeAdaptor.GetAssetAbsoluteUrl("static/" + input.TrimStart('/')); } return retVal; } /// /// Returns the URL of a file. /// /// /// public static string FileUrl(TemplateContext context, string input) { return AssetUrl(context, input); } /// /// Method for switching between multiple stores /// /// /// /// /// public static string StoreAbsoluteUrl(TemplateContext context, string input, string storeId = null, string languageCode = null) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; Store store = null; if (!string.IsNullOrEmpty(storeId)) { store = themeAdaptor.WorkContext.AllStores.FirstOrDefault(x => string.Equals(x.Id, storeId, StringComparison.InvariantCultureIgnoreCase)); } store = store ?? themeAdaptor.WorkContext.CurrentStore; var retVal = AbsoluteUrl(context, input, storeId, languageCode); var isHttps = themeAdaptor.WorkContext.RequestUrl.Scheme == Uri.UriSchemeHttps; //If store has defined url need redirect to it if (isHttps) { retVal = string.IsNullOrEmpty(store.SecureUrl) ? retVal : store.SecureUrl; } else { retVal = string.IsNullOrEmpty(store.Url) ? retVal : store.Url; } return retVal; } public static string FullUrl(TemplateContext context, string input, string storeId = null, string languageCode = null) { var absoluteUrl = AbsoluteUrl(context, input, storeId, languageCode); var themeEngine = (ShopifyLiquidThemeEngine)context.TemplateLoader; var workContext = themeEngine.WorkContext; var fullUrl = new Uri(workContext.RequestUrl, absoluteUrl); return fullUrl.AbsoluteUri; } /// /// Get app absolute storefront url with specified store and language /// /// /// /// /// public static string AbsoluteUrl(TemplateContext context, string input, string storeId = null, string languageCode = null) { if (input == null) { return string.Empty; } var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; Store store = null; storefrontModel.Language language = null; if (!string.IsNullOrEmpty(storeId)) { store = themeAdaptor.WorkContext.AllStores.FirstOrDefault(x => string.Equals(x.Id, storeId, StringComparison.InvariantCultureIgnoreCase)); } store = store ?? themeAdaptor.WorkContext.CurrentStore; if (!string.IsNullOrEmpty(languageCode)) { language = store.Languages.FirstOrDefault(x => string.Equals(x.CultureName, languageCode, StringComparison.InvariantCultureIgnoreCase)); } language = language ?? themeAdaptor.WorkContext.CurrentLanguage; var retVal = themeAdaptor.UrlBuilder.ToAppAbsolute(input, store, language); return retVal; } public static string ProductImgUrl(object input, string type = null) { return ImgUrl(input, type); } /// /// Appends hash of file content as file version to invalidate browser cache when file changed. /// /// /// public static string AppendVersion(TemplateContext context, string input) { if (input == null) { return string.Empty; } var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; var basePath = themeAdaptor.GetAssetAbsoluteUrl(""); var relativePath = input.StartsWith(basePath) ? input.Remove(0, basePath.Length) : input; var hash = themeAdaptor.GetAssetHash(relativePath); return input.Contains('?') ? $"{input}&v={hash}" : $"{input}?v={hash}"; } /// /// Generates an relative url with query string that contains serialized ProductSearchCriteria as parameters /// and add a new given aggregation item value to terms parameter /// /// /// aggregation item /// example: /collection?terms=color:Red public static string AddTermUrl(TemplateContext context, string facetName, string term) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; var result = themeAdaptor.WorkContext.RequestUrl.SetQueryParameter("filter", $"{facetName}:{term}"); return result?.PathAndQuery; } /// /// Generates an relative url with query string that contains serialized ProductSearchCriteria as parameters /// and remove a given aggregation item value from terms parameter /// /// /// aggregation item /// example: /collection public static string RemoveTermUrl(TemplateContext context, string facetName, string term) { var themeAdaptor = (ShopifyLiquidThemeEngine)context.TemplateLoader; var result = themeAdaptor.WorkContext.RequestUrl.SetQueryParameter("filter", null); return result?.PathAndQuery; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/ILiquidThemeEngine.cs ================================================ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace VirtoCommerce.LiquidThemeEngine { public interface ILiquidThemeEngine { IEnumerable DiscoveryPaths { get; } string ResolveTemplatePath(string templateName); ValueTask RenderTemplateByNameAsync(string templateName, object context); ValueTask RenderTemplateAsync(string templateContent, string templatePath, object context); IDictionary GetSettings(string defaultValue = null); JObject ReadLocalization(); Task GetAssetStreamAsync(string filePath); string GetAssetHash(string filePath); string GetAssetAbsoluteUrl(string assetName); } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/ILiquidViewEngine.cs ================================================ using Microsoft.AspNetCore.Mvc.ViewEngines; namespace VirtoCommerce.LiquidThemeEngine { public interface ILiquidViewEngine : IViewEngine { } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/ISassFileManager.cs ================================================ using LibSassHost; namespace VirtoCommerce.LiquidThemeEngine { public interface ISassFileManager : IFileManager { string CurrentDirectory { get; set; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/JsonConverters/MutablePagedListAsArrayJsonConverter.cs ================================================ using System; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.JsonConverters { /// ///This converter is designed to force serialize all derived types from IMutablePagedLists as array. ///Because the main type MutablePagedList<> also derived from IDitionary that causes the default Json serializer to tries to serialize as a dictionary first. /// public class MutablePagedListAsArrayJsonConverter : JsonConverter { private readonly JsonSerializerSettings _jsonSettings; public MutablePagedListAsArrayJsonConverter() { } public MutablePagedListAsArrayJsonConverter(JsonSerializerSettings jsonSettings) { _jsonSettings = jsonSettings; } public override bool CanConvert(Type objectType) { return typeof(IMutablePagedList).IsAssignableFrom(objectType); } public override bool CanWrite => true; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (_jsonSettings != null) { serializer = JsonSerializer.Create(_jsonSettings); } var toListMethod = typeof(Enumerable).GetMethod("ToList"); var constructedToList = toListMethod.MakeGenericMethod(value.GetType().GetGenericArguments()[0]); var list = constructedToList.Invoke(null, new object[] { value }); //Force serialize MutablePagedList type as array, instead of dictionary var result = JArray.FromObject(list, serializer); result.WriteTo(writer); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { throw new NotImplementedException(); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/LiquidThemeEngineOptions.cs ================================================ using System; using System.Collections.Generic; namespace VirtoCommerce.LiquidThemeEngine { public class LiquidThemeEngineOptions { public string DefaultLayout { get; set; } = "theme"; public IList TemplatesDiscoveryFolders { get; set; } = new List() { "templates", "snippets", "layout", "assets" }; public string ThemesAssetsRelativeUrl { get; set; } = "~/themes/assets"; public bool RethrowLiquidRenderErrors { get; set; } = false; /// /// The path to the base theme that will be used to discover the theme resources not found by the path of theme for current store. /// This parameter can be used for theme inheritance logic. /// Example values: /// Electronics/default -> wwwroot/cms-content/Themes/Electronics/default /// default-> wwwroot/cms-content/Themes/default /// public string BaseThemePath { get; set; } /// /// Original description: /// The name of the base theme that will be used to discover the theme resources not found by the path of theme for current store. /// This parameter can be used for theme inheritance logic. /// Example values: default_theme -> wwwroot/cms-content/default_theme /// /// How it actually worked: /// Storefront used this parameter as a store name, i.e. Electronics -> wwwroot/cms-content/Themes/Electronics/default /// [Obsolete("Obsolete. Use BaseThemePath instead.")] public string BaseThemeName { get; set; } /// /// Set to true if you want to merge current theme settings with base theme settings instead of placement /// public bool MergeBaseSettings { get; set; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/LiquidThemedView.cs ================================================ using System; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewEngines; using VirtoCommerce.LiquidThemeEngine.Scriban; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine { public class LiquidThemedView : IView { private readonly ILiquidThemeEngine _liquidThemeEngine; private readonly string _viewName; private readonly bool _isMainPage; private readonly IWorkContextAccessor _workContextAccessor; private readonly IStorefrontUrlBuilder _urlBuilder; public LiquidThemedView(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ILiquidThemeEngine themeEngine, string viewName, string path, bool isMainPage) { if (string.IsNullOrEmpty(viewName)) { throw new ArgumentNullException(nameof(viewName)); } _workContextAccessor = workContextAccessor; _urlBuilder = urlBuilder; _liquidThemeEngine = themeEngine ?? throw new ArgumentNullException(nameof(themeEngine)); _viewName = viewName; _isMainPage = isMainPage; Path = path; } public string Path { get; private set; } #region IView members public virtual Task RenderAsync(ViewContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return RenderInternalAsync(context); } #endregion protected virtual async Task RenderInternalAsync(ViewContext context) { var workContext = _workContextAccessor.WorkContext; //Set current template workContext.Template = _viewName; workContext.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); var formErrors = context.ViewData.ModelState.Where(x => x.Value.Errors.Any()) .SelectMany(x => x.Value.Errors.Select(y => new FormError { Code = x.Key.PascalToKebabCase(), Description = y.ErrorMessage })).ToList(); if (workContext.Form == null) { workContext.Form = new Form(); } workContext.Form.PostedSuccessfully = !string.Equals(context.HttpContext.Request.Method, "GET", StringComparison.InvariantCultureIgnoreCase); if (formErrors.Any()) { workContext.Form.Errors.AddRange(formErrors); workContext.Form.PostedSuccessfully = false; } //Add settings to context workContext.Settings = _liquidThemeEngine.GetSettings(); if (string.IsNullOrEmpty(_workContextAccessor.WorkContext.ErrorMessage)) { workContext.ErrorMessage = workContext.Form.Errors.FirstOrDefault()?.Description; } var scriptObject = workContext.ToScriptObject(); var result = await _liquidThemeEngine.RenderTemplateByNameAsync(_viewName, scriptObject); // don't use layouts for partial views when masterViewName is not specified if (_isMainPage) { var masterViewName = workContext.Layout ?? "theme"; var headerTemplate = _liquidThemeEngine.ResolveTemplatePath("content_header") == null ? "" : await _liquidThemeEngine.RenderTemplateByNameAsync("content_header", scriptObject); //add special placeholder 'content_for_layout' to content it will be replaced in master page by main content scriptObject.Add("content_for_layout", result); scriptObject.Add("content_for_header", headerTemplate); result = await _liquidThemeEngine.RenderTemplateByNameAsync(masterViewName, scriptObject); } await context.Writer.WriteAsync(result); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/LiquidThemedViewEngine.cs ================================================ using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewEngines; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine { public class LiquidThemedViewEngine : ILiquidViewEngine { private readonly ILiquidThemeEngine _themeEngine; private readonly IWorkContextAccessor _workContextAccessor; private readonly IStorefrontUrlBuilder _urlBuilder; public LiquidThemedViewEngine(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ILiquidThemeEngine themeEngine) { _themeEngine = themeEngine; _workContextAccessor = workContextAccessor; _urlBuilder = urlBuilder; } #region IViewEngine members public ViewEngineResult FindView(ActionContext context, string viewName, bool isMainPage) { return InnerGetView(viewName, isMainPage); } public ViewEngineResult GetView(string executingFilePath, string viewPath, bool isMainPage) { return InnerGetView(viewPath, isMainPage); } #endregion protected ViewEngineResult InnerGetView(string view, bool isMainPage) { var searchedLocations = Enumerable.Empty(); //Do not handle without a set WorkContext if (_workContextAccessor.WorkContext != null) { var path = _themeEngine.ResolveTemplatePath(view); if (!string.IsNullOrEmpty(path)) { return ViewEngineResult.Found(view, new LiquidThemedView(_workContextAccessor, _urlBuilder, _themeEngine, view, path, isMainPage)); } searchedLocations = _themeEngine.DiscoveryPaths.ToArray(); } return ViewEngineResult.NotFound(view, searchedLocations); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Objects/Paginate.cs ================================================ using System; using System.Collections.Generic; using PagedList.Core; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Objects { /// /// https://docs.shopify.com/themes/liquid-documentation/objects/paginate /// The paginate tag's navigation is built using the attributes of the paginate object. You can also use the default_pagination filter for a quicker alternative. /// public partial class Paginate : ValueObject { private readonly IPagedList _pagedList; public Paginate(IPagedList pagedList) { _pagedList = pagedList; Parts = new List(); } /// /// Returns the number of the current page. /// public int CurrentPage { get { return _pagedList.PageNumber; } } /// /// Returns the total number of items that are on the pages previous to the current one. For example, if you are paginating by 5 and are on the third page, paginate.current_offset would return 10. /// public int CurrentOffset { get { return _pagedList.FirstItemOnPage; } } /// /// Returns the total number of items to be paginated. For example, if you are paginating a collection of 120 products, paginate.items would return 120. /// public int Items { get { return _pagedList.TotalItemCount; } } /// /// Returns the number of items displayed per page. /// public int PageSize { get { return _pagedList.PageSize; } } /// /// Returns the part variable for the Next link in the pagination navigation. /// public Part Next { get { Part retVal = null; if (!_pagedList.IsLastPage) { retVal = Parts[CurrentPage]; } return retVal; } } /// /// Returns the part variable for the Previous link in the pagination navigation. /// public Part Previous { get { Part retVal = null; if (!_pagedList.IsFirstPage) { retVal = Parts[Math.Min(Parts.Count - 1, Math.Max(0, CurrentPage - 2))]; } return retVal; } } /// /// Returns the number of pages created by the pagination tag. /// public int Pages { get { return _pagedList.PageCount; } } /// /// Returns an array of all parts of the pagination. A part is a component used to build the navigation for the pagination. /// public List Parts { get; set; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Objects/Part.cs ================================================ using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.LiquidThemeEngine.Objects { /// /// https://docs.shopify.com/themes/liquid-documentation/objects/part /// Each part returned by the paginate.parts array represents a link in the pagination's navigation. /// public partial class Part : ValueObject { /// /// Returns true if the part is a link, returns false if it is not. /// public bool IsLink { get; set; } /// /// Returns the title of the part. /// public string Title { get; set; } /// /// Returns the URL of the part. /// public string Url { get; set; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/SassFileManager.cs ================================================ using System; using System.IO; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.LiquidThemeEngine { public class SassFileManager : ISassFileManager { private readonly IContentBlobProvider _contentBlobProvider; public bool SupportsConversionToAbsolutePath { get; } = false; public string CurrentDirectory { get; set; } public SassFileManager(IContentBlobProvider contentBlobProvider) { _contentBlobProvider = contentBlobProvider; } public string GetCurrentDirectory() => CurrentDirectory; public bool FileExists(string path) { // Workaround for directories if (string.IsNullOrEmpty(Path.GetExtension(path))) { return false; } return _contentBlobProvider.PathExists(path); } public bool IsAbsolutePath(string path) { return Path.GetDirectoryName(path).StartsWith(CurrentDirectory); } public string ToAbsolutePath(string path) { throw new NotImplementedException(); } public string ReadFile(string path) { return _contentBlobProvider.OpenRead(path).ReadToString(); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/Scriban/WorkContextConverter.cs ================================================ using System; using Scriban.Runtime; using VirtoCommerce.LiquidThemeEngine.Filters; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.LiquidThemeEngine.Scriban { public static class WorkContextConverter { public static ScriptObject ToScriptObject(this WorkContext workContext) { var scriptObject = new ScriptObject(); scriptObject.Import(workContext); scriptObject.Import(typeof(CommonFilters)); scriptObject.Import(typeof(CommerceFilters)); scriptObject.Import(typeof(TranslationFilter)); scriptObject.Import(typeof(UrlFilters)); scriptObject.Import(typeof(MoneyFilters)); scriptObject.Import(typeof(HtmlFilters)); scriptObject.Import(typeof(StringFilters)); scriptObject.Import(typeof(ArrayFilters)); scriptObject.Import(typeof(MathFilters)); scriptObject.Import(typeof(StandardFilters)); scriptObject.Import(typeof(FeatureFilter)); scriptObject.Import(typeof(DataSourceFilter)); scriptObject.SetValue("context", scriptObject, true); scriptObject.SetValue("blank", EmptyScriptObject.Default, true); //Store special layout setter action in the context, it is allows to set the WorkContext.Layout property from template during rendering in the CommonFilters.Layout function Action layoutSetter = (layout) => workContext.Layout = layout; scriptObject.Add("layout_setter", layoutSetter); return scriptObject; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/SettingsManager.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.LiquidThemeEngine { public static class SettingsManager { public class Settings { public Preset CurrentPreset { get; set; } public IList Presets { get; set; } = new List(); } public class Preset { public string Name { get; set; } public JObject Json { get; set; } } public static JObject Merge(JObject baseJson, JObject currentJson) { if (baseJson == null) { throw new ArgumentNullException(nameof(baseJson)); } if (currentJson == null) { throw new ArgumentNullException(nameof(currentJson)); } var baseSettings = ReadSettings(baseJson); var currentSettings = ReadSettings(currentJson); //Change the current preset for base doc according to head preset value if it specified if (!string.IsNullOrEmpty(currentSettings.CurrentPreset.Name)) { baseSettings.CurrentPreset = baseSettings.Presets.FirstOrDefault(x => x.Name == currentSettings.CurrentPreset.Name); } var result = baseSettings.CurrentPreset?.Json ?? new JObject(); result.Merge(currentSettings.CurrentPreset.Json, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge }); return result; } public static Settings ReadSettings(JObject json) { var result = new Settings { CurrentPreset = new Preset { Json = json } }; if (json.GetValue("presets") is JObject presetsJson) { var allPresetsJsonProperties = presetsJson.Children().Cast().ToList(); foreach (var presetJsonProperty in allPresetsJsonProperties) { var preset = new Preset { Name = presetJsonProperty.Name, Json = presetJsonProperty.Value as JObject }; result.Presets.Add(preset); } } var currentPresetJsonToken = json.GetValue("current"); if (currentPresetJsonToken is JValue currentPresetJsonValue) { var presetName = currentPresetJsonValue.Value.ToString(); var currentPresetJson = result.Presets.FirstOrDefault(x => x.Name == presetName)?.Json; if (currentPresetJson == null && result.Presets.Any()) { throw new StorefrontException($"Setting preset with name '{presetName}' not found"); } result.CurrentPreset.Name = presetName; result.CurrentPreset.Json = currentPresetJson ?? json; } if (currentPresetJsonToken is JObject) { result.CurrentPreset.Json = currentPresetJsonToken as JObject; } return result; } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/ShopifyLiquidThemeEngine.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using DotLiquid.ViewEngine.Exceptions; using GraphQL.Client.Abstractions; using LibSassHost; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Scriban; using Scriban.Parsing; using Scriban.Runtime; using VirtoCommerce.LiquidThemeEngine.Scriban; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Common.Exceptions; using VirtoCommerce.Storefront.Model.Features; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.LiquidThemeEngine { /// /// Shopify compliant theme folder structure and all methods for rendering /// assets - storages for css, images and other assets /// config - contains theme configuration /// layout - master pages and layouts /// locales - localization resources /// snippets - snippets - partial views /// templates - view templates /// public class ShopifyLiquidThemeEngine : ILiquidThemeEngine, ITemplateLoader { private readonly LiquidThemeEngineOptions _options; private static readonly Regex _isLiquid = new Regex("[{}|]", RegexOptions.Compiled); private const string _liquidTemplateFormat = "{0}.liquid"; private readonly IWorkContextAccessor _workContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor; private readonly IStorefrontMemoryCache _memoryCache; private readonly IContentBlobProvider _themeBlobProvider; private readonly ISassFileManager _sassFileManager; private readonly IFeaturesAgent _featuresAgent; private readonly IGraphQLClient _graphQLClient; public ShopifyLiquidThemeEngine( IStorefrontMemoryCache memoryCache , IWorkContextAccessor workContextAccessor , IHttpContextAccessor httpContextAccessor , IStorefrontUrlBuilder storeFrontUrlBuilder , IContentBlobProvider contentBlobProvider , ISassFileManager sassFileManager , IOptions options , IFeaturesAgent featuresAgent , IGraphQLClient graphQLClient) { _workContextAccessor = workContextAccessor; _httpContextAccessor = httpContextAccessor; UrlBuilder = storeFrontUrlBuilder; _options = options.Value; _memoryCache = memoryCache; _themeBlobProvider = contentBlobProvider; _sassFileManager = sassFileManager; _featuresAgent = featuresAgent; _graphQLClient = graphQLClient; SassCompiler.FileManager = sassFileManager; } /// /// Main work context /// public WorkContext WorkContext => _workContextAccessor.WorkContext; /// /// Current HttpContext /// public HttpContext HttpContext => _httpContextAccessor.HttpContext; public IGraphQLClient GraphQLClient => _graphQLClient; /// /// Store url builder /// public IStorefrontUrlBuilder UrlBuilder { get; } /// /// Default master view name /// public string MasterViewName => _options.DefaultLayout; /// /// Current theme name /// public string CurrentThemeName => !string.IsNullOrEmpty(WorkContext.CurrentStore.ThemeName) ? WorkContext.CurrentStore.ThemeName : "default"; public string CurrentThemeSettingPath => Path.Combine(CurrentThemePath, "config", GetSettingsFilePath()); public string CurrentThemeLocalePath => Path.Combine(CurrentThemePath, "locales"); /// /// The path for current theme /// private string CurrentThemePath => Path.Combine("Themes", WorkContext.CurrentStore.Id, CurrentThemeName); //Relative path to the discovery of theme resources that weren't found by the current path. private string BaseThemePath { get { if (!string.IsNullOrEmpty(_options.BaseThemePath)) { return Path.Combine("Themes", _options.BaseThemePath); } #pragma warning disable 618 // We need to use obsolete value here for backward compatibility. return !string.IsNullOrEmpty(_options.BaseThemeName) ? Path.Combine("Themes", _options.BaseThemeName, "default") : null; #pragma warning restore 618 } } private string BaseThemeSettingPath => BaseThemePath != null ? Path.Combine(BaseThemePath, "config", "settings_data.json") : null; public string BaseThemeLocalePath => BaseThemePath != null ? Path.Combine(BaseThemePath, "locales") : null; #region ITemplateLoader members public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName) { return ResolveTemplatePath(templateName); } public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath) { var content = ReadTemplateByPath(templatePath); return content; } public ValueTask LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath) { return new ValueTask(Load(context, callerSpan, templatePath)); } #endregion #region ILiquidThemeEngine Members public IEnumerable DiscoveryPaths { get { var retVal = Enumerable.Empty(); if (WorkContext.CurrentStore != null) { retVal = _options.TemplatesDiscoveryFolders.Select(x => Path.Combine(CurrentThemePath, x)); if (BaseThemePath != null) { retVal = retVal.Concat(_options.TemplatesDiscoveryFolders.Select(x => Path.Combine(BaseThemePath, x))); } } return retVal; } } /// /// Return stream for requested asset file (used for search current and base themes assets) /// /// /// public async Task GetAssetStreamAsync(string filePath) { Stream retVal = null; var filePathWithoutExtension = Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)); var searchPatterns = new[] { filePath, string.Format(_liquidTemplateFormat, filePathWithoutExtension), string.Format(_liquidTemplateFormat, filePath), filePathWithoutExtension }; string currentThemeFilePath = null; //try to search in current store theme if (_themeBlobProvider.PathExists(Path.Combine(CurrentThemePath, "assets"))) { currentThemeFilePath = searchPatterns.SelectMany(x => _themeBlobProvider.Search(Path.Combine(CurrentThemePath, "assets"), x, true)).FirstOrDefault(); } //If not found by current theme path try find them by base path if it is defined if (currentThemeFilePath == null && BaseThemePath != null) { currentThemeFilePath = searchPatterns.SelectMany(x => _themeBlobProvider.Search(Path.Combine(BaseThemePath, "assets"), x, true)).FirstOrDefault(); } if (currentThemeFilePath != null) { retVal = _themeBlobProvider.OpenRead(currentThemeFilePath); filePath = currentThemeFilePath; } if (retVal != null && filePath.EndsWith(".liquid")) { var context = WorkContext.Clone() as WorkContext; context.Settings = GetSettings("''"); var templateContent = retVal.ReadToString(); retVal.Dispose(); var template = await RenderTemplateAsync(templateContent, filePath, context.ToScriptObject()); retVal = new MemoryStream(Encoding.UTF8.GetBytes(template)); } if (retVal != null && (filePath.Contains(".scss.") && filePath.EndsWith(".liquid") || filePath.EndsWith(".scss"))) { var content = retVal.ReadToString(); retVal.Dispose(); try { //handle scss resources _sassFileManager.CurrentDirectory = Path.GetDirectoryName(filePath); var result = SassCompiler.Compile(content); content = result.CompiledContent; retVal = new MemoryStream(Encoding.UTF8.GetBytes(content)); } catch (Exception ex) { throw new SaasCompileException(filePath, content, ex); } } return retVal; } /// /// Return hash of requested asset (used for file versioning) /// /// /// public string GetAssetHash(string filePath) { var cacheKey = CacheKey.With(GetType(), "GetAssetHash", filePath); return _memoryCache.GetOrCreateExclusive(cacheKey, (cacheEntry) => { cacheEntry.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(filePath), _themeBlobProvider.Watch(CurrentThemeSettingPath) })); using var stream = GetAssetStreamAsync(filePath).GetAwaiter().GetResult(); if (stream == null) { throw new StorefrontException($"Theme resource for path '{filePath}' not found"); } var hashAlgorithm = SHA256.Create(); return WebEncoders.Base64UrlEncode(hashAlgorithm.ComputeHash(stream)); }); } /// /// resolve template path by it name /// /// /// public string ResolveTemplatePath(string templateName) { if (WorkContext.CurrentStore == null) { return null; } var liquidTemplateFileName = string.Format(_liquidTemplateFormat, templateName); //If not found by current theme path try find them by base path if it is defined var curentThemeDiscoveryPaths = _options.TemplatesDiscoveryFolders.Select(x => Path.Combine(CurrentThemePath, x, liquidTemplateFileName)); if (BaseThemePath != null) { curentThemeDiscoveryPaths = curentThemeDiscoveryPaths.Concat(_options.TemplatesDiscoveryFolders.Select(x => Path.Combine(BaseThemePath, x, liquidTemplateFileName))); } //Try to find template in current theme folder return curentThemeDiscoveryPaths.FirstOrDefault(x => _themeBlobProvider.PathExists(x)); } /// /// Render template by name and with passed context (parameters) /// /// /// /// public ValueTask RenderTemplateByNameAsync(string templateName, object context) { if (string.IsNullOrEmpty(templateName)) { throw new ArgumentNullException(nameof(templateName)); } return RenderTemplateByNameInternalAsync(templateName, context); } private async ValueTask RenderTemplateByNameInternalAsync(string templateName, object context) { var templatePath = ResolveTemplatePath(templateName); if (string.IsNullOrEmpty(templatePath)) { throw new FileNotFoundException($"The template '{templateName}' was not found. The following locations were searched:
{string.Join("
", DiscoveryPaths)}"); } var templateContent = ReadTemplateByPath(templatePath); var retVal = await RenderTemplateAsync(templateContent, templatePath, context); return retVal; } /// /// Render template by content and parameters /// /// /// /// public ValueTask RenderTemplateAsync(string templateContent, string templatePath, object context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (!(context is IScriptObject scriptObject)) { throw new StorefrontException($"{nameof(context)} must implement IScriptObject"); } if (string.IsNullOrEmpty(templateContent)) { return new ValueTask(templateContent); } var isLiquidTemplate = _isLiquid.Match(templateContent); if (!isLiquidTemplate.Success) { return new ValueTask(templateContent); } var cacheKey = CacheKey.With(GetType(), "ParseTemplate", templatePath ?? templateContent); var parsedTemplate = _memoryCache.GetOrCreate(cacheKey, (cacheItem) => { if (!string.IsNullOrEmpty(templatePath)) { cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(templatePath) })); } else { cacheItem.AddExpirationToken(ThemeEngineCacheRegion.CreateChangeToken()); } return Template.ParseLiquid(templateContent, templatePath); }); if (parsedTemplate.HasErrors) { throw new InvalidOperationException(string.Join("\n", parsedTemplate.Messages)); } var templateContext = new TemplateContext() { TemplateLoader = this, EnableRelaxedMemberAccess = true, NewLine = Environment.NewLine, TemplateLoaderLexerOptions = new LexerOptions { Mode = ScriptMode.Default, Lang = ScriptLang.Liquid } }; templateContext.PushGlobal(scriptObject); var result = parsedTemplate.Render(templateContext); return new ValueTask(result); } /// /// Read shopify theme settings from 'config' folder /// /// /// public IDictionary GetSettings(string defaultValue = null) { var cacheKey = CacheKey.With(GetType(), "GetSettings", CurrentThemeSettingPath, defaultValue); return _memoryCache.GetOrCreateExclusive(cacheKey, cacheItem => { cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(CurrentThemeSettingPath) })); var baseThemeSettings = new JObject(); var currentThemeSettings = InnerGetAllSettings(_themeBlobProvider, CurrentThemeSettingPath); //Try to load settings from base theme path and merge them with resources for local theme if ((_options.MergeBaseSettings || currentThemeSettings == null) && !string.IsNullOrEmpty(BaseThemeSettingPath)) { cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(BaseThemeSettingPath) })); baseThemeSettings = InnerGetAllSettings(_themeBlobProvider, BaseThemeSettingPath); } var result = _options.MergeBaseSettings ? SettingsManager.Merge(baseThemeSettings, currentThemeSettings ?? new JObject()) : SettingsManager.ReadSettings(currentThemeSettings ?? new JObject()).CurrentPreset.Json; return result.ToObject>().ToDictionary(x => x.Key, x => x.Value).WithDefaultValue(defaultValue); }); } /// /// Read localization resources /// /// public JObject ReadLocalization() { var cacheKey = CacheKey.With(GetType(), "ReadLocalization", CurrentThemeLocalePath, WorkContext.CurrentLanguage.CultureName); return _memoryCache.GetOrCreateExclusive(cacheKey, (cacheItem) => { var result = new JObject(); cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(CurrentThemeLocalePath + "/*") })); //Try to load localization resources from base theme path and merge them with resources for local theme if (BaseThemeLocalePath != null) { cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(BaseThemeLocalePath + "/*") })); result = InnerReadLocalization(_themeBlobProvider, BaseThemeLocalePath, WorkContext.CurrentLanguage) ?? new JObject(); } result.Merge(InnerReadLocalization(_themeBlobProvider, CurrentThemeLocalePath, WorkContext.CurrentLanguage) ?? new JObject(), new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge }); return result; }); } /// /// Get relative url for assets (assets folder) /// /// /// public string GetAssetAbsoluteUrl(string assetName) { const char delimiter = '/'; return UrlBuilder.ToAppAbsolute(_options.ThemesAssetsRelativeUrl.TrimEnd(delimiter) + delimiter + assetName.TrimStart(delimiter), WorkContext.CurrentStore, WorkContext.CurrentLanguage); } #endregion private static JObject InnerReadLocalization(IContentBlobProvider themeBlobProvider, string localePath, Language language) { JObject retVal = null; if (themeBlobProvider.PathExists(localePath)) { JObject localeJson = null; JObject defaultJson = null; foreach (var languageName in new[] { language.CultureName, language.TwoLetterLanguageName }) { var currentLocalePath = Path.Combine(localePath, string.Concat(languageName, ".json")); if (themeBlobProvider.PathExists(currentLocalePath)) { using var stream = themeBlobProvider.OpenRead(currentLocalePath); localeJson = JsonConvert.DeserializeObject(stream.ReadToString()); break; } } var localeDefaultPath = themeBlobProvider.Search(localePath, "*.default.json", false).FirstOrDefault(); if (localeDefaultPath != null && themeBlobProvider.PathExists(localeDefaultPath)) { using var stream = themeBlobProvider.OpenRead(localeDefaultPath); defaultJson = JsonConvert.DeserializeObject(stream.ReadToString()); } //Need merge default and requested localization json to resulting object retVal = defaultJson ?? localeJson; if (defaultJson != null && localeJson != null) { retVal.Merge(localeJson, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge }); } } return retVal; } private static JObject InnerGetAllSettings(IContentBlobProvider themeBlobProvider, string settingsPath) { if (settingsPath == null) { throw new ArgumentNullException(nameof(settingsPath)); } var result = new JObject(); if (themeBlobProvider.PathExists(settingsPath)) { using var stream = themeBlobProvider.OpenRead(settingsPath); result = JsonConvert.DeserializeObject(stream.ReadToString()); } return result; } private string ReadTemplateByPath(string templatePath) { if (string.IsNullOrEmpty(templatePath)) { throw new ArgumentNullException(nameof(templatePath)); } var cacheKey = CacheKey.With(GetType(), "ReadTemplateByName", templatePath); return _memoryCache.GetOrCreateExclusive(cacheKey, (cacheItem) => { cacheItem.AddExpirationToken(new CompositeChangeToken(new[] { ThemeEngineCacheRegion.CreateChangeToken(), _themeBlobProvider.Watch(templatePath) })); using var stream = _themeBlobProvider.OpenRead(templatePath); return stream.ReadToString(); }); } private string GetSettingsFilePath() { var prefix = _httpContextAccessor.HttpContext.Request.Query["preview_mode"]; return prefix.ToString().IsNullOrEmpty() ? "settings_data.json" : $"drafts\\{prefix}_settings_data.json"; } public bool IsFeatureActive(string featureName) { var cacheKey = CacheKey.With(GetType(), nameof(IsFeatureActive), featureName); return _memoryCache.GetOrCreateExclusive(cacheKey, cacheEntry => { var changeToken = ThemeEngineCacheRegion.CreateChangeToken(); var watchChangeToken = _themeBlobProvider.Watch(CurrentThemeSettingPath); var tokens = new[] { changeToken, watchChangeToken }; var compositeChangeToken = new CompositeChangeToken(tokens); cacheEntry.AddExpirationToken(compositeChangeToken); var settingJObject = InnerGetAllSettings(_themeBlobProvider, CurrentThemeSettingPath); var result = _featuresAgent.IsActive(featureName, settingJObject); return result; }); } } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/ThemeEngineCacheRegion.cs ================================================ using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.LiquidThemeEngine { public class ThemeEngineCacheRegion : CancellableCacheRegion { } } ================================================ FILE: VirtoCommerce.LiquidThemeEngine/VirtoCommerce.LiquidThemeEngine.csproj ================================================ net8.0 The storefront implementation of the Virto Commerce platform. https://virtocommerce.com/open-source-license https://github.com/VirtoCommerce/vc-storefront-core https://virtocommerce.com/themes/assets/logo.jpg https://github.com/VirtoCommerce/vc-storefront-core False Library ================================================ FILE: VirtoCommerce.Storefront/.bowerrc ================================================ { "directory": "wwwroot/lib" } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/!readme.txt ================================================ See there, how to generate AutoRest-generated clients with the Platform v.3: https://github.com/VirtoCommerce/vc-platform/blob/dev/docs/developer-guide/using-autorest-with-v3.md Simplest example to refresh all clients: $modules = @('Platform', 'Cart', 'Catalog', 'Content', 'Core', 'Customer', 'Inventory', 'Marketing', 'Notifications', 'Orders', 'Payment', 'Pricing', 'Shipping', 'Sitemaps', 'Store', 'Subscription', 'Tax') $modules.ForEach( { autoRest VirtoCommerce.Storefront\AutoRestClients\array-in-query-fix.yml --version=3.0.6274 --v3 --debug --input-file=http://localhost:10645/docs/VirtoCommerce.$_/swagger.json --output-folder=.\VirtoCommerce.Storefront\AutoRestClients --output-file=$_`ModuleApi.cs --namespace=VirtoCommerce.Storefront.AutoRestClients.$_`ModuleApi --override-client-name=$_`ModuleClient --add-credentials --csharp }) ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/CatalogModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogModuleClient : ServiceClient, ICatalogModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the ICatalogModuleAssociations. /// public virtual ICatalogModuleAssociations CatalogModuleAssociations { get; private set; } /// /// Gets the ICatalogModuleCatalogs. /// public virtual ICatalogModuleCatalogs CatalogModuleCatalogs { get; private set; } /// /// Gets the ICatalogModuleCategories. /// public virtual ICatalogModuleCategories CatalogModuleCategories { get; private set; } /// /// Gets the ICatalogModuleIndexedSearch. /// public virtual ICatalogModuleIndexedSearch CatalogModuleIndexedSearch { get; private set; } /// /// Gets the ICatalogModuleListEntry. /// public virtual ICatalogModuleListEntry CatalogModuleListEntry { get; private set; } /// /// Gets the ICatalogModuleProducts. /// public virtual ICatalogModuleProducts CatalogModuleProducts { get; private set; } /// /// Gets the ICatalogModuleProperties. /// public virtual ICatalogModuleProperties CatalogModuleProperties { get; private set; } /// /// Gets the ICatalogModulePropertyDictionaryItems. /// public virtual ICatalogModulePropertyDictionaryItems CatalogModulePropertyDictionaryItems { get; private set; } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CatalogModuleClient.Dispose(). False: will not dispose provided httpClient protected CatalogModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CatalogModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CatalogModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CatalogModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CatalogModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CatalogModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CatalogModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public CatalogModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CatalogModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CatalogModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CatalogModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CatalogModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { CatalogModuleAssociations = new CatalogModuleAssociations(this); CatalogModuleCatalogs = new CatalogModuleCatalogs(this); CatalogModuleCategories = new CatalogModuleCategories(this); CatalogModuleIndexedSearch = new CatalogModuleIndexedSearch(this); CatalogModuleListEntry = new CatalogModuleListEntry(this); CatalogModuleProducts = new CatalogModuleProducts(this); CatalogModuleProperties = new CatalogModuleProperties(this); CatalogModulePropertyDictionaryItems = new CatalogModulePropertyDictionaryItems(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface ICatalogModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the ICatalogModuleAssociations. /// ICatalogModuleAssociations CatalogModuleAssociations { get; } /// /// Gets the ICatalogModuleCatalogs. /// ICatalogModuleCatalogs CatalogModuleCatalogs { get; } /// /// Gets the ICatalogModuleCategories. /// ICatalogModuleCategories CatalogModuleCategories { get; } /// /// Gets the ICatalogModuleIndexedSearch. /// ICatalogModuleIndexedSearch CatalogModuleIndexedSearch { get; } /// /// Gets the ICatalogModuleListEntry. /// ICatalogModuleListEntry CatalogModuleListEntry { get; } /// /// Gets the ICatalogModuleProducts. /// ICatalogModuleProducts CatalogModuleProducts { get; } /// /// Gets the ICatalogModuleProperties. /// ICatalogModuleProperties CatalogModuleProperties { get; } /// /// Gets the ICatalogModulePropertyDictionaryItems. /// ICatalogModulePropertyDictionaryItems CatalogModulePropertyDictionaryItems { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleAssociations operations. /// public partial class CatalogModuleAssociations : IServiceOperations, ICatalogModuleAssociations { /// /// Initializes a new instance of the CatalogModuleAssociations class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleAssociations(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Returns list of associations for specified product /// /// /// Returns list of associations for specified product /// /// /// Owner product id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetAllAssociationsWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (productId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "productId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("productId", productId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAllAssociations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/associations/{productId}").ToString(); _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Updates the specified association /// /// /// Updates the specified association /// /// /// The association /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateAssociationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateAssociations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/associations").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Deletes specified associations /// /// /// Updates the specified association /// /// /// associations to delete ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/associations").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Returns associations by search criteria /// /// /// Returns associations by search criteria /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchWithHttpMessagesAsync(ProductAssociationSearchCriteria body = default(ProductAssociationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Search", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/associations/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleAssociations operations. /// public partial interface ICatalogModuleAssociations { /// /// Returns list of associations for specified product /// /// /// Returns list of associations for specified product /// /// /// Owner product id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetAllAssociationsWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates the specified association /// /// /// Updates the specified association /// /// /// The association /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateAssociationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specified associations /// /// /// Updates the specified association /// /// /// associations to delete ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns associations by search criteria /// /// /// Returns associations by search criteria /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchWithHttpMessagesAsync(ProductAssociationSearchCriteria body = default(ProductAssociationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleAssociations. /// public static partial class CatalogModuleAssociationsExtensions { /// /// Returns list of associations for specified product /// /// /// Returns list of associations for specified product /// /// /// The operations group for this extension method. /// /// /// Owner product id /// public static IList GetAllAssociations(this ICatalogModuleAssociations operations, string productId) { return operations.GetAllAssociationsAsync(productId).GetAwaiter().GetResult(); } /// /// Returns list of associations for specified product /// /// /// Returns list of associations for specified product /// /// /// The operations group for this extension method. /// /// /// Owner product id /// /// /// The cancellation token. /// public static async Task> GetAllAssociationsAsync(this ICatalogModuleAssociations operations, string productId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllAssociationsWithHttpMessagesAsync(productId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Updates the specified association /// /// /// Updates the specified association /// /// /// The operations group for this extension method. /// /// /// The association /// public static void UpdateAssociations(this ICatalogModuleAssociations operations, IList body = default(IList)) { operations.UpdateAssociationsAsync(body).GetAwaiter().GetResult(); } /// /// Updates the specified association /// /// /// Updates the specified association /// /// /// The operations group for this extension method. /// /// /// The association /// /// /// The cancellation token. /// public static async Task UpdateAssociationsAsync(this ICatalogModuleAssociations operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateAssociationsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Deletes specified associations /// /// /// Updates the specified association /// /// /// The operations group for this extension method. /// /// /// associations to delete ids /// public static void Delete(this ICatalogModuleAssociations operations, IList ids = default(IList)) { operations.DeleteAsync(ids).GetAwaiter().GetResult(); } /// /// Deletes specified associations /// /// /// Updates the specified association /// /// /// The operations group for this extension method. /// /// /// associations to delete ids /// /// /// The cancellation token. /// public static async Task DeleteAsync(this ICatalogModuleAssociations operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Returns associations by search criteria /// /// /// Returns associations by search criteria /// /// /// The operations group for this extension method. /// /// /// public static ProductAssociationSearchResult Search(this ICatalogModuleAssociations operations, ProductAssociationSearchCriteria body = default(ProductAssociationSearchCriteria)) { return operations.SearchAsync(body).GetAwaiter().GetResult(); } /// /// Returns associations by search criteria /// /// /// Returns associations by search criteria /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchAsync(this ICatalogModuleAssociations operations, ProductAssociationSearchCriteria body = default(ProductAssociationSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleCatalogs operations. /// public partial class CatalogModuleCatalogs : IServiceOperations, ICatalogModuleCatalogs { /// /// Initializes a new instance of the CatalogModuleCatalogs class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleCatalogs(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchCatalogsWithHttpMessagesAsync(CatalogSearchCriteria body = default(CatalogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchCatalogs", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets Catalog by id. /// /// /// Gets Catalog by id with full information loaded /// /// /// The Catalog id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetCatalogWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Deletes catalog by id. /// /// /// Deletes catalog by id /// /// /// Catalog id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task DeleteCatalogWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new catalog. /// /// /// Gets the template for a new common catalog /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewCatalogWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs/getnew").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new virtual catalog. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewVirtualCatalogWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewVirtualCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs/getnewvirtual").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Creates the specified catalog. /// /// /// Creates the specified catalog /// /// /// The catalog to create /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateCatalogWithHttpMessagesAsync(Catalog body = default(Catalog), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Updates the specified catalog. /// /// /// Updates the specified catalog. /// /// /// The catalog. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateCatalogWithHttpMessagesAsync(Catalog body = default(Catalog), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/catalogs").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleCatalogs operations. /// public partial interface ICatalogModuleCatalogs { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchCatalogsWithHttpMessagesAsync(CatalogSearchCriteria body = default(CatalogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets Catalog by id. /// /// /// Gets Catalog by id with full information loaded /// /// /// The Catalog id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetCatalogWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes catalog by id. /// /// /// Deletes catalog by id /// /// /// Catalog id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task DeleteCatalogWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new catalog. /// /// /// Gets the template for a new common catalog /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetNewCatalogWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new virtual catalog. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetNewVirtualCatalogWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates the specified catalog. /// /// /// Creates the specified catalog /// /// /// The catalog to create /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateCatalogWithHttpMessagesAsync(Catalog body = default(Catalog), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates the specified catalog. /// /// /// Updates the specified catalog. /// /// /// The catalog. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateCatalogWithHttpMessagesAsync(Catalog body = default(Catalog), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleCatalogs. /// public static partial class CatalogModuleCatalogsExtensions { /// /// The operations group for this extension method. /// /// /// public static CatalogSearchResult SearchCatalogs(this ICatalogModuleCatalogs operations, CatalogSearchCriteria body = default(CatalogSearchCriteria)) { return operations.SearchCatalogsAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchCatalogsAsync(this ICatalogModuleCatalogs operations, CatalogSearchCriteria body = default(CatalogSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchCatalogsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets Catalog by id. /// /// /// Gets Catalog by id with full information loaded /// /// /// The operations group for this extension method. /// /// /// The Catalog id. /// public static Catalog GetCatalog(this ICatalogModuleCatalogs operations, string id) { return operations.GetCatalogAsync(id).GetAwaiter().GetResult(); } /// /// Gets Catalog by id. /// /// /// Gets Catalog by id with full information loaded /// /// /// The operations group for this extension method. /// /// /// The Catalog id. /// /// /// The cancellation token. /// public static async Task GetCatalogAsync(this ICatalogModuleCatalogs operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetCatalogWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Deletes catalog by id. /// /// /// Deletes catalog by id /// /// /// The operations group for this extension method. /// /// /// Catalog id. /// public static void DeleteCatalog(this ICatalogModuleCatalogs operations, string id) { operations.DeleteCatalogAsync(id).GetAwaiter().GetResult(); } /// /// Deletes catalog by id. /// /// /// Deletes catalog by id /// /// /// The operations group for this extension method. /// /// /// Catalog id. /// /// /// The cancellation token. /// public static async Task DeleteCatalogAsync(this ICatalogModuleCatalogs operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteCatalogWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Gets the template for a new catalog. /// /// /// Gets the template for a new common catalog /// /// /// The operations group for this extension method. /// public static Catalog GetNewCatalog(this ICatalogModuleCatalogs operations) { return operations.GetNewCatalogAsync().GetAwaiter().GetResult(); } /// /// Gets the template for a new catalog. /// /// /// Gets the template for a new common catalog /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetNewCatalogAsync(this ICatalogModuleCatalogs operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewCatalogWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new virtual catalog. /// /// /// The operations group for this extension method. /// public static Catalog GetNewVirtualCatalog(this ICatalogModuleCatalogs operations) { return operations.GetNewVirtualCatalogAsync().GetAwaiter().GetResult(); } /// /// Gets the template for a new virtual catalog. /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetNewVirtualCatalogAsync(this ICatalogModuleCatalogs operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewVirtualCatalogWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Creates the specified catalog. /// /// /// Creates the specified catalog /// /// /// The operations group for this extension method. /// /// /// The catalog to create /// public static Catalog CreateCatalog(this ICatalogModuleCatalogs operations, Catalog body = default(Catalog)) { return operations.CreateCatalogAsync(body).GetAwaiter().GetResult(); } /// /// Creates the specified catalog. /// /// /// Creates the specified catalog /// /// /// The operations group for this extension method. /// /// /// The catalog to create /// /// /// The cancellation token. /// public static async Task CreateCatalogAsync(this ICatalogModuleCatalogs operations, Catalog body = default(Catalog), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateCatalogWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Updates the specified catalog. /// /// /// Updates the specified catalog. /// /// /// The operations group for this extension method. /// /// /// The catalog. /// public static void UpdateCatalog(this ICatalogModuleCatalogs operations, Catalog body = default(Catalog)) { operations.UpdateCatalogAsync(body).GetAwaiter().GetResult(); } /// /// Updates the specified catalog. /// /// /// Updates the specified catalog. /// /// /// The operations group for this extension method. /// /// /// The catalog. /// /// /// The cancellation token. /// public static async Task UpdateCatalogAsync(this ICatalogModuleCatalogs operations, Catalog body = default(Catalog), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateCatalogWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleCategories operations. /// public partial class CatalogModuleCategories : IServiceOperations, ICatalogModuleCategories { /// /// Initializes a new instance of the CatalogModuleCategories class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleCategories(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Gets category by id. /// /// /// Category id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetCategoryWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetCategory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets categories by ids /// /// /// Categories ids /// /// /// Response group. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetCategoriesByIdsAsyncWithHttpMessagesAsync(IList ids = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("respGroup", respGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetCategoriesByIdsAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (respGroup != null) { _queryParameters.Add(string.Format("respGroup={0}", System.Uri.EscapeDataString(respGroup))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Creates or updates the specified category. /// /// /// If category.id is null, a new category is created. It's updated otherwise /// /// /// The category. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task CreateOrUpdateCategoryWithHttpMessagesAsync(Category body = default(Category), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateCategory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Deletes the specified categories by id. /// /// /// The categories ids. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteCategoryWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteCategory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get categories by plenty ids /// /// /// Categories ids /// /// /// Response group /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetCategoriesByPlentyIdsWithHttpMessagesAsync(IList body = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("respGroup", respGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetCategoriesByPlentyIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories/plenty").ToString(); List _queryParameters = new List(); if (respGroup != null) { _queryParameters.Add(string.Format("respGroup={0}", System.Uri.EscapeDataString(respGroup))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new category. /// /// /// The catalog id. /// /// /// The parent category id. (Optional) /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewCategoryWithHttpMessagesAsync(string catalogId, string parentCategoryId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (catalogId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "catalogId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("catalogId", catalogId); tracingParameters.Add("parentCategoryId", parentCategoryId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewCategory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/{catalogId}/categories/newcategory").ToString(); _url = _url.Replace("{catalogId}", System.Uri.EscapeDataString(catalogId)); List _queryParameters = new List(); if (parentCategoryId != null) { _queryParameters.Add(string.Format("parentCategoryId={0}", System.Uri.EscapeDataString(parentCategoryId))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleCategories operations. /// public partial interface ICatalogModuleCategories { /// /// Gets category by id. /// /// /// Category id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetCategoryWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets categories by ids /// /// /// Categories ids /// /// /// Response group. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetCategoriesByIdsAsyncWithHttpMessagesAsync(IList ids = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates the specified category. /// /// /// If category.id is null, a new category is created. It's updated /// otherwise /// /// /// The category. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task CreateOrUpdateCategoryWithHttpMessagesAsync(Category body = default(Category), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified categories by id. /// /// /// The categories ids. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteCategoryWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get categories by plenty ids /// /// /// Categories ids /// /// /// Response group /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetCategoriesByPlentyIdsWithHttpMessagesAsync(IList body = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new category. /// /// /// The catalog id. /// /// /// The parent category id. (Optional) /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewCategoryWithHttpMessagesAsync(string catalogId, string parentCategoryId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleCategories. /// public static partial class CatalogModuleCategoriesExtensions { /// /// Gets category by id. /// /// /// The operations group for this extension method. /// /// /// Category id. /// public static Category GetCategory(this ICatalogModuleCategories operations, string id) { return operations.GetCategoryAsync(id).GetAwaiter().GetResult(); } /// /// Gets category by id. /// /// /// The operations group for this extension method. /// /// /// Category id. /// /// /// The cancellation token. /// public static async Task GetCategoryAsync(this ICatalogModuleCategories operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetCategoryWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets categories by ids /// /// /// The operations group for this extension method. /// /// /// Categories ids /// /// /// Response group. /// public static IList GetCategoriesByIdsAsync(this ICatalogModuleCategories operations, IList ids = default(IList), string respGroup = default(string)) { return operations.GetCategoriesByIdsAsyncAsync(ids, respGroup).GetAwaiter().GetResult(); } /// /// Gets categories by ids /// /// /// The operations group for this extension method. /// /// /// Categories ids /// /// /// Response group. /// /// /// The cancellation token. /// public static async Task> GetCategoriesByIdsAsyncAsync(this ICatalogModuleCategories operations, IList ids = default(IList), string respGroup = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetCategoriesByIdsAsyncWithHttpMessagesAsync(ids, respGroup, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Creates or updates the specified category. /// /// /// If category.id is null, a new category is created. It's updated otherwise /// /// /// The operations group for this extension method. /// /// /// The category. /// public static void CreateOrUpdateCategory(this ICatalogModuleCategories operations, Category body = default(Category)) { operations.CreateOrUpdateCategoryAsync(body).GetAwaiter().GetResult(); } /// /// Creates or updates the specified category. /// /// /// If category.id is null, a new category is created. It's updated otherwise /// /// /// The operations group for this extension method. /// /// /// The category. /// /// /// The cancellation token. /// public static async Task CreateOrUpdateCategoryAsync(this ICatalogModuleCategories operations, Category body = default(Category), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CreateOrUpdateCategoryWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Deletes the specified categories by id. /// /// /// The operations group for this extension method. /// /// /// The categories ids. /// public static void DeleteCategory(this ICatalogModuleCategories operations, IList ids = default(IList)) { operations.DeleteCategoryAsync(ids).GetAwaiter().GetResult(); } /// /// Deletes the specified categories by id. /// /// /// The operations group for this extension method. /// /// /// The categories ids. /// /// /// The cancellation token. /// public static async Task DeleteCategoryAsync(this ICatalogModuleCategories operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteCategoryWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get categories by plenty ids /// /// /// The operations group for this extension method. /// /// /// Categories ids /// /// /// Response group /// public static IList GetCategoriesByPlentyIds(this ICatalogModuleCategories operations, IList body = default(IList), string respGroup = default(string)) { return operations.GetCategoriesByPlentyIdsAsync(body, respGroup).GetAwaiter().GetResult(); } /// /// Get categories by plenty ids /// /// /// The operations group for this extension method. /// /// /// Categories ids /// /// /// Response group /// /// /// The cancellation token. /// public static async Task> GetCategoriesByPlentyIdsAsync(this ICatalogModuleCategories operations, IList body = default(IList), string respGroup = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetCategoriesByPlentyIdsWithHttpMessagesAsync(body, respGroup, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new category. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The parent category id. (Optional) /// public static Category GetNewCategory(this ICatalogModuleCategories operations, string catalogId, string parentCategoryId = default(string)) { return operations.GetNewCategoryAsync(catalogId, parentCategoryId).GetAwaiter().GetResult(); } /// /// Gets the template for a new category. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The parent category id. (Optional) /// /// /// The cancellation token. /// public static async Task GetNewCategoryAsync(this ICatalogModuleCategories operations, string catalogId, string parentCategoryId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewCategoryWithHttpMessagesAsync(catalogId, parentCategoryId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleIndexedSearch operations. /// public partial class CatalogModuleIndexedSearch : IServiceOperations, ICatalogModuleIndexedSearch { /// /// Initializes a new instance of the CatalogModuleIndexedSearch class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleIndexedSearch(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchProductsWithHttpMessagesAsync(ProductIndexedSearchCriteria body = default(ProductIndexedSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchProducts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/search/products").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchCategoriesWithHttpMessagesAsync(CategoryIndexedSearchCriteria body = default(CategoryIndexedSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchCategories", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/search/categories").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleIndexedSearch operations. /// public partial interface ICatalogModuleIndexedSearch { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchProductsWithHttpMessagesAsync(ProductIndexedSearchCriteria body = default(ProductIndexedSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchCategoriesWithHttpMessagesAsync(CategoryIndexedSearchCriteria body = default(CategoryIndexedSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleIndexedSearch. /// public static partial class CatalogModuleIndexedSearchExtensions { /// /// The operations group for this extension method. /// /// /// public static ProductIndexedSearchResult SearchProducts(this ICatalogModuleIndexedSearch operations, ProductIndexedSearchCriteria body = default(ProductIndexedSearchCriteria)) { return operations.SearchProductsAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchProductsAsync(this ICatalogModuleIndexedSearch operations, ProductIndexedSearchCriteria body = default(ProductIndexedSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchProductsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static CategoryIndexedSearchResult SearchCategories(this ICatalogModuleIndexedSearch operations, CategoryIndexedSearchCriteria body = default(CategoryIndexedSearchCriteria)) { return operations.SearchCategoriesAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchCategoriesAsync(this ICatalogModuleIndexedSearch operations, CategoryIndexedSearchCriteria body = default(CategoryIndexedSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchCategoriesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleListEntry operations. /// public partial class CatalogModuleListEntry : IServiceOperations, ICatalogModuleListEntry { /// /// Initializes a new instance of the CatalogModuleListEntry class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleListEntry(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Searches for the items by complex criteria. /// /// /// The search criteria. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ListItemsSearchAsyncWithHttpMessagesAsync(CatalogListEntrySearchCriteria body = default(CatalogListEntrySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListItemsSearchAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/listentries").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Creates links for categories or items to parent categories and catalogs. /// /// /// The links. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task CreateLinksWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateLinks", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/listentrylinks").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk create links to categories and items /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkCreateLinksWithHttpMessagesAsync(BulkLinkCreationRequest body = default(BulkLinkCreationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCreateLinks", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/listentrylinks/bulkcreate").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Unlinks the linked categories or items from parent categories and catalogs. /// /// /// The links. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteLinksWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteLinks", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/listentrylinks/delete").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Move categories or products to another location. /// /// /// Move operation request /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task MoveWithHttpMessagesAsync(ListEntriesMoveRequest body = default(ListEntriesMoveRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/listentries/move").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleListEntry operations. /// public partial interface ICatalogModuleListEntry { /// /// Searches for the items by complex criteria. /// /// /// The search criteria. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ListItemsSearchAsyncWithHttpMessagesAsync(CatalogListEntrySearchCriteria body = default(CatalogListEntrySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates links for categories or items to parent categories and /// catalogs. /// /// /// The links. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task CreateLinksWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk create links to categories and items /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkCreateLinksWithHttpMessagesAsync(BulkLinkCreationRequest body = default(BulkLinkCreationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Unlinks the linked categories or items from parent categories and /// catalogs. /// /// /// The links. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteLinksWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Move categories or products to another location. /// /// /// Move operation request /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task MoveWithHttpMessagesAsync(ListEntriesMoveRequest body = default(ListEntriesMoveRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleListEntry. /// public static partial class CatalogModuleListEntryExtensions { /// /// Searches for the items by complex criteria. /// /// /// The operations group for this extension method. /// /// /// The search criteria. /// public static ListEntrySearchResult ListItemsSearchAsync(this ICatalogModuleListEntry operations, CatalogListEntrySearchCriteria body = default(CatalogListEntrySearchCriteria)) { return operations.ListItemsSearchAsyncAsync(body).GetAwaiter().GetResult(); } /// /// Searches for the items by complex criteria. /// /// /// The operations group for this extension method. /// /// /// The search criteria. /// /// /// The cancellation token. /// public static async Task ListItemsSearchAsyncAsync(this ICatalogModuleListEntry operations, CatalogListEntrySearchCriteria body = default(CatalogListEntrySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListItemsSearchAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Creates links for categories or items to parent categories and catalogs. /// /// /// The operations group for this extension method. /// /// /// The links. /// public static void CreateLinks(this ICatalogModuleListEntry operations, IList body = default(IList)) { operations.CreateLinksAsync(body).GetAwaiter().GetResult(); } /// /// Creates links for categories or items to parent categories and catalogs. /// /// /// The operations group for this extension method. /// /// /// The links. /// /// /// The cancellation token. /// public static async Task CreateLinksAsync(this ICatalogModuleListEntry operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CreateLinksWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Bulk create links to categories and items /// /// /// The operations group for this extension method. /// /// /// public static void BulkCreateLinks(this ICatalogModuleListEntry operations, BulkLinkCreationRequest body = default(BulkLinkCreationRequest)) { operations.BulkCreateLinksAsync(body).GetAwaiter().GetResult(); } /// /// Bulk create links to categories and items /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task BulkCreateLinksAsync(this ICatalogModuleListEntry operations, BulkLinkCreationRequest body = default(BulkLinkCreationRequest), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkCreateLinksWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Unlinks the linked categories or items from parent categories and catalogs. /// /// /// The operations group for this extension method. /// /// /// The links. /// public static void DeleteLinks(this ICatalogModuleListEntry operations, IList body = default(IList)) { operations.DeleteLinksAsync(body).GetAwaiter().GetResult(); } /// /// Unlinks the linked categories or items from parent categories and catalogs. /// /// /// The operations group for this extension method. /// /// /// The links. /// /// /// The cancellation token. /// public static async Task DeleteLinksAsync(this ICatalogModuleListEntry operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteLinksWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Move categories or products to another location. /// /// /// The operations group for this extension method. /// /// /// Move operation request /// public static void Move(this ICatalogModuleListEntry operations, ListEntriesMoveRequest body = default(ListEntriesMoveRequest)) { operations.MoveAsync(body).GetAwaiter().GetResult(); } /// /// Move categories or products to another location. /// /// /// The operations group for this extension method. /// /// /// Move operation request /// /// /// The cancellation token. /// public static async Task MoveAsync(this ICatalogModuleListEntry operations, ListEntriesMoveRequest body = default(ListEntriesMoveRequest), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.MoveWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleProducts operations. /// public partial class CatalogModuleProducts : IServiceOperations, ICatalogModuleProducts { /// /// Initializes a new instance of the CatalogModuleProducts class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleProducts(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Gets product by id. /// /// /// Item id. /// /// /// Response group. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetProductByIdWithHttpMessagesAsync(string id, string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("respGroup", respGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetProductById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); List _queryParameters = new List(); if (respGroup != null) { _queryParameters.Add(string.Format("respGroup={0}", System.Uri.EscapeDataString(respGroup))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets products by ids /// /// /// Item ids /// /// /// Response group. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetProductByIdsWithHttpMessagesAsync(IList ids = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("respGroup", respGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetProductByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (respGroup != null) { _queryParameters.Add(string.Format("respGroup={0}", System.Uri.EscapeDataString(respGroup))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create/Update the specified product. /// /// /// The product. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SaveProductWithHttpMessagesAsync(CatalogProduct body = default(CatalogProduct), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveProduct", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Deletes the specified items by id. /// /// /// The items ids. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteProductWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteProduct", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets products by plenty ids /// /// /// Item ids /// /// /// Response group. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetProductByPlentyIdsWithHttpMessagesAsync(IList body = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("respGroup", respGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetProductByPlentyIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/plenty").ToString(); List _queryParameters = new List(); if (respGroup != null) { _queryParameters.Add(string.Format("respGroup={0}", System.Uri.EscapeDataString(respGroup))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new product (outside of category). /// /// /// Use when need to create item belonging to catalog directly. /// /// /// The catalog id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewProductByCatalogWithHttpMessagesAsync(string catalogId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (catalogId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "catalogId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("catalogId", catalogId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewProductByCatalog", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/{catalogId}/products/getnew").ToString(); _url = _url.Replace("{catalogId}", System.Uri.EscapeDataString(catalogId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new product (inside category). /// /// /// Use when need to create item belonging to catalog category. /// /// /// The catalog id. /// /// /// The category id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewProductByCatalogAndCategoryWithHttpMessagesAsync(string catalogId, string categoryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (catalogId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "catalogId"); } if (categoryId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "categoryId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("catalogId", catalogId); tracingParameters.Add("categoryId", categoryId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewProductByCatalogAndCategory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/{catalogId}/categories/{categoryId}/products/getnew").ToString(); _url = _url.Replace("{catalogId}", System.Uri.EscapeDataString(catalogId)); _url = _url.Replace("{categoryId}", System.Uri.EscapeDataString(categoryId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new variation. /// /// /// The parent product id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewVariationWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (productId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "productId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("productId", productId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewVariation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/{productId}/getnewvariation").ToString(); _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> CloneProductWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (productId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "productId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("productId", productId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CloneProduct", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/{productId}/clone").ToString(); _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create/Update the specified products. /// /// /// The products. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SaveProductsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveProducts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/products/batch").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleProducts operations. /// public partial interface ICatalogModuleProducts { /// /// Gets product by id. /// /// /// Item id. /// /// /// Response group. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetProductByIdWithHttpMessagesAsync(string id, string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets products by ids /// /// /// Item ids /// /// /// Response group. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetProductByIdsWithHttpMessagesAsync(IList ids = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create/Update the specified product. /// /// /// The product. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SaveProductWithHttpMessagesAsync(CatalogProduct body = default(CatalogProduct), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified items by id. /// /// /// The items ids. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteProductWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets products by plenty ids /// /// /// Item ids /// /// /// Response group. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetProductByPlentyIdsWithHttpMessagesAsync(IList body = default(IList), string respGroup = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new product (outside of category). /// /// /// Use when need to create item belonging to catalog directly. /// /// /// The catalog id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewProductByCatalogWithHttpMessagesAsync(string catalogId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new product (inside category). /// /// /// Use when need to create item belonging to catalog category. /// /// /// The catalog id. /// /// /// The category id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewProductByCatalogAndCategoryWithHttpMessagesAsync(string catalogId, string categoryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new variation. /// /// /// The parent product id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewVariationWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> CloneProductWithHttpMessagesAsync(string productId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create/Update the specified products. /// /// /// The products. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SaveProductsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleProducts. /// public static partial class CatalogModuleProductsExtensions { /// /// Gets product by id. /// /// /// The operations group for this extension method. /// /// /// Item id. /// /// /// Response group. /// public static CatalogProduct GetProductById(this ICatalogModuleProducts operations, string id, string respGroup = default(string)) { return operations.GetProductByIdAsync(id, respGroup).GetAwaiter().GetResult(); } /// /// Gets product by id. /// /// /// The operations group for this extension method. /// /// /// Item id. /// /// /// Response group. /// /// /// The cancellation token. /// public static async Task GetProductByIdAsync(this ICatalogModuleProducts operations, string id, string respGroup = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetProductByIdWithHttpMessagesAsync(id, respGroup, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets products by ids /// /// /// The operations group for this extension method. /// /// /// Item ids /// /// /// Response group. /// public static IList GetProductByIds(this ICatalogModuleProducts operations, IList ids = default(IList), string respGroup = default(string)) { return operations.GetProductByIdsAsync(ids, respGroup).GetAwaiter().GetResult(); } /// /// Gets products by ids /// /// /// The operations group for this extension method. /// /// /// Item ids /// /// /// Response group. /// /// /// The cancellation token. /// public static async Task> GetProductByIdsAsync(this ICatalogModuleProducts operations, IList ids = default(IList), string respGroup = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetProductByIdsWithHttpMessagesAsync(ids, respGroup, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create/Update the specified product. /// /// /// The operations group for this extension method. /// /// /// The product. /// public static CatalogProduct SaveProduct(this ICatalogModuleProducts operations, CatalogProduct body = default(CatalogProduct)) { return operations.SaveProductAsync(body).GetAwaiter().GetResult(); } /// /// Create/Update the specified product. /// /// /// The operations group for this extension method. /// /// /// The product. /// /// /// The cancellation token. /// public static async Task SaveProductAsync(this ICatalogModuleProducts operations, CatalogProduct body = default(CatalogProduct), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SaveProductWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Deletes the specified items by id. /// /// /// The operations group for this extension method. /// /// /// The items ids. /// public static void DeleteProduct(this ICatalogModuleProducts operations, IList ids = default(IList)) { operations.DeleteProductAsync(ids).GetAwaiter().GetResult(); } /// /// Deletes the specified items by id. /// /// /// The operations group for this extension method. /// /// /// The items ids. /// /// /// The cancellation token. /// public static async Task DeleteProductAsync(this ICatalogModuleProducts operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteProductWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Gets products by plenty ids /// /// /// The operations group for this extension method. /// /// /// Item ids /// /// /// Response group. /// public static IList GetProductByPlentyIds(this ICatalogModuleProducts operations, IList body = default(IList), string respGroup = default(string)) { return operations.GetProductByPlentyIdsAsync(body, respGroup).GetAwaiter().GetResult(); } /// /// Gets products by plenty ids /// /// /// The operations group for this extension method. /// /// /// Item ids /// /// /// Response group. /// /// /// The cancellation token. /// public static async Task> GetProductByPlentyIdsAsync(this ICatalogModuleProducts operations, IList body = default(IList), string respGroup = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetProductByPlentyIdsWithHttpMessagesAsync(body, respGroup, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new product (outside of category). /// /// /// Use when need to create item belonging to catalog directly. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// public static CatalogProduct GetNewProductByCatalog(this ICatalogModuleProducts operations, string catalogId) { return operations.GetNewProductByCatalogAsync(catalogId).GetAwaiter().GetResult(); } /// /// Gets the template for a new product (outside of category). /// /// /// Use when need to create item belonging to catalog directly. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The cancellation token. /// public static async Task GetNewProductByCatalogAsync(this ICatalogModuleProducts operations, string catalogId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewProductByCatalogWithHttpMessagesAsync(catalogId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new product (inside category). /// /// /// Use when need to create item belonging to catalog category. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The category id. /// public static CatalogProduct GetNewProductByCatalogAndCategory(this ICatalogModuleProducts operations, string catalogId, string categoryId) { return operations.GetNewProductByCatalogAndCategoryAsync(catalogId, categoryId).GetAwaiter().GetResult(); } /// /// Gets the template for a new product (inside category). /// /// /// Use when need to create item belonging to catalog category. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The category id. /// /// /// The cancellation token. /// public static async Task GetNewProductByCatalogAndCategoryAsync(this ICatalogModuleProducts operations, string catalogId, string categoryId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewProductByCatalogAndCategoryWithHttpMessagesAsync(catalogId, categoryId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new variation. /// /// /// The operations group for this extension method. /// /// /// The parent product id. /// public static CatalogProduct GetNewVariation(this ICatalogModuleProducts operations, string productId) { return operations.GetNewVariationAsync(productId).GetAwaiter().GetResult(); } /// /// Gets the template for a new variation. /// /// /// The operations group for this extension method. /// /// /// The parent product id. /// /// /// The cancellation token. /// public static async Task GetNewVariationAsync(this ICatalogModuleProducts operations, string productId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewVariationWithHttpMessagesAsync(productId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static CatalogProduct CloneProduct(this ICatalogModuleProducts operations, string productId) { return operations.CloneProductAsync(productId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CloneProductAsync(this ICatalogModuleProducts operations, string productId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CloneProductWithHttpMessagesAsync(productId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create/Update the specified products. /// /// /// The operations group for this extension method. /// /// /// The products. /// public static void SaveProducts(this ICatalogModuleProducts operations, IList body = default(IList)) { operations.SaveProductsAsync(body).GetAwaiter().GetResult(); } /// /// Create/Update the specified products. /// /// /// The operations group for this extension method. /// /// /// The products. /// /// /// The cancellation token. /// public static async Task SaveProductsAsync(this ICatalogModuleProducts operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SaveProductsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleProperties operations. /// public partial class CatalogModuleProperties : IServiceOperations, ICatalogModuleProperties { /// /// Initializes a new instance of the CatalogModuleProperties class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModuleProperties(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Gets property metainformation by id. /// /// /// The property id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetPropertyWithHttpMessagesAsync(string propertyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (propertyId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "propertyId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("propertyId", propertyId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/properties/{propertyId}").ToString(); _url = _url.Replace("{propertyId}", System.Uri.EscapeDataString(propertyId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new catalog property. /// /// /// The catalog id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewCatalogPropertyWithHttpMessagesAsync(string catalogId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (catalogId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "catalogId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("catalogId", catalogId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewCatalogProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/{catalogId}/properties/getnew").ToString(); _url = _url.Replace("{catalogId}", System.Uri.EscapeDataString(catalogId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Gets the template for a new category property. /// /// /// The category id. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNewCategoryPropertyWithHttpMessagesAsync(string categoryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (categoryId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "categoryId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("categoryId", categoryId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNewCategoryProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/categories/{categoryId}/properties/getnew").ToString(); _url = _url.Replace("{categoryId}", System.Uri.EscapeDataString(categoryId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Creates or updates the specified property. /// /// /// If property.IsNew == True, a new property is created. It's updated /// otherwise /// /// /// The property. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SavePropertyWithHttpMessagesAsync(Property body = default(Property), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/properties").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Deletes property by id. /// /// /// The property id. /// /// /// Flag indicating to remove property values from objects as well /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeletePropertyWithHttpMessagesAsync(string id = default(string), bool? doDeleteValues = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("doDeleteValues", doDeleteValues); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/properties").ToString(); List _queryParameters = new List(); if (id != null) { _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); } if (doDeleteValues != null) { _queryParameters.Add(string.Format("doDeleteValues={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(doDeleteValues, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModuleProperties operations. /// public partial interface ICatalogModuleProperties { /// /// Gets property metainformation by id. /// /// /// The property id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetPropertyWithHttpMessagesAsync(string propertyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new catalog property. /// /// /// The catalog id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewCatalogPropertyWithHttpMessagesAsync(string catalogId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the template for a new category property. /// /// /// The category id. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNewCategoryPropertyWithHttpMessagesAsync(string categoryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates the specified property. /// /// /// If property.IsNew == True, a new property is created. It's updated /// otherwise /// /// /// The property. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SavePropertyWithHttpMessagesAsync(Property body = default(Property), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes property by id. /// /// /// The property id. /// /// /// Flag indicating to remove property values from objects as well /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeletePropertyWithHttpMessagesAsync(string id = default(string), bool? doDeleteValues = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModuleProperties. /// public static partial class CatalogModulePropertiesExtensions { /// /// Gets property metainformation by id. /// /// /// The operations group for this extension method. /// /// /// The property id. /// public static Property GetProperty(this ICatalogModuleProperties operations, string propertyId) { return operations.GetPropertyAsync(propertyId).GetAwaiter().GetResult(); } /// /// Gets property metainformation by id. /// /// /// The operations group for this extension method. /// /// /// The property id. /// /// /// The cancellation token. /// public static async Task GetPropertyAsync(this ICatalogModuleProperties operations, string propertyId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetPropertyWithHttpMessagesAsync(propertyId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new catalog property. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// public static Property GetNewCatalogProperty(this ICatalogModuleProperties operations, string catalogId) { return operations.GetNewCatalogPropertyAsync(catalogId).GetAwaiter().GetResult(); } /// /// Gets the template for a new catalog property. /// /// /// The operations group for this extension method. /// /// /// The catalog id. /// /// /// The cancellation token. /// public static async Task GetNewCatalogPropertyAsync(this ICatalogModuleProperties operations, string catalogId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewCatalogPropertyWithHttpMessagesAsync(catalogId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Gets the template for a new category property. /// /// /// The operations group for this extension method. /// /// /// The category id. /// public static Property GetNewCategoryProperty(this ICatalogModuleProperties operations, string categoryId) { return operations.GetNewCategoryPropertyAsync(categoryId).GetAwaiter().GetResult(); } /// /// Gets the template for a new category property. /// /// /// The operations group for this extension method. /// /// /// The category id. /// /// /// The cancellation token. /// public static async Task GetNewCategoryPropertyAsync(this ICatalogModuleProperties operations, string categoryId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNewCategoryPropertyWithHttpMessagesAsync(categoryId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Creates or updates the specified property. /// /// /// If property.IsNew == True, a new property is created. It's updated /// otherwise /// /// /// The operations group for this extension method. /// /// /// The property. /// public static void SaveProperty(this ICatalogModuleProperties operations, Property body = default(Property)) { operations.SavePropertyAsync(body).GetAwaiter().GetResult(); } /// /// Creates or updates the specified property. /// /// /// If property.IsNew == True, a new property is created. It's updated /// otherwise /// /// /// The operations group for this extension method. /// /// /// The property. /// /// /// The cancellation token. /// public static async Task SavePropertyAsync(this ICatalogModuleProperties operations, Property body = default(Property), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SavePropertyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Deletes property by id. /// /// /// The operations group for this extension method. /// /// /// The property id. /// /// /// Flag indicating to remove property values from objects as well /// public static void DeleteProperty(this ICatalogModuleProperties operations, string id = default(string), bool? doDeleteValues = false) { operations.DeletePropertyAsync(id, doDeleteValues).GetAwaiter().GetResult(); } /// /// Deletes property by id. /// /// /// The operations group for this extension method. /// /// /// The property id. /// /// /// Flag indicating to remove property values from objects as well /// /// /// The cancellation token. /// public static async Task DeletePropertyAsync(this ICatalogModuleProperties operations, string id = default(string), bool? doDeleteValues = false, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeletePropertyWithHttpMessagesAsync(id, doDeleteValues, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModulePropertyDictionaryItems operations. /// public partial class CatalogModulePropertyDictionaryItems : IServiceOperations, ICatalogModulePropertyDictionaryItems { /// /// Initializes a new instance of the CatalogModulePropertyDictionaryItems class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CatalogModulePropertyDictionaryItems(CatalogModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CatalogModuleClient /// public CatalogModuleClient Client { get; private set; } /// /// Search property dictionary items /// /// /// The search criteria /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> SearchPropertyDictionaryItemsWithHttpMessagesAsync(PropertyDictionaryItemSearchCriteria body = default(PropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchPropertyDictionaryItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/dictionaryitems/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Creates or updates the specified property dictionary items /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SaveChangesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveChanges", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/dictionaryitems").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete property dictionary items by ids /// /// /// The identifiers of objects that needed to be deleted /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeletePropertyDictionaryItemsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeletePropertyDictionaryItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/catalog/dictionaryitems").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CatalogModulePropertyDictionaryItems operations. /// public partial interface ICatalogModulePropertyDictionaryItems { /// /// Search property dictionary items /// /// /// The search criteria /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> SearchPropertyDictionaryItemsWithHttpMessagesAsync(PropertyDictionaryItemSearchCriteria body = default(PropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates the specified property dictionary items /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SaveChangesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete property dictionary items by ids /// /// /// The identifiers of objects that needed to be deleted /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeletePropertyDictionaryItemsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CatalogModulePropertyDictionaryItems. /// public static partial class CatalogModulePropertyDictionaryItemsExtensions { /// /// Search property dictionary items /// /// /// The operations group for this extension method. /// /// /// The search criteria /// public static IList SearchPropertyDictionaryItems(this ICatalogModulePropertyDictionaryItems operations, PropertyDictionaryItemSearchCriteria body = default(PropertyDictionaryItemSearchCriteria)) { return operations.SearchPropertyDictionaryItemsAsync(body).GetAwaiter().GetResult(); } /// /// Search property dictionary items /// /// /// The operations group for this extension method. /// /// /// The search criteria /// /// /// The cancellation token. /// public static async Task> SearchPropertyDictionaryItemsAsync(this ICatalogModulePropertyDictionaryItems operations, PropertyDictionaryItemSearchCriteria body = default(PropertyDictionaryItemSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchPropertyDictionaryItemsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Creates or updates the specified property dictionary items /// /// /// The operations group for this extension method. /// /// /// public static void SaveChanges(this ICatalogModulePropertyDictionaryItems operations, IList body = default(IList)) { operations.SaveChangesAsync(body).GetAwaiter().GetResult(); } /// /// Creates or updates the specified property dictionary items /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SaveChangesAsync(this ICatalogModulePropertyDictionaryItems operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SaveChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete property dictionary items by ids /// /// /// The operations group for this extension method. /// /// /// The identifiers of objects that needed to be deleted /// public static void DeletePropertyDictionaryItems(this ICatalogModulePropertyDictionaryItems operations, IList ids = default(IList)) { operations.DeletePropertyDictionaryItemsAsync(ids).GetAwaiter().GetResult(); } /// /// Delete property dictionary items by ids /// /// /// The operations group for this extension method. /// /// /// The identifiers of objects that needed to be deleted /// /// /// The cancellation token. /// public static async Task DeletePropertyDictionaryItemsAsync(this ICatalogModulePropertyDictionaryItems operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeletePropertyDictionaryItemsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SeoInfo { /// /// Initializes a new instance of the SeoInfo class. /// public SeoInfo() { CustomInit(); } /// /// Initializes a new instance of the SeoInfo class. /// /// Slug /// head title tag content /// <meta name="description" /// /> /// <meta name="keywords" /> /// Tenant StoreId which SEO defined /// SEO related object id /// SEO related object type name /// Active/Inactive public SeoInfo(string name = default(string), string semanticUrl = default(string), string pageTitle = default(string), string metaDescription = default(string), string imageAltDescription = default(string), string metaKeywords = default(string), string storeId = default(string), string objectId = default(string), string objectType = default(string), bool? isActive = default(bool?), string languageCode = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; SemanticUrl = semanticUrl; PageTitle = pageTitle; MetaDescription = metaDescription; ImageAltDescription = imageAltDescription; MetaKeywords = metaKeywords; StoreId = storeId; ObjectId = objectId; ObjectType = objectType; IsActive = isActive; LanguageCode = languageCode; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets slug /// [JsonProperty(PropertyName = "semanticUrl")] public string SemanticUrl { get; set; } /// /// Gets or sets head title tag content /// [JsonProperty(PropertyName = "pageTitle")] public string PageTitle { get; set; } /// /// Gets or sets &lt;meta name="description" /&gt; /// [JsonProperty(PropertyName = "metaDescription")] public string MetaDescription { get; set; } /// /// [JsonProperty(PropertyName = "imageAltDescription")] public string ImageAltDescription { get; set; } /// /// Gets or sets &lt;meta name="keywords" /&gt; /// [JsonProperty(PropertyName = "metaKeywords")] public string MetaKeywords { get; set; } /// /// Gets or sets tenant StoreId which SEO defined /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// Gets or sets SEO related object id /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// Gets or sets SEO related object type name /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets active/Inactive /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Image { /// /// Initializes a new instance of the Image class. /// public Image() { CustomInit(); } /// /// Initializes a new instance of the Image class. /// /// Gets or sets the asset type /// identifier. /// Gets or sets the asset group name. /// Gets or sets the asset name. /// Gets or sets the asset language. /// System flag used to mark that object was /// inherited from other public Image(int? sortOrder = default(int?), byte[] binaryData = default(byte[]), string relativeUrl = default(string), string url = default(string), string typeId = default(string), string group = default(string), string name = default(string), string outerId = default(string), string languageCode = default(string), bool? isInherited = default(bool?), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { SortOrder = sortOrder; BinaryData = binaryData; RelativeUrl = relativeUrl; Url = url; TypeId = typeId; Group = group; Name = name; OuterId = outerId; LanguageCode = languageCode; IsInherited = isInherited; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortOrder")] public int? SortOrder { get; set; } /// /// [JsonProperty(PropertyName = "binaryData")] public byte[] BinaryData { get; set; } /// /// [JsonProperty(PropertyName = "relativeUrl")] public string RelativeUrl { get; set; } /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// Gets or sets the asset type identifier. /// [JsonProperty(PropertyName = "typeId")] public string TypeId { get; set; } /// /// Gets or sets the asset group name. /// [JsonProperty(PropertyName = "group")] public string Group { get; set; } /// /// Gets or sets the asset name. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// Gets or sets the asset language. /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// Gets system flag used to mark that object was inherited from other /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; private set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProductAssociation { /// /// Initializes a new instance of the ProductAssociation class. /// public ProductAssociation() { CustomInit(); } /// /// Initializes a new instance of the ProductAssociation class. /// /// Association type (Accessories, Up-Sales, /// Cross-Sales, Related etc) /// Is a primary key of associating object /// Each link element can have an /// associated object like Product, Category, etc. /// Is a primary key of associated object /// Associated object type : /// 'product', 'category' etc /// Display name for associated /// object /// Associated object image /// URL public ProductAssociation(string type = default(string), int? priority = default(int?), int? quantity = default(int?), string itemId = default(string), string associatedObjectId = default(string), string associatedObjectType = default(string), string outerId = default(string), string associatedObjectName = default(string), string associatedObjectImg = default(string), IList tags = default(IList), string imgSrc = default(string), IList images = default(IList), string id = default(string)) { Type = type; Priority = priority; Quantity = quantity; ItemId = itemId; AssociatedObjectId = associatedObjectId; AssociatedObjectType = associatedObjectType; OuterId = outerId; AssociatedObjectName = associatedObjectName; AssociatedObjectImg = associatedObjectImg; Tags = tags; ImgSrc = imgSrc; Images = images; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets association type (Accessories, Up-Sales, Cross-Sales, /// Related etc) /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } /// /// Gets or sets is a primary key of associating object /// [JsonProperty(PropertyName = "itemId")] public string ItemId { get; set; } /// /// Gets or sets each link element can have an associated object like /// Product, Category, etc. /// Is a primary key of associated object /// [JsonProperty(PropertyName = "associatedObjectId")] public string AssociatedObjectId { get; set; } /// /// Gets or sets associated object type : 'product', 'category' etc /// [JsonProperty(PropertyName = "associatedObjectType")] public string AssociatedObjectType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// Gets display name for associated object /// [JsonProperty(PropertyName = "associatedObjectName")] public string AssociatedObjectName { get; private set; } /// /// Gets associated object image URL /// [JsonProperty(PropertyName = "associatedObjectImg")] public string AssociatedObjectImg { get; private set; } /// /// [JsonProperty(PropertyName = "tags")] public IList Tags { get; set; } /// /// [JsonProperty(PropertyName = "imgSrc")] public string ImgSrc { get; private set; } /// /// [JsonProperty(PropertyName = "images")] public IList Images { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PropertyValue { /// /// Initializes a new instance of the PropertyValue class. /// public PropertyValue() { CustomInit(); } /// /// Initializes a new instance of the PropertyValue class. /// /// Possible values include: 'ShortText', /// 'LongText', 'Number', 'DateTime', 'Boolean', 'Integer', /// 'GeoPoint' public PropertyValue(string propertyName = default(string), string propertyId = default(string), string languageCode = default(string), string alias = default(string), string valueType = default(string), string valueId = default(string), object value = default(object), bool? propertyMultivalue = default(bool?), string outerId = default(string), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { PropertyName = propertyName; PropertyId = propertyId; LanguageCode = languageCode; Alias = alias; ValueType = valueType; ValueId = valueId; Value = value; PropertyMultivalue = propertyMultivalue; OuterId = outerId; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyName")] public string PropertyName { get; set; } /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "alias")] public string Alias { get; set; } /// /// Gets or sets possible values include: 'ShortText', 'LongText', /// 'Number', 'DateTime', 'Boolean', 'Integer', 'GeoPoint' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "valueId")] public string ValueId { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "propertyMultivalue")] public bool? PropertyMultivalue { get; private set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PropertyAttribute { /// /// Initializes a new instance of the PropertyAttribute class. /// public PropertyAttribute() { CustomInit(); } /// /// Initializes a new instance of the PropertyAttribute class. /// public PropertyAttribute(string propertyId = default(string), string value = default(string), string name = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { PropertyId = propertyId; Value = value; Name = name; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PropertyDisplayName { /// /// Initializes a new instance of the PropertyDisplayName class. /// public PropertyDisplayName() { CustomInit(); } /// /// Initializes a new instance of the PropertyDisplayName class. /// public PropertyDisplayName(string name = default(string), string languageCode = default(string)) { Name = name; LanguageCode = languageCode; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represents property validation rules definition /// public partial class PropertyValidationRule { /// /// Initializes a new instance of the PropertyValidationRule class. /// public PropertyValidationRule() { CustomInit(); } /// /// Initializes a new instance of the PropertyValidationRule class. /// /// Uniquie value flag constrain /// Down chars count border or null if no /// defined /// Upper chars count border or null if no /// defined /// Custom regular expression public PropertyValidationRule(bool? isUnique = default(bool?), int? charCountMin = default(int?), int? charCountMax = default(int?), string regExp = default(string), string propertyId = default(string), string id = default(string)) { IsUnique = isUnique; CharCountMin = charCountMin; CharCountMax = charCountMax; RegExp = regExp; PropertyId = propertyId; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets uniquie value flag constrain /// [JsonProperty(PropertyName = "isUnique")] public bool? IsUnique { get; set; } /// /// Gets or sets down chars count border or null if no defined /// [JsonProperty(PropertyName = "charCountMin")] public int? CharCountMin { get; set; } /// /// Gets or sets upper chars count border or null if no defined /// [JsonProperty(PropertyName = "charCountMax")] public int? CharCountMax { get; set; } /// /// Gets or sets custom regular expression /// [JsonProperty(PropertyName = "regExp")] public string RegExp { get; set; } /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Property { /// /// Initializes a new instance of the Property class. /// public Property() { CustomInit(); } /// /// Initializes a new instance of the Property class. /// /// Gets or sets a value indicating whether /// user can change property value. /// Gets or sets a value indicating whether /// user can change property metadata or remove this property. /// Gets or sets a value indicating whether this /// instance is new. A new property should be created on server site /// instead of trying to update it. /// Gets or sets the catalog id that this /// product belongs to. /// Gets or sets the category id that this /// product belongs to. /// Gets or sets a value indicating whether this /// VirtoCommerce.CatalogModule.Core.Model.Property is hidden. /// Possible values include: 'ShortText', /// 'LongText', 'Number', 'DateTime', 'Boolean', 'Integer', /// 'GeoPoint' /// Possible values include: 'Product', 'Variation', /// 'Category', 'Catalog' public Property(bool? isReadOnly = default(bool?), bool? isManageable = default(bool?), bool? isNew = default(bool?), string catalogId = default(string), string categoryId = default(string), string name = default(string), bool? required = default(bool?), bool? dictionary = default(bool?), bool? multivalue = default(bool?), bool? multilanguage = default(bool?), bool? hidden = default(bool?), string valueType = default(string), string type = default(string), string outerId = default(string), IList values = default(IList), IList attributes = default(IList), IList displayNames = default(IList), IList validationRules = default(IList), PropertyValidationRule validationRule = default(PropertyValidationRule), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { IsReadOnly = isReadOnly; IsManageable = isManageable; IsNew = isNew; CatalogId = catalogId; CategoryId = categoryId; Name = name; Required = required; Dictionary = dictionary; Multivalue = multivalue; Multilanguage = multilanguage; Hidden = hidden; ValueType = valueType; Type = type; OuterId = outerId; Values = values; Attributes = attributes; DisplayNames = displayNames; ValidationRules = validationRules; ValidationRule = validationRule; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets a value indicating whether user can change property /// value. /// [JsonProperty(PropertyName = "isReadOnly")] public bool? IsReadOnly { get; set; } /// /// Gets or sets a value indicating whether user can change property /// metadata or remove this property. /// [JsonProperty(PropertyName = "isManageable")] public bool? IsManageable { get; private set; } /// /// Gets or sets a value indicating whether this instance is new. A new /// property should be created on server site instead of trying to /// update it. /// [JsonProperty(PropertyName = "isNew")] public bool? IsNew { get; set; } /// /// Gets or sets the catalog id that this product belongs to. /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// Gets or sets the category id that this product belongs to. /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "required")] public bool? Required { get; set; } /// /// [JsonProperty(PropertyName = "dictionary")] public bool? Dictionary { get; set; } /// /// [JsonProperty(PropertyName = "multivalue")] public bool? Multivalue { get; set; } /// /// [JsonProperty(PropertyName = "multilanguage")] public bool? Multilanguage { get; set; } /// /// Gets or sets a value indicating whether this /// VirtoCommerce.CatalogModule.Core.Model.Property is hidden. /// [JsonProperty(PropertyName = "hidden")] public bool? Hidden { get; set; } /// /// Gets or sets possible values include: 'ShortText', 'LongText', /// 'Number', 'DateTime', 'Boolean', 'Integer', 'GeoPoint' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// Gets or sets possible values include: 'Product', 'Variation', /// 'Category', 'Catalog' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "values")] public IList Values { get; set; } /// /// [JsonProperty(PropertyName = "attributes")] public IList Attributes { get; set; } /// /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "validationRules")] public IList ValidationRules { get; set; } /// /// [JsonProperty(PropertyName = "validationRule")] public PropertyValidationRule ValidationRule { get; set; } /// /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CategoryLink { /// /// Initializes a new instance of the CategoryLink class. /// public CategoryLink() { CustomInit(); } /// /// Initializes a new instance of the CategoryLink class. /// /// Entry identifier which this link belongs /// to /// Gets or sets the type of the list /// entry. E.g. "product", "category" /// Product order position in virtual /// catalog public CategoryLink(string entryId = default(string), string listEntryId = default(string), string listEntryType = default(string), int? priority = default(int?), string catalogId = default(string), string categoryId = default(string), Category category = default(Category)) { EntryId = entryId; ListEntryId = listEntryId; ListEntryType = listEntryType; Priority = priority; CatalogId = catalogId; CategoryId = categoryId; Category = category; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets entry identifier which this link belongs to /// [JsonProperty(PropertyName = "entryId")] public string EntryId { get; private set; } /// /// [JsonProperty(PropertyName = "listEntryId")] public string ListEntryId { get; set; } /// /// Gets or sets the type of the list entry. E.g. "product", "category" /// [JsonProperty(PropertyName = "listEntryType")] public string ListEntryType { get; set; } /// /// Gets or sets product order position in virtual catalog /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// [JsonProperty(PropertyName = "category")] public Category Category { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represents one outline element: catalog, category or product. /// public partial class OutlineItem { /// /// Initializes a new instance of the OutlineItem class. /// public OutlineItem() { CustomInit(); } /// /// Initializes a new instance of the OutlineItem class. /// /// Object id /// Object type /// All SEO records for the object /// The name of current item /// True when this object is linked to /// the virtual parent. public OutlineItem(string id = default(string), string seoObjectType = default(string), IList seoInfos = default(IList), string name = default(string), bool? hasVirtualParent = default(bool?)) { Id = id; SeoObjectType = seoObjectType; SeoInfos = seoInfos; Name = name; HasVirtualParent = hasVirtualParent; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets object id /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets object type /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; set; } /// /// Gets or sets all SEO records for the object /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// Gets or sets the name of current item /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets true when this object is linked to the virtual parent. /// [JsonProperty(PropertyName = "hasVirtualParent")] public bool? HasVirtualParent { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represents the path from the catalog to one of the child objects /// (product or category): /// catalog/parent-category1/.../parent-categoryN/object /// public partial class Outline { /// /// Initializes a new instance of the Outline class. /// public Outline() { CustomInit(); } /// /// Initializes a new instance of the Outline class. /// /// Outline parts public Outline(IList items = default(IList)) { Items = items; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets outline parts /// [JsonProperty(PropertyName = "items")] public IList Items { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Category { /// /// Initializes a new instance of the Category class. /// public Category() { CustomInit(); } /// /// Initializes a new instance of the Category class. /// /// Category outline in physical catalog (all /// parent categories ids concatenated. E.g. (1/21/344)) /// Category path in physical catalog (all parent /// categories names concatenated. E.g. (parent1/parent2)) /// Gets the default image /// System flag used to mark that object was /// inherited from other public Category(string catalogId = default(string), string parentId = default(string), string code = default(string), string name = default(string), string outline = default(string), string path = default(string), bool? isVirtual = default(bool?), int? level = default(int?), string packageType = default(string), int? priority = default(int?), bool? isActive = default(bool?), string outerId = default(string), IList properties = default(IList), IList links = default(IList), string taxType = default(string), string seoObjectType = default(string), IList seoInfos = default(IList), string imgSrc = default(string), IList images = default(IList), IList outlines = default(IList), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { CatalogId = catalogId; ParentId = parentId; Code = code; Name = name; Outline = outline; Path = path; IsVirtual = isVirtual; Level = level; PackageType = packageType; Priority = priority; IsActive = isActive; OuterId = outerId; Properties = properties; Links = links; TaxType = taxType; SeoObjectType = seoObjectType; SeoInfos = seoInfos; ImgSrc = imgSrc; Images = images; Outlines = outlines; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "parentId")] public string ParentId { get; set; } /// /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets category outline in physical catalog (all parent categories /// ids concatenated. E.g. (1/21/344)) /// [JsonProperty(PropertyName = "outline")] public string Outline { get; private set; } /// /// Gets or sets category path in physical catalog (all parent /// categories names concatenated. E.g. (parent1/parent2)) /// [JsonProperty(PropertyName = "path")] public string Path { get; set; } /// /// [JsonProperty(PropertyName = "isVirtual")] public bool? IsVirtual { get; set; } /// /// [JsonProperty(PropertyName = "level")] public int? Level { get; set; } /// /// [JsonProperty(PropertyName = "packageType")] public string PackageType { get; set; } /// /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "properties")] public IList Properties { get; set; } /// /// [JsonProperty(PropertyName = "links")] public IList Links { get; set; } /// /// [JsonProperty(PropertyName = "taxType")] public string TaxType { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// Gets the default image /// [JsonProperty(PropertyName = "imgSrc")] public string ImgSrc { get; private set; } /// /// [JsonProperty(PropertyName = "images")] public IList Images { get; set; } /// /// [JsonProperty(PropertyName = "outlines")] public IList Outlines { get; set; } /// /// Gets system flag used to mark that object was inherited from other /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; private set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Asset { /// /// Initializes a new instance of the Asset class. /// public Asset() { CustomInit(); } /// /// Initializes a new instance of the Asset class. /// /// Gets or sets the asset type /// identifier. /// Gets or sets the asset group name. /// Gets or sets the asset name. /// Gets or sets the asset language. /// System flag used to mark that object was /// inherited from other public Asset(string mimeType = default(string), long? size = default(long?), string readableSize = default(string), byte[] binaryData = default(byte[]), string relativeUrl = default(string), string url = default(string), string typeId = default(string), string group = default(string), string name = default(string), string outerId = default(string), string languageCode = default(string), bool? isInherited = default(bool?), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { MimeType = mimeType; Size = size; ReadableSize = readableSize; BinaryData = binaryData; RelativeUrl = relativeUrl; Url = url; TypeId = typeId; Group = group; Name = name; OuterId = outerId; LanguageCode = languageCode; IsInherited = isInherited; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "mimeType")] public string MimeType { get; set; } /// /// [JsonProperty(PropertyName = "size")] public long? Size { get; set; } /// /// [JsonProperty(PropertyName = "readableSize")] public string ReadableSize { get; private set; } /// /// [JsonProperty(PropertyName = "binaryData")] public byte[] BinaryData { get; set; } /// /// [JsonProperty(PropertyName = "relativeUrl")] public string RelativeUrl { get; set; } /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// Gets or sets the asset type identifier. /// [JsonProperty(PropertyName = "typeId")] public string TypeId { get; set; } /// /// Gets or sets the asset group name. /// [JsonProperty(PropertyName = "group")] public string Group { get; set; } /// /// Gets or sets the asset name. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// Gets or sets the asset language. /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// Gets system flag used to mark that object was inherited from other /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; private set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class EditorialReview { /// /// Initializes a new instance of the EditorialReview class. /// public EditorialReview() { CustomInit(); } /// /// Initializes a new instance of the EditorialReview class. /// public EditorialReview(string content = default(string), string reviewType = default(string), string languageCode = default(string), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Content = content; ReviewType = reviewType; LanguageCode = languageCode; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "content")] public string Content { get; set; } /// /// [JsonProperty(PropertyName = "reviewType")] public string ReviewType { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Variation { /// /// Initializes a new instance of the Variation class. /// public Variation() { CustomInit(); } /// /// Initializes a new instance of the Variation class. /// /// SKU code /// Global Trade Item Number (GTIN). These /// identifiers include UPC (in North America), EAN (in Europe), JAN /// (in Japan), and ISBN (for books). /// Product outline in physical catalog (all /// parent categories ids concatenated. E.g. (1/21/344)) /// Product path in physical catalog (all parent /// categories names concatenated. E.g. (parent1/parent2)) /// Can be Physical, Digital or /// Subscription. /// re-downloads limit /// DownloadType: {Standard Product, /// Software, Music} /// Product order position in catalog /// Gets the default image for the /// product. /// Each descendant type should override /// this property to use other object type for seo records /// System flag used to mark that object was /// inherited from other public Variation(string code = default(string), string manufacturerPartNumber = default(string), string gtin = default(string), string name = default(string), string catalogId = default(string), string categoryId = default(string), string outline = default(string), string path = default(string), string titularItemId = default(string), string mainProductId = default(string), bool? isBuyable = default(bool?), bool? isActive = default(bool?), bool? trackInventory = default(bool?), System.DateTime? indexingDate = default(System.DateTime?), int? maxQuantity = default(int?), int? minQuantity = default(int?), string productType = default(string), string packageType = default(string), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), bool? enableReview = default(bool?), int? maxNumberOfDownload = default(int?), System.DateTime? downloadExpiration = default(System.DateTime?), string downloadType = default(string), bool? hasUserAgreement = default(bool?), string shippingType = default(string), string taxType = default(string), string vendor = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), int? priority = default(int?), string outerId = default(string), IList properties = default(IList), IList propertyValues = default(IList), string imgSrc = default(string), IList images = default(IList), IList assets = default(IList), IList links = default(IList), IList variations = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), IList reviews = default(IList), IList associations = default(IList), IList referencedAssociations = default(IList), IList outlines = default(IList), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Code = code; ManufacturerPartNumber = manufacturerPartNumber; Gtin = gtin; Name = name; CatalogId = catalogId; CategoryId = categoryId; Outline = outline; Path = path; TitularItemId = titularItemId; MainProductId = mainProductId; IsBuyable = isBuyable; IsActive = isActive; TrackInventory = trackInventory; IndexingDate = indexingDate; MaxQuantity = maxQuantity; MinQuantity = minQuantity; ProductType = productType; PackageType = packageType; WeightUnit = weightUnit; Weight = weight; MeasureUnit = measureUnit; Height = height; Length = length; Width = width; EnableReview = enableReview; MaxNumberOfDownload = maxNumberOfDownload; DownloadExpiration = downloadExpiration; DownloadType = downloadType; HasUserAgreement = hasUserAgreement; ShippingType = shippingType; TaxType = taxType; Vendor = vendor; StartDate = startDate; EndDate = endDate; Priority = priority; OuterId = outerId; Properties = properties; PropertyValues = propertyValues; ImgSrc = imgSrc; Images = images; Assets = assets; Links = links; Variations = variations; SeoObjectType = seoObjectType; SeoInfos = seoInfos; Reviews = reviews; Associations = associations; ReferencedAssociations = referencedAssociations; Outlines = outlines; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets SKU code /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "manufacturerPartNumber")] public string ManufacturerPartNumber { get; set; } /// /// Gets or sets global Trade Item Number (GTIN). These identifiers /// include UPC (in North America), EAN (in Europe), JAN (in Japan), /// and ISBN (for books). /// [JsonProperty(PropertyName = "gtin")] public string Gtin { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// Gets product outline in physical catalog (all parent categories ids /// concatenated. E.g. (1/21/344)) /// [JsonProperty(PropertyName = "outline")] public string Outline { get; private set; } /// /// Gets product path in physical catalog (all parent categories names /// concatenated. E.g. (parent1/parent2)) /// [JsonProperty(PropertyName = "path")] public string Path { get; private set; } /// /// [JsonProperty(PropertyName = "titularItemId")] public string TitularItemId { get; private set; } /// /// [JsonProperty(PropertyName = "mainProductId")] public string MainProductId { get; set; } /// /// [JsonProperty(PropertyName = "isBuyable")] public bool? IsBuyable { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "trackInventory")] public bool? TrackInventory { get; set; } /// /// [JsonProperty(PropertyName = "indexingDate")] public System.DateTime? IndexingDate { get; set; } /// /// [JsonProperty(PropertyName = "maxQuantity")] public int? MaxQuantity { get; set; } /// /// [JsonProperty(PropertyName = "minQuantity")] public int? MinQuantity { get; set; } /// /// Gets or sets can be Physical, Digital or Subscription. /// [JsonProperty(PropertyName = "productType")] public string ProductType { get; set; } /// /// [JsonProperty(PropertyName = "packageType")] public string PackageType { get; set; } /// /// [JsonProperty(PropertyName = "weightUnit")] public string WeightUnit { get; set; } /// /// [JsonProperty(PropertyName = "weight")] public double? Weight { get; set; } /// /// [JsonProperty(PropertyName = "measureUnit")] public string MeasureUnit { get; set; } /// /// [JsonProperty(PropertyName = "height")] public double? Height { get; set; } /// /// [JsonProperty(PropertyName = "length")] public double? Length { get; set; } /// /// [JsonProperty(PropertyName = "width")] public double? Width { get; set; } /// /// [JsonProperty(PropertyName = "enableReview")] public bool? EnableReview { get; set; } /// /// Gets or sets re-downloads limit /// [JsonProperty(PropertyName = "maxNumberOfDownload")] public int? MaxNumberOfDownload { get; set; } /// /// [JsonProperty(PropertyName = "downloadExpiration")] public System.DateTime? DownloadExpiration { get; set; } /// /// Gets or sets downloadType: {Standard Product, Software, Music} /// [JsonProperty(PropertyName = "downloadType")] public string DownloadType { get; set; } /// /// [JsonProperty(PropertyName = "hasUserAgreement")] public bool? HasUserAgreement { get; set; } /// /// [JsonProperty(PropertyName = "shippingType")] public string ShippingType { get; set; } /// /// [JsonProperty(PropertyName = "taxType")] public string TaxType { get; set; } /// /// [JsonProperty(PropertyName = "vendor")] public string Vendor { get; set; } /// /// [JsonProperty(PropertyName = "startDate")] public System.DateTime? StartDate { get; set; } /// /// [JsonProperty(PropertyName = "endDate")] public System.DateTime? EndDate { get; set; } /// /// Gets or sets product order position in catalog /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "properties")] public IList Properties { get; set; } /// /// [JsonProperty(PropertyName = "propertyValues")] public IList PropertyValues { get; set; } /// /// Gets the default image for the product. /// [JsonProperty(PropertyName = "imgSrc")] public string ImgSrc { get; private set; } /// /// [JsonProperty(PropertyName = "images")] public IList Images { get; set; } /// /// [JsonProperty(PropertyName = "assets")] public IList Assets { get; set; } /// /// [JsonProperty(PropertyName = "links")] public IList Links { get; set; } /// /// [JsonProperty(PropertyName = "variations")] public IList Variations { get; set; } /// /// Gets each descendant type should override this property to use /// other object type for seo records /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "reviews")] public IList Reviews { get; set; } /// /// [JsonProperty(PropertyName = "associations")] public IList Associations { get; set; } /// /// [JsonProperty(PropertyName = "referencedAssociations")] public IList ReferencedAssociations { get; set; } /// /// [JsonProperty(PropertyName = "outlines")] public IList Outlines { get; set; } /// /// Gets system flag used to mark that object was inherited from other /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; private set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogProduct { /// /// Initializes a new instance of the CatalogProduct class. /// public CatalogProduct() { CustomInit(); } /// /// Initializes a new instance of the CatalogProduct class. /// /// SKU code /// Global Trade Item Number (GTIN). These /// identifiers include UPC (in North America), EAN (in Europe), JAN /// (in Japan), and ISBN (for books). /// Product outline in physical catalog (all /// parent categories ids concatenated. E.g. (1/21/344)) /// Product path in physical catalog (all parent /// categories names concatenated. E.g. (parent1/parent2)) /// Can be Physical, Digital or /// Subscription. /// re-downloads limit /// DownloadType: {Standard Product, /// Software, Music} /// Product order position in catalog /// Gets the default image for the /// product. /// Each descendant type should override /// this property to use other object type for seo records /// System flag used to mark that object was /// inherited from other public CatalogProduct(string code = default(string), string manufacturerPartNumber = default(string), string gtin = default(string), string name = default(string), string catalogId = default(string), string categoryId = default(string), string outline = default(string), string path = default(string), string titularItemId = default(string), string mainProductId = default(string), bool? isBuyable = default(bool?), bool? isActive = default(bool?), bool? trackInventory = default(bool?), System.DateTime? indexingDate = default(System.DateTime?), int? maxQuantity = default(int?), int? minQuantity = default(int?), string productType = default(string), string packageType = default(string), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), bool? enableReview = default(bool?), int? maxNumberOfDownload = default(int?), System.DateTime? downloadExpiration = default(System.DateTime?), string downloadType = default(string), bool? hasUserAgreement = default(bool?), string shippingType = default(string), string taxType = default(string), string vendor = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), int? priority = default(int?), string outerId = default(string), IList properties = default(IList), IList propertyValues = default(IList), string imgSrc = default(string), IList images = default(IList), IList assets = default(IList), IList links = default(IList), IList variations = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), IList reviews = default(IList), IList associations = default(IList), IList referencedAssociations = default(IList), IList outlines = default(IList), bool? isInherited = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Code = code; ManufacturerPartNumber = manufacturerPartNumber; Gtin = gtin; Name = name; CatalogId = catalogId; CategoryId = categoryId; Outline = outline; Path = path; TitularItemId = titularItemId; MainProductId = mainProductId; IsBuyable = isBuyable; IsActive = isActive; TrackInventory = trackInventory; IndexingDate = indexingDate; MaxQuantity = maxQuantity; MinQuantity = minQuantity; ProductType = productType; PackageType = packageType; WeightUnit = weightUnit; Weight = weight; MeasureUnit = measureUnit; Height = height; Length = length; Width = width; EnableReview = enableReview; MaxNumberOfDownload = maxNumberOfDownload; DownloadExpiration = downloadExpiration; DownloadType = downloadType; HasUserAgreement = hasUserAgreement; ShippingType = shippingType; TaxType = taxType; Vendor = vendor; StartDate = startDate; EndDate = endDate; Priority = priority; OuterId = outerId; Properties = properties; PropertyValues = propertyValues; ImgSrc = imgSrc; Images = images; Assets = assets; Links = links; Variations = variations; SeoObjectType = seoObjectType; SeoInfos = seoInfos; Reviews = reviews; Associations = associations; ReferencedAssociations = referencedAssociations; Outlines = outlines; IsInherited = isInherited; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets SKU code /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "manufacturerPartNumber")] public string ManufacturerPartNumber { get; set; } /// /// Gets or sets global Trade Item Number (GTIN). These identifiers /// include UPC (in North America), EAN (in Europe), JAN (in Japan), /// and ISBN (for books). /// [JsonProperty(PropertyName = "gtin")] public string Gtin { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// Gets product outline in physical catalog (all parent categories ids /// concatenated. E.g. (1/21/344)) /// [JsonProperty(PropertyName = "outline")] public string Outline { get; private set; } /// /// Gets product path in physical catalog (all parent categories names /// concatenated. E.g. (parent1/parent2)) /// [JsonProperty(PropertyName = "path")] public string Path { get; private set; } /// /// [JsonProperty(PropertyName = "titularItemId")] public string TitularItemId { get; private set; } /// /// [JsonProperty(PropertyName = "mainProductId")] public string MainProductId { get; set; } /// /// [JsonProperty(PropertyName = "isBuyable")] public bool? IsBuyable { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "trackInventory")] public bool? TrackInventory { get; set; } /// /// [JsonProperty(PropertyName = "indexingDate")] public System.DateTime? IndexingDate { get; set; } /// /// [JsonProperty(PropertyName = "maxQuantity")] public int? MaxQuantity { get; set; } /// /// [JsonProperty(PropertyName = "minQuantity")] public int? MinQuantity { get; set; } /// /// Gets or sets can be Physical, Digital or Subscription. /// [JsonProperty(PropertyName = "productType")] public string ProductType { get; set; } /// /// [JsonProperty(PropertyName = "packageType")] public string PackageType { get; set; } /// /// [JsonProperty(PropertyName = "weightUnit")] public string WeightUnit { get; set; } /// /// [JsonProperty(PropertyName = "weight")] public double? Weight { get; set; } /// /// [JsonProperty(PropertyName = "measureUnit")] public string MeasureUnit { get; set; } /// /// [JsonProperty(PropertyName = "height")] public double? Height { get; set; } /// /// [JsonProperty(PropertyName = "length")] public double? Length { get; set; } /// /// [JsonProperty(PropertyName = "width")] public double? Width { get; set; } /// /// [JsonProperty(PropertyName = "enableReview")] public bool? EnableReview { get; set; } /// /// Gets or sets re-downloads limit /// [JsonProperty(PropertyName = "maxNumberOfDownload")] public int? MaxNumberOfDownload { get; set; } /// /// [JsonProperty(PropertyName = "downloadExpiration")] public System.DateTime? DownloadExpiration { get; set; } /// /// Gets or sets downloadType: {Standard Product, Software, Music} /// [JsonProperty(PropertyName = "downloadType")] public string DownloadType { get; set; } /// /// [JsonProperty(PropertyName = "hasUserAgreement")] public bool? HasUserAgreement { get; set; } /// /// [JsonProperty(PropertyName = "shippingType")] public string ShippingType { get; set; } /// /// [JsonProperty(PropertyName = "taxType")] public string TaxType { get; set; } /// /// [JsonProperty(PropertyName = "vendor")] public string Vendor { get; set; } /// /// [JsonProperty(PropertyName = "startDate")] public System.DateTime? StartDate { get; set; } /// /// [JsonProperty(PropertyName = "endDate")] public System.DateTime? EndDate { get; set; } /// /// Gets or sets product order position in catalog /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "properties")] public IList Properties { get; set; } /// /// [JsonProperty(PropertyName = "propertyValues")] public IList PropertyValues { get; set; } /// /// Gets the default image for the product. /// [JsonProperty(PropertyName = "imgSrc")] public string ImgSrc { get; private set; } /// /// [JsonProperty(PropertyName = "images")] public IList Images { get; set; } /// /// [JsonProperty(PropertyName = "assets")] public IList Assets { get; set; } /// /// [JsonProperty(PropertyName = "links")] public IList Links { get; set; } /// /// [JsonProperty(PropertyName = "variations")] public IList Variations { get; set; } /// /// Gets each descendant type should override this property to use /// other object type for seo records /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "reviews")] public IList Reviews { get; set; } /// /// [JsonProperty(PropertyName = "associations")] public IList Associations { get; set; } /// /// [JsonProperty(PropertyName = "referencedAssociations")] public IList ReferencedAssociations { get; set; } /// /// [JsonProperty(PropertyName = "outlines")] public IList Outlines { get; set; } /// /// Gets system flag used to mark that object was inherited from other /// [JsonProperty(PropertyName = "isInherited")] public bool? IsInherited { get; private set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PropertyDictionaryItemLocalizedValue { /// /// Initializes a new instance of the /// PropertyDictionaryItemLocalizedValue class. /// public PropertyDictionaryItemLocalizedValue() { CustomInit(); } /// /// Initializes a new instance of the /// PropertyDictionaryItemLocalizedValue class. /// public PropertyDictionaryItemLocalizedValue(string languageCode = default(string), string value = default(string)) { LanguageCode = languageCode; Value = value; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PropertyDictionaryItem { /// /// Initializes a new instance of the PropertyDictionaryItem class. /// public PropertyDictionaryItem() { CustomInit(); } /// /// Initializes a new instance of the PropertyDictionaryItem class. /// public PropertyDictionaryItem(string propertyId = default(string), string alias = default(string), int? sortOrder = default(int?), IList localizedValues = default(IList), string id = default(string)) { PropertyId = propertyId; Alias = alias; SortOrder = sortOrder; LocalizedValues = localizedValues; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "alias")] public string Alias { get; set; } /// /// [JsonProperty(PropertyName = "sortOrder")] public int? SortOrder { get; set; } /// /// [JsonProperty(PropertyName = "localizedValues")] public IList LocalizedValues { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProductAssociationSearchCriteria { /// /// Initializes a new instance of the ProductAssociationSearchCriteria /// class. /// public ProductAssociationSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the ProductAssociationSearchCriteria /// class. /// public ProductAssociationSearchCriteria(string group = default(string), IList tags = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { Group = group; Tags = tags; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "group")] public string Group { get; set; } /// /// [JsonProperty(PropertyName = "tags")] public IList Tags { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProductAssociationSearchResult { /// /// Initializes a new instance of the ProductAssociationSearchResult /// class. /// public ProductAssociationSearchResult() { CustomInit(); } /// /// Initializes a new instance of the ProductAssociationSearchResult /// class. /// public ProductAssociationSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogSearchCriteria { /// /// Initializes a new instance of the CatalogSearchCriteria class. /// public CatalogSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the CatalogSearchCriteria class. /// public CatalogSearchCriteria(IList catalogIds = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { CatalogIds = catalogIds; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "catalogIds")] public IList CatalogIds { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogLanguage { /// /// Initializes a new instance of the CatalogLanguage class. /// public CatalogLanguage() { CustomInit(); } /// /// Initializes a new instance of the CatalogLanguage class. /// public CatalogLanguage(string catalogId = default(string), bool? isDefault = default(bool?), string languageCode = default(string), string id = default(string)) { CatalogId = catalogId; IsDefault = isDefault; LanguageCode = languageCode; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "isDefault")] public bool? IsDefault { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Catalog { /// /// Initializes a new instance of the Catalog class. /// public Catalog() { CustomInit(); } /// /// Initializes a new instance of the Catalog class. /// public Catalog(string name = default(string), bool? isVirtual = default(bool?), string outerId = default(string), CatalogLanguage defaultLanguage = default(CatalogLanguage), IList languages = default(IList), IList properties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; IsVirtual = isVirtual; OuterId = outerId; DefaultLanguage = defaultLanguage; Languages = languages; Properties = properties; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "isVirtual")] public bool? IsVirtual { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "defaultLanguage")] public CatalogLanguage DefaultLanguage { get; set; } /// /// [JsonProperty(PropertyName = "languages")] public IList Languages { get; set; } /// /// [JsonProperty(PropertyName = "properties")] public IList Properties { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogSearchResult { /// /// Initializes a new instance of the CatalogSearchResult class. /// public CatalogSearchResult() { CustomInit(); } /// /// Initializes a new instance of the CatalogSearchResult class. /// public CatalogSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NumericRange { /// /// Initializes a new instance of the NumericRange class. /// public NumericRange() { CustomInit(); } /// /// Initializes a new instance of the NumericRange class. /// public NumericRange(double? lower = default(double?), double? upper = default(double?), bool? includeLower = default(bool?), bool? includeUpper = default(bool?)) { Lower = lower; Upper = upper; IncludeLower = includeLower; IncludeUpper = includeUpper; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "lower")] public double? Lower { get; set; } /// /// [JsonProperty(PropertyName = "upper")] public double? Upper { get; set; } /// /// [JsonProperty(PropertyName = "includeLower")] public bool? IncludeLower { get; set; } /// /// [JsonProperty(PropertyName = "includeUpper")] public bool? IncludeUpper { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class GeoPoint { /// /// Initializes a new instance of the GeoPoint class. /// public GeoPoint() { CustomInit(); } /// /// Initializes a new instance of the GeoPoint class. /// public GeoPoint(double? latitude = default(double?), double? longitude = default(double?)) { Latitude = latitude; Longitude = longitude; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "latitude")] public double? Latitude { get; set; } /// /// [JsonProperty(PropertyName = "longitude")] public double? Longitude { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class GeoDistanceFilter { /// /// Initializes a new instance of the GeoDistanceFilter class. /// public GeoDistanceFilter() { CustomInit(); } /// /// Initializes a new instance of the GeoDistanceFilter class. /// public GeoDistanceFilter(string fieldName = default(string), GeoPoint location = default(GeoPoint), double? distance = default(double?)) { FieldName = fieldName; Location = location; Distance = distance; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "fieldName")] public string FieldName { get; set; } /// /// [JsonProperty(PropertyName = "location")] public GeoPoint Location { get; set; } /// /// [JsonProperty(PropertyName = "distance")] public double? Distance { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProductIndexedSearchCriteria { /// /// Initializes a new instance of the ProductIndexedSearchCriteria /// class. /// public ProductIndexedSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the ProductIndexedSearchCriteria /// class. /// /// Physical, Digital, etc. /// Gets or sets the class types. /// Specifies if we search for hidden /// products. /// Gets or sets the start date. The date must /// be in UTC format as that is format indexes are stored in. /// Gets or sets the start date from /// filter. Used for filtering new products. The date must be in UTC /// format as that is format indexes are stored in. /// Gets or sets the end date. The date must be /// in UTC format as that is format indexes are stored in. /// Gets or sets a "white" list of /// aggregation keys that identify preconfigured aggregations, which /// SHOULD be calculated and returned with the search result. /// Gets or sets a "black" list of /// aggregation keys that identify preconfigured aggregations, which /// SHOULD NOT be calculated and returned with the search /// result. /// Override base SortInfo property to support /// GeoSortInfo sorting types /// CategoryId1/CategoryId2, no catalog should be /// included in the outline /// CategoryId1/CategoryId2, no catalog should /// be included in the outline /// Term format: name:value1,value2 /// Assigned groups for current user. Data /// format: user_groups:value1,value2 /// Enable fuzzy search, i.e. allow to /// search color:white even if color:wihte actually passed to /// criteria /// Gets or sets the search provider specific /// raw search query; all other search criteria will be ignored /// Allows to retrieve only a specific set /// of fields in the result hits public ProductIndexedSearchCriteria(string objectType = default(string), string productType = default(string), string currency = default(string), IList pricelists = default(IList), NumericRange priceRange = default(NumericRange), IList classTypes = default(IList), bool? withHidden = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? startDateFrom = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), IList includeAggregations = default(IList), IList excludeAggregations = default(IList), GeoDistanceFilter geoDistanceFilter = default(GeoDistanceFilter), IList sortInfos = default(IList), string storeId = default(string), string catalogId = default(string), string outline = default(string), IList outlines = default(IList), IList terms = default(IList), IList userGroups = default(IList), bool? isFuzzySearch = default(bool?), string rawQuery = default(string), IList includeFields = default(IList), string searchPhrase = default(string), string keyword = default(string), string responseGroup = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string languageCode = default(string), string sort = default(string), int? skip = default(int?), int? take = default(int?)) { ObjectType = objectType; ProductType = productType; Currency = currency; Pricelists = pricelists; PriceRange = priceRange; ClassTypes = classTypes; WithHidden = withHidden; StartDate = startDate; StartDateFrom = startDateFrom; EndDate = endDate; IncludeAggregations = includeAggregations; ExcludeAggregations = excludeAggregations; GeoDistanceFilter = geoDistanceFilter; SortInfos = sortInfos; StoreId = storeId; CatalogId = catalogId; Outline = outline; Outlines = outlines; Terms = terms; UserGroups = userGroups; IsFuzzySearch = isFuzzySearch; RawQuery = rawQuery; IncludeFields = includeFields; SearchPhrase = searchPhrase; Keyword = keyword; ResponseGroup = responseGroup; ObjectTypes = objectTypes; ObjectIds = objectIds; LanguageCode = languageCode; Sort = sort; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets physical, Digital, etc. /// [JsonProperty(PropertyName = "productType")] public string ProductType { get; set; } /// /// [JsonProperty(PropertyName = "currency")] public string Currency { get; set; } /// /// [JsonProperty(PropertyName = "pricelists")] public IList Pricelists { get; set; } /// /// [JsonProperty(PropertyName = "priceRange")] public NumericRange PriceRange { get; set; } /// /// Gets or sets the class types. /// [JsonProperty(PropertyName = "classTypes")] public IList ClassTypes { get; set; } /// /// Gets or sets specifies if we search for hidden products. /// [JsonProperty(PropertyName = "withHidden")] public bool? WithHidden { get; set; } /// /// Gets or sets the start date. The date must be in UTC format as that /// is format indexes are stored in. /// [JsonProperty(PropertyName = "startDate")] public System.DateTime? StartDate { get; set; } /// /// Gets or sets the start date from filter. Used for filtering new /// products. The date must be in UTC format as that is format indexes /// are stored in. /// [JsonProperty(PropertyName = "startDateFrom")] public System.DateTime? StartDateFrom { get; set; } /// /// Gets or sets the end date. The date must be in UTC format as that /// is format indexes are stored in. /// [JsonProperty(PropertyName = "endDate")] public System.DateTime? EndDate { get; set; } /// /// Gets or sets a "white" list of aggregation keys that identify /// preconfigured aggregations, which SHOULD be calculated and returned /// with the search result. /// [JsonProperty(PropertyName = "includeAggregations")] public IList IncludeAggregations { get; set; } /// /// Gets or sets a "black" list of aggregation keys that identify /// preconfigured aggregations, which SHOULD NOT be calculated and /// returned with the search result. /// [JsonProperty(PropertyName = "excludeAggregations")] public IList ExcludeAggregations { get; set; } /// /// [JsonProperty(PropertyName = "geoDistanceFilter")] public GeoDistanceFilter GeoDistanceFilter { get; set; } /// /// Gets override base SortInfo property to support GeoSortInfo sorting /// types /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// Gets or sets categoryId1/CategoryId2, no catalog should be included /// in the outline /// [JsonProperty(PropertyName = "outline")] public string Outline { get; set; } /// /// Gets or sets categoryId1/CategoryId2, no catalog should be included /// in the outline /// [JsonProperty(PropertyName = "outlines")] public IList Outlines { get; set; } /// /// Gets or sets term format: name:value1,value2 /// [JsonProperty(PropertyName = "terms")] public IList Terms { get; set; } /// /// Gets or sets assigned groups for current user. Data format: /// user_groups:value1,value2 /// [JsonProperty(PropertyName = "userGroups")] public IList UserGroups { get; set; } /// /// Gets or sets enable fuzzy search, i.e. allow to search color:white /// even if color:wihte actually passed to criteria /// [JsonProperty(PropertyName = "isFuzzySearch")] public bool? IsFuzzySearch { get; set; } /// /// Gets or sets the search provider specific raw search query; all /// other search criteria will be ignored /// [JsonProperty(PropertyName = "rawQuery")] public string RawQuery { get; set; } /// /// Gets or sets allows to retrieve only a specific set of fields in /// the result hits /// [JsonProperty(PropertyName = "includeFields")] public IList IncludeFields { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class AggregationLabel { /// /// Initializes a new instance of the AggregationLabel class. /// public AggregationLabel() { CustomInit(); } /// /// Initializes a new instance of the AggregationLabel class. /// public AggregationLabel(string language = default(string), string label = default(string)) { Language = language; Label = label; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } /// /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class AggregationItem { /// /// Initializes a new instance of the AggregationItem class. /// public AggregationItem() { CustomInit(); } /// /// Initializes a new instance of the AggregationItem class. /// /// Gets or sets the aggregation item value /// Gets or sets the aggregation item count /// Gets or sets the flag for aggregation item /// is applied /// Gets or sets the collection of the aggregation /// item labels /// Gets or sets the request lower /// bound for range aggregation value /// Gets or sets the request lower /// bound for range aggregation value public AggregationItem(object value = default(object), int? count = default(int?), bool? isApplied = default(bool?), IList labels = default(IList), string requestedLowerBound = default(string), string requestedUpperBound = default(string)) { Value = value; Count = count; IsApplied = isApplied; Labels = labels; RequestedLowerBound = requestedLowerBound; RequestedUpperBound = requestedUpperBound; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets the aggregation item value /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// Gets or sets the aggregation item count /// [JsonProperty(PropertyName = "count")] public int? Count { get; set; } /// /// Gets or sets the flag for aggregation item is applied /// [JsonProperty(PropertyName = "isApplied")] public bool? IsApplied { get; set; } /// /// Gets or sets the collection of the aggregation item labels /// [JsonProperty(PropertyName = "labels")] public IList Labels { get; set; } /// /// Gets or sets the request lower bound for range aggregation value /// [JsonProperty(PropertyName = "requestedLowerBound")] public string RequestedLowerBound { get; set; } /// /// Gets or sets the request lower bound for range aggregation value /// [JsonProperty(PropertyName = "requestedUpperBound")] public string RequestedUpperBound { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Aggregation { /// /// Initializes a new instance of the Aggregation class. /// public Aggregation() { CustomInit(); } /// /// Initializes a new instance of the Aggregation class. /// /// Gets or sets the value of the /// aggregation type /// Gets or sets the value of the aggregation /// field /// Gets or sets the collection of the aggregation /// labels /// Gets or sets the collection of the aggregation /// items public Aggregation(string aggregationType = default(string), string field = default(string), IList labels = default(IList), IList items = default(IList)) { AggregationType = aggregationType; Field = field; Labels = labels; Items = items; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets the value of the aggregation type /// [JsonProperty(PropertyName = "aggregationType")] public string AggregationType { get; set; } /// /// Gets or sets the value of the aggregation field /// [JsonProperty(PropertyName = "field")] public string Field { get; set; } /// /// Gets or sets the collection of the aggregation labels /// [JsonProperty(PropertyName = "labels")] public IList Labels { get; set; } /// /// Gets or sets the collection of the aggregation items /// [JsonProperty(PropertyName = "items")] public IList Items { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProductIndexedSearchResult { /// /// Initializes a new instance of the ProductIndexedSearchResult class. /// public ProductIndexedSearchResult() { CustomInit(); } /// /// Initializes a new instance of the ProductIndexedSearchResult class. /// public ProductIndexedSearchResult(long? totalCount = default(long?), IList items = default(IList), IList aggregations = default(IList)) { TotalCount = totalCount; Items = items; Aggregations = aggregations; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public long? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "items")] public IList Items { get; set; } /// /// [JsonProperty(PropertyName = "aggregations")] public IList Aggregations { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CategoryIndexedSearchCriteria { /// /// Initializes a new instance of the CategoryIndexedSearchCriteria /// class. /// public CategoryIndexedSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the CategoryIndexedSearchCriteria /// class. /// /// CategoryId1/CategoryId2, no catalog should be /// included in the outline /// CategoryId1/CategoryId2, no catalog should /// be included in the outline /// Term format: name:value1,value2 /// Assigned groups for current user. Data /// format: user_groups:value1,value2 /// Enable fuzzy search, i.e. allow to /// search color:white even if color:wihte actually passed to /// criteria /// Gets or sets the search provider specific /// raw search query; all other search criteria will be ignored /// Allows to retrieve only a specific set /// of fields in the result hits public CategoryIndexedSearchCriteria(string objectType = default(string), string storeId = default(string), string catalogId = default(string), string outline = default(string), IList outlines = default(IList), IList terms = default(IList), IList userGroups = default(IList), bool? isFuzzySearch = default(bool?), string rawQuery = default(string), IList includeFields = default(IList), string searchPhrase = default(string), string keyword = default(string), string responseGroup = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { ObjectType = objectType; StoreId = storeId; CatalogId = catalogId; Outline = outline; Outlines = outlines; Terms = terms; UserGroups = userGroups; IsFuzzySearch = isFuzzySearch; RawQuery = rawQuery; IncludeFields = includeFields; SearchPhrase = searchPhrase; Keyword = keyword; ResponseGroup = responseGroup; ObjectTypes = objectTypes; ObjectIds = objectIds; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// Gets or sets categoryId1/CategoryId2, no catalog should be included /// in the outline /// [JsonProperty(PropertyName = "outline")] public string Outline { get; set; } /// /// Gets or sets categoryId1/CategoryId2, no catalog should be included /// in the outline /// [JsonProperty(PropertyName = "outlines")] public IList Outlines { get; set; } /// /// Gets or sets term format: name:value1,value2 /// [JsonProperty(PropertyName = "terms")] public IList Terms { get; set; } /// /// Gets or sets assigned groups for current user. Data format: /// user_groups:value1,value2 /// [JsonProperty(PropertyName = "userGroups")] public IList UserGroups { get; set; } /// /// Gets or sets enable fuzzy search, i.e. allow to search color:white /// even if color:wihte actually passed to criteria /// [JsonProperty(PropertyName = "isFuzzySearch")] public bool? IsFuzzySearch { get; set; } /// /// Gets or sets the search provider specific raw search query; all /// other search criteria will be ignored /// [JsonProperty(PropertyName = "rawQuery")] public string RawQuery { get; set; } /// /// Gets or sets allows to retrieve only a specific set of fields in /// the result hits /// [JsonProperty(PropertyName = "includeFields")] public IList IncludeFields { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CategoryIndexedSearchResult { /// /// Initializes a new instance of the CategoryIndexedSearchResult /// class. /// public CategoryIndexedSearchResult() { CustomInit(); } /// /// Initializes a new instance of the CategoryIndexedSearchResult /// class. /// public CategoryIndexedSearchResult(long? totalCount = default(long?), IList items = default(IList), IList aggregations = default(IList)) { TotalCount = totalCount; Items = items; Aggregations = aggregations; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public long? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "items")] public IList Items { get; set; } /// /// [JsonProperty(PropertyName = "aggregations")] public IList Aggregations { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CatalogListEntrySearchCriteria { /// /// Initializes a new instance of the CatalogListEntrySearchCriteria /// class. /// public CatalogListEntrySearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the CatalogListEntrySearchCriteria /// class. /// /// Search by vendor /// Search product with specified /// type /// Search within variations of specified /// main product /// Search in all children categories /// for specified catalog or categories /// Also search in variations public CatalogListEntrySearchCriteria(string code = default(string), string vendorId = default(string), IList vendorIds = default(IList), string productType = default(string), IList productTypes = default(IList), bool? withHidden = default(bool?), bool? hideDirectLinkedCategories = default(bool?), string mainProductId = default(string), bool? searchInChildren = default(bool?), bool? searchInVariations = default(bool?), bool? onlyBuyable = default(bool?), bool? onlyWithTrackingInventory = default(bool?), string catalogId = default(string), IList catalogIds = default(IList), string categoryId = default(string), IList categoryIds = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { Code = code; VendorId = vendorId; VendorIds = vendorIds; ProductType = productType; ProductTypes = productTypes; WithHidden = withHidden; HideDirectLinkedCategories = hideDirectLinkedCategories; MainProductId = mainProductId; SearchInChildren = searchInChildren; SearchInVariations = searchInVariations; OnlyBuyable = onlyBuyable; OnlyWithTrackingInventory = onlyWithTrackingInventory; CatalogId = catalogId; CatalogIds = catalogIds; CategoryId = categoryId; CategoryIds = categoryIds; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// Gets or sets search by vendor /// [JsonProperty(PropertyName = "vendorId")] public string VendorId { get; set; } /// /// [JsonProperty(PropertyName = "vendorIds")] public IList VendorIds { get; set; } /// /// Gets or sets search product with specified type /// [JsonProperty(PropertyName = "productType")] public string ProductType { get; set; } /// /// [JsonProperty(PropertyName = "productTypes")] public IList ProductTypes { get; set; } /// /// [JsonProperty(PropertyName = "withHidden")] public bool? WithHidden { get; set; } /// /// [JsonProperty(PropertyName = "hideDirectLinkedCategories")] public bool? HideDirectLinkedCategories { get; set; } /// /// Gets or sets search within variations of specified main product /// [JsonProperty(PropertyName = "mainProductId")] public string MainProductId { get; set; } /// /// Gets or sets search in all children categories for specified /// catalog or categories /// [JsonProperty(PropertyName = "searchInChildren")] public bool? SearchInChildren { get; set; } /// /// Gets or sets also search in variations /// [JsonProperty(PropertyName = "searchInVariations")] public bool? SearchInVariations { get; set; } /// /// [JsonProperty(PropertyName = "onlyBuyable")] public bool? OnlyBuyable { get; set; } /// /// [JsonProperty(PropertyName = "onlyWithTrackingInventory")] public bool? OnlyWithTrackingInventory { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "catalogIds")] public IList CatalogIds { get; set; } /// /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// [JsonProperty(PropertyName = "categoryIds")] public IList CategoryIds { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Base class for all entries used in catalog categories browsing. /// public partial class ListEntryBase { /// /// Initializes a new instance of the ListEntryBase class. /// public ListEntryBase() { CustomInit(); } /// /// Initializes a new instance of the ListEntryBase class. /// /// Gets or sets the type. E.g. "product", /// "category" /// Gets or sets a value indicating whether this /// entry is active. /// Gets or sets the image URL. /// Gets or sets the entry code. /// Gets or sets the name. /// Gets or sets the links. /// All entry parents ids /// All entry parents names /// Gets or sets the catalog id. public ListEntryBase(string type = default(string), bool? isActive = default(bool?), string imageUrl = default(string), string code = default(string), string name = default(string), IList links = default(IList), IList outline = default(IList), IList path = default(IList), string catalogId = default(string), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Type = type; IsActive = isActive; ImageUrl = imageUrl; Code = code; Name = name; Links = links; Outline = outline; Path = path; CatalogId = catalogId; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets the type. E.g. "product", "category" /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// Gets or sets a value indicating whether this entry is active. /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// Gets or sets the image URL. /// [JsonProperty(PropertyName = "imageUrl")] public string ImageUrl { get; set; } /// /// Gets or sets the entry code. /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// Gets or sets the name. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the links. /// [JsonProperty(PropertyName = "links")] public IList Links { get; set; } /// /// Gets or sets all entry parents ids /// [JsonProperty(PropertyName = "outline")] public IList Outline { get; set; } /// /// Gets or sets all entry parents names /// [JsonProperty(PropertyName = "path")] public IList Path { get; set; } /// /// Gets or sets the catalog id. /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ListEntrySearchResult { /// /// Initializes a new instance of the ListEntrySearchResult class. /// public ListEntrySearchResult() { CustomInit(); } /// /// Initializes a new instance of the ListEntrySearchResult class. /// /// Gets or sets the list entries. public ListEntrySearchResult(IList listEntries = default(IList), int? totalCount = default(int?), IList results = default(IList)) { ListEntries = listEntries; TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets the list entries. /// [JsonProperty(PropertyName = "listEntries")] public IList ListEntries { get; private set; } /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Information to search and create links to categories and items /// public partial class BulkLinkCreationRequest { /// /// Initializes a new instance of the BulkLinkCreationRequest class. /// public BulkLinkCreationRequest() { CustomInit(); } /// /// Initializes a new instance of the BulkLinkCreationRequest class. /// /// The target category identifier for the /// link /// The target catalog identifier for the /// link public BulkLinkCreationRequest(CatalogListEntrySearchCriteria searchCriteria = default(CatalogListEntrySearchCriteria), string categoryId = default(string), string catalogId = default(string)) { SearchCriteria = searchCriteria; CategoryId = categoryId; CatalogId = catalogId; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "searchCriteria")] public CatalogListEntrySearchCriteria SearchCriteria { get; set; } /// /// Gets or sets the target category identifier for the link /// [JsonProperty(PropertyName = "categoryId")] public string CategoryId { get; set; } /// /// Gets or sets the target catalog identifier for the link /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represents move list entries command /// public partial class ListEntriesMoveRequest { /// /// Initializes a new instance of the ListEntriesMoveRequest class. /// public ListEntriesMoveRequest() { CustomInit(); } /// /// Initializes a new instance of the ListEntriesMoveRequest class. /// public ListEntriesMoveRequest(string catalog = default(string), string catalogId = default(string), string category = default(string), IList listEntries = default(IList)) { Catalog = catalog; CatalogId = catalogId; Category = category; ListEntries = listEntries; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "catalog")] public string Catalog { get; set; } /// /// [JsonProperty(PropertyName = "catalogId")] public string CatalogId { get; private set; } /// /// [JsonProperty(PropertyName = "category")] public string Category { get; set; } /// /// [JsonProperty(PropertyName = "listEntries")] public IList ListEntries { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Search criteria used for search property dictionary items /// public partial class PropertyDictionaryItemSearchCriteria { /// /// Initializes a new instance of the /// PropertyDictionaryItemSearchCriteria class. /// public PropertyDictionaryItemSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the /// PropertyDictionaryItemSearchCriteria class. /// public PropertyDictionaryItemSearchCriteria(IList propertyIds = default(IList), IList catalogIds = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { PropertyIds = propertyIds; CatalogIds = catalogIds; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyIds")] public IList PropertyIds { get; set; } /// /// [JsonProperty(PropertyName = "catalogIds")] public IList CatalogIds { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/ContentModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ContentModuleClient : ServiceClient, IContentModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the IContent. /// public virtual IContent Content { get; private set; } /// /// Gets the IMenu. /// public virtual IMenu Menu { get; private set; } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling ContentModuleClient.Dispose(). False: will not dispose provided httpClient protected ContentModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected ContentModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected ContentModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected ContentModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected ContentModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public ContentModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling ContentModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public ContentModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public ContentModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public ContentModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the ContentModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public ContentModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { Content = new Content(this); Menu = new Menu(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface IContentModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the IContent. /// IContent Content { get; } /// /// Gets the IMenu. /// IMenu Menu { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Content operations. /// public partial class Content : IServiceOperations, IContent { /// /// Initializes a new instance of the Content class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Content(ContentModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the ContentModuleClient /// public ContentModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetStoreContentStatsWithHttpMessagesAsync(string storeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetStoreContentStats", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{storeId}/stats").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task DeleteContentWithHttpMessagesAsync(string contentType, string storeId, IList urls = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("urls", urls); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteContent", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (urls != null) { _queryParameters.Add(string.Format("urls={0}", System.Uri.EscapeDataString(string.Join(",", urls)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetContentItemDataStreamWithHttpMessagesAsync(string contentType, string storeId, string relativeUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("relativeUrl", relativeUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetContentItemDataStream", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (relativeUrl != null) { _queryParameters.Add(string.Format("relativeUrl={0}", System.Uri.EscapeDataString(relativeUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> UploadContentWithHttpMessagesAsync(string contentType, string storeId, string folderUrl = default(string), string url = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("folderUrl", folderUrl); tracingParameters.Add("url", url); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UploadContent", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (folderUrl != null) { _queryParameters.Add(string.Format("folderUrl={0}", System.Uri.EscapeDataString(folderUrl))); } if (url != null) { _queryParameters.Add(string.Format("url={0}", System.Uri.EscapeDataString(url))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> SearchContentWithHttpMessagesAsync(string contentType, string storeId, string folderUrl = default(string), string keyword = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("folderUrl", folderUrl); tracingParameters.Add("keyword", keyword); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchContent", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}/search").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (folderUrl != null) { _queryParameters.Add(string.Format("folderUrl={0}", System.Uri.EscapeDataString(folderUrl))); } if (keyword != null) { _queryParameters.Add(string.Format("keyword={0}", System.Uri.EscapeDataString(keyword))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task MoveContentWithHttpMessagesAsync(string contentType, string storeId, string oldUrl = default(string), string newUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("oldUrl", oldUrl); tracingParameters.Add("newUrl", newUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "MoveContent", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}/move").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (oldUrl != null) { _queryParameters.Add(string.Format("oldUrl={0}", System.Uri.EscapeDataString(oldUrl))); } if (newUrl != null) { _queryParameters.Add(string.Format("newUrl={0}", System.Uri.EscapeDataString(newUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task CopyContentWithHttpMessagesAsync(string srcPath = default(string), string destPath = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("srcPath", srcPath); tracingParameters.Add("destPath", destPath); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CopyContent", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/copy").ToString(); List _queryParameters = new List(); if (srcPath != null) { _queryParameters.Add(string.Format("srcPath={0}", System.Uri.EscapeDataString(srcPath))); } if (destPath != null) { _queryParameters.Add(string.Format("destPath={0}", System.Uri.EscapeDataString(destPath))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task UnpackWithHttpMessagesAsync(string contentType, string storeId, string archivePath = default(string), string destPath = "default", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("archivePath", archivePath); tracingParameters.Add("destPath", destPath); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Unpack", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}/unpack").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (archivePath != null) { _queryParameters.Add(string.Format("archivePath={0}", System.Uri.EscapeDataString(archivePath))); } if (destPath != null) { _queryParameters.Add(string.Format("destPath={0}", System.Uri.EscapeDataString(destPath))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task CreateContentFolderWithHttpMessagesAsync(string contentType, string storeId, ContentFolder body = default(ContentFolder), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (contentType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); } if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("contentType", contentType); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateContentFolder", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/content/{contentType}/{storeId}/folder").ToString(); _url = _url.Replace("{contentType}", System.Uri.EscapeDataString(contentType)); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Content operations. /// public partial interface IContent { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetStoreContentStatsWithHttpMessagesAsync(string storeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task DeleteContentWithHttpMessagesAsync(string contentType, string storeId, IList urls = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetContentItemDataStreamWithHttpMessagesAsync(string contentType, string storeId, string relativeUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> UploadContentWithHttpMessagesAsync(string contentType, string storeId, string folderUrl = default(string), string url = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> SearchContentWithHttpMessagesAsync(string contentType, string storeId, string folderUrl = default(string), string keyword = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task MoveContentWithHttpMessagesAsync(string contentType, string storeId, string oldUrl = default(string), string newUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task CopyContentWithHttpMessagesAsync(string srcPath = default(string), string destPath = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task UnpackWithHttpMessagesAsync(string contentType, string storeId, string archivePath = default(string), string destPath = "default", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task CreateContentFolderWithHttpMessagesAsync(string contentType, string storeId, ContentFolder body = default(ContentFolder), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Content. /// public static partial class ContentExtensions { /// /// The operations group for this extension method. /// /// /// public static ContentStatistic GetStoreContentStats(this IContent operations, string storeId) { return operations.GetStoreContentStatsAsync(storeId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetStoreContentStatsAsync(this IContent operations, string storeId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetStoreContentStatsWithHttpMessagesAsync(storeId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static void DeleteContent(this IContent operations, string contentType, string storeId, IList urls = default(IList)) { operations.DeleteContentAsync(contentType, storeId, urls).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task DeleteContentAsync(this IContent operations, string contentType, string storeId, IList urls = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteContentWithHttpMessagesAsync(contentType, storeId, urls, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static byte[] GetContentItemDataStream(this IContent operations, string contentType, string storeId, string relativeUrl = default(string)) { return operations.GetContentItemDataStreamAsync(contentType, storeId, relativeUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task GetContentItemDataStreamAsync(this IContent operations, string contentType, string storeId, string relativeUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetContentItemDataStreamWithHttpMessagesAsync(contentType, storeId, relativeUrl, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// public static IList UploadContent(this IContent operations, string contentType, string storeId, string folderUrl = default(string), string url = default(string)) { return operations.UploadContentAsync(contentType, storeId, folderUrl, url).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task> UploadContentAsync(this IContent operations, string contentType, string storeId, string folderUrl = default(string), string url = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UploadContentWithHttpMessagesAsync(contentType, storeId, folderUrl, url, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// public static IList SearchContent(this IContent operations, string contentType, string storeId, string folderUrl = default(string), string keyword = default(string)) { return operations.SearchContentAsync(contentType, storeId, folderUrl, keyword).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task> SearchContentAsync(this IContent operations, string contentType, string storeId, string folderUrl = default(string), string keyword = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchContentWithHttpMessagesAsync(contentType, storeId, folderUrl, keyword, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// public static void MoveContent(this IContent operations, string contentType, string storeId, string oldUrl = default(string), string newUrl = default(string)) { operations.MoveContentAsync(contentType, storeId, oldUrl, newUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task MoveContentAsync(this IContent operations, string contentType, string storeId, string oldUrl = default(string), string newUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.MoveContentWithHttpMessagesAsync(contentType, storeId, oldUrl, newUrl, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// public static void CopyContent(this IContent operations, string srcPath = default(string), string destPath = default(string)) { operations.CopyContentAsync(srcPath, destPath).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task CopyContentAsync(this IContent operations, string srcPath = default(string), string destPath = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CopyContentWithHttpMessagesAsync(srcPath, destPath, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// public static void Unpack(this IContent operations, string contentType, string storeId, string archivePath = default(string), string destPath = "default") { operations.UnpackAsync(contentType, storeId, archivePath, destPath).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task UnpackAsync(this IContent operations, string contentType, string storeId, string archivePath = default(string), string destPath = "default", CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UnpackWithHttpMessagesAsync(contentType, storeId, archivePath, destPath, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static void CreateContentFolder(this IContent operations, string contentType, string storeId, ContentFolder body = default(ContentFolder)) { operations.CreateContentFolderAsync(contentType, storeId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task CreateContentFolderAsync(this IContent operations, string contentType, string storeId, ContentFolder body = default(ContentFolder), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CreateContentFolderWithHttpMessagesAsync(contentType, storeId, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Menu operations. /// public partial class Menu : IServiceOperations, IMenu { /// /// Initializes a new instance of the Menu class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Menu(ContentModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the ContentModuleClient /// public ContentModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetListsWithHttpMessagesAsync(string storeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetLists", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/cms/{storeId}/menu").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task UpdateMenuLinkListWithHttpMessagesAsync(string storeId, MenuLinkList body = default(MenuLinkList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateMenuLinkList", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/cms/{storeId}/menu").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task DeleteMenuLinkListsWithHttpMessagesAsync(string storeId, IList listIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("listIds", listIds); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteMenuLinkLists", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/cms/{storeId}/menu").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (listIds != null) { _queryParameters.Add(string.Format("listIds={0}", System.Uri.EscapeDataString(string.Join(",", listIds)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetListWithHttpMessagesAsync(string storeId, string listId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } if (listId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "listId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("listId", listId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetList", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/cms/{storeId}/menu/{listId}").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); _url = _url.Replace("{listId}", System.Uri.EscapeDataString(listId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> CheckNameWithHttpMessagesAsync(string storeId, string name = default(string), string language = "", string id = "", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("name", name); tracingParameters.Add("language", language); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckName", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/cms/{storeId}/menu/checkname").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); List _queryParameters = new List(); if (name != null) { _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); } if (language != null) { _queryParameters.Add(string.Format("language={0}", System.Uri.EscapeDataString(language))); } if (id != null) { _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Menu operations. /// public partial interface IMenu { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetListsWithHttpMessagesAsync(string storeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task UpdateMenuLinkListWithHttpMessagesAsync(string storeId, MenuLinkList body = default(MenuLinkList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task DeleteMenuLinkListsWithHttpMessagesAsync(string storeId, IList listIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetListWithHttpMessagesAsync(string storeId, string listId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> CheckNameWithHttpMessagesAsync(string storeId, string name = default(string), string language = "", string id = "", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Menu. /// public static partial class MenuExtensions { /// /// The operations group for this extension method. /// /// /// public static IList GetLists(this IMenu operations, string storeId) { return operations.GetListsAsync(storeId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> GetListsAsync(this IMenu operations, string storeId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetListsWithHttpMessagesAsync(storeId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// public static void UpdateMenuLinkList(this IMenu operations, string storeId, MenuLinkList body = default(MenuLinkList)) { operations.UpdateMenuLinkListAsync(storeId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task UpdateMenuLinkListAsync(this IMenu operations, string storeId, MenuLinkList body = default(MenuLinkList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateMenuLinkListWithHttpMessagesAsync(storeId, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// public static void DeleteMenuLinkLists(this IMenu operations, string storeId, IList listIds = default(IList)) { operations.DeleteMenuLinkListsAsync(storeId, listIds).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task DeleteMenuLinkListsAsync(this IMenu operations, string storeId, IList listIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteMenuLinkListsWithHttpMessagesAsync(storeId, listIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// public static MenuLinkList GetList(this IMenu operations, string storeId, string listId) { return operations.GetListAsync(storeId, listId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task GetListAsync(this IMenu operations, string storeId, string listId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetListWithHttpMessagesAsync(storeId, listId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// public static bool? CheckName(this IMenu operations, string storeId, string name = default(string), string language = "", string id = "") { return operations.CheckNameAsync(storeId, name, language, id).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task CheckNameAsync(this IMenu operations, string storeId, string name = default(string), string language = "", string id = "", CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CheckNameWithHttpMessagesAsync(storeId, name, language, id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ContentItem { /// /// Initializes a new instance of the ContentItem class. /// public ContentItem() { CustomInit(); } /// /// Initializes a new instance of the ContentItem class. /// public ContentItem(string name = default(string), string type = default(string), string url = default(string), string relativeUrl = default(string), string parentUrl = default(string), System.DateTime? modifiedDate = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?)) { Name = name; Type = type; Url = url; RelativeUrl = relativeUrl; ParentUrl = parentUrl; ModifiedDate = modifiedDate; CreatedDate = createdDate; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "relativeUrl")] public string RelativeUrl { get; set; } /// /// [JsonProperty(PropertyName = "parentUrl")] public string ParentUrl { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class MenuLink { /// /// Initializes a new instance of the MenuLink class. /// public MenuLink() { CustomInit(); } /// /// Initializes a new instance of the MenuLink class. /// public MenuLink(string title = default(string), string url = default(string), int? priority = default(int?), string menuLinkListId = default(string), string associatedObjectId = default(string), string associatedObjectName = default(string), string associatedObjectType = default(string), IList securityScopes = default(IList), string outerId = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Title = title; Url = url; Priority = priority; MenuLinkListId = menuLinkListId; AssociatedObjectId = associatedObjectId; AssociatedObjectName = associatedObjectName; AssociatedObjectType = associatedObjectType; SecurityScopes = securityScopes; OuterId = outerId; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } /// /// [JsonProperty(PropertyName = "menuLinkListId")] public string MenuLinkListId { get; set; } /// /// [JsonProperty(PropertyName = "associatedObjectId")] public string AssociatedObjectId { get; set; } /// /// [JsonProperty(PropertyName = "associatedObjectName")] public string AssociatedObjectName { get; set; } /// /// [JsonProperty(PropertyName = "associatedObjectType")] public string AssociatedObjectType { get; set; } /// /// [JsonProperty(PropertyName = "securityScopes")] public IList SecurityScopes { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class MenuLinkList { /// /// Initializes a new instance of the MenuLinkList class. /// public MenuLinkList() { CustomInit(); } /// /// Initializes a new instance of the MenuLinkList class. /// public MenuLinkList(string name = default(string), string storeId = default(string), string language = default(string), IList menuLinks = default(IList), IList securityScopes = default(IList), string outerId = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; StoreId = storeId; Language = language; MenuLinks = menuLinks; SecurityScopes = securityScopes; OuterId = outerId; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } /// /// [JsonProperty(PropertyName = "menuLinks")] public IList MenuLinks { get; set; } /// /// [JsonProperty(PropertyName = "securityScopes")] public IList SecurityScopes { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ContentStatistic { /// /// Initializes a new instance of the ContentStatistic class. /// public ContentStatistic() { CustomInit(); } /// /// Initializes a new instance of the ContentStatistic class. /// public ContentStatistic(string activeThemeName = default(string), int? themesCount = default(int?), int? pagesCount = default(int?), int? blogsCount = default(int?)) { ActiveThemeName = activeThemeName; ThemesCount = themesCount; PagesCount = pagesCount; BlogsCount = blogsCount; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "activeThemeName")] public string ActiveThemeName { get; set; } /// /// [JsonProperty(PropertyName = "themesCount")] public int? ThemesCount { get; set; } /// /// [JsonProperty(PropertyName = "pagesCount")] public int? PagesCount { get; set; } /// /// [JsonProperty(PropertyName = "blogsCount")] public int? BlogsCount { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ContentFolder { /// /// Initializes a new instance of the ContentFolder class. /// public ContentFolder() { CustomInit(); } /// /// Initializes a new instance of the ContentFolder class. /// public ContentFolder(string name = default(string), string type = default(string), string url = default(string), string relativeUrl = default(string), string parentUrl = default(string), System.DateTime? modifiedDate = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?)) { Name = name; Type = type; Url = url; RelativeUrl = relativeUrl; ParentUrl = parentUrl; ModifiedDate = modifiedDate; CreatedDate = createdDate; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "relativeUrl")] public string RelativeUrl { get; set; } /// /// [JsonProperty(PropertyName = "parentUrl")] public string ParentUrl { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/CoreModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CoreModuleClient : ServiceClient, ICoreModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the ICommerce. /// public virtual ICommerce Commerce { get; private set; } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CoreModuleClient.Dispose(). False: will not dispose provided httpClient protected CoreModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CoreModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CoreModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CoreModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CoreModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CoreModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CoreModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public CoreModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CoreModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CoreModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CoreModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { Commerce = new Commerce(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface ICoreModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the ICommerce. /// ICommerce Commerce { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Commerce operations. /// public partial class Commerce : IServiceOperations, ICommerce { /// /// Initializes a new instance of the Commerce class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Commerce(CoreModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CoreModuleClient /// public CoreModuleClient Client { get; private set; } /// /// Batch create or update seo infos /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BatchUpdateSeoInfosWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BatchUpdateSeoInfos", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/seoinfos/batchupdate").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetSeoDuplicatesWithHttpMessagesAsync(string objectId = default(string), string objectType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("objectId", objectId); tracingParameters.Add("objectType", objectType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSeoDuplicates", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/seoinfos/duplicates").ToString(); List _queryParameters = new List(); if (objectId != null) { _queryParameters.Add(string.Format("objectId={0}", System.Uri.EscapeDataString(objectId))); } if (objectType != null) { _queryParameters.Add(string.Format("objectType={0}", System.Uri.EscapeDataString(objectType))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Find all SEO records for object by slug /// /// /// slug /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetSeoInfoBySlugWithHttpMessagesAsync(string slug, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (slug == null) { throw new ValidationException(ValidationRules.CannotBeNull, "slug"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("slug", slug); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSeoInfoBySlug", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/seoinfos/{slug}").ToString(); _url = _url.Replace("{slug}", System.Uri.EscapeDataString(slug)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Return all currencies registered in the system /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetAllCurrenciesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAllCurrencies", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/currencies").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create a existing currency /// /// /// currency /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task CreateCurrencyWithHttpMessagesAsync(Currency body = default(Currency), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateCurrency", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/currencies").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update a existing currency /// /// /// currency /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateCurrencyWithHttpMessagesAsync(Currency body = default(Currency), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateCurrency", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/currencies").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete currencies /// /// /// currency codes /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteCurrenciesWithHttpMessagesAsync(IList codes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("codes", codes); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteCurrencies", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/currencies").ToString(); List _queryParameters = new List(); if (codes != null) { _queryParameters.Add(string.Format("codes={0}", System.Uri.EscapeDataString(string.Join(",", codes)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Return all package types registered in the system /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetAllPackageTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAllPackageTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/packageTypes").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update a existing package type /// /// /// package type /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdatePackageTypeWithHttpMessagesAsync(PackageType body = default(PackageType), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdatePackageType", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/packageTypes").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create new package type /// /// /// package type /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task CreatePackageTypeWithHttpMessagesAsync(PackageType body = default(PackageType), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreatePackageType", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/packageTypes").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete package types /// /// /// package type ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeletePackageTypesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeletePackageTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/packageTypes").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Validate address (reserved for future) and also required for expose Address /// in OpenAPI swagger docs /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ValidateAddressWithHttpMessagesAsync(Address body = default(Address), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ValidateAddress", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Commerce operations. /// public partial interface ICommerce { /// /// Batch create or update seo infos /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BatchUpdateSeoInfosWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetSeoDuplicatesWithHttpMessagesAsync(string objectId = default(string), string objectType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Find all SEO records for object by slug /// /// /// slug /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetSeoInfoBySlugWithHttpMessagesAsync(string slug, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Return all currencies registered in the system /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetAllCurrenciesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create a existing currency /// /// /// currency /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task CreateCurrencyWithHttpMessagesAsync(Currency body = default(Currency), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update a existing currency /// /// /// currency /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateCurrencyWithHttpMessagesAsync(Currency body = default(Currency), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete currencies /// /// /// currency codes /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteCurrenciesWithHttpMessagesAsync(IList codes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Return all package types registered in the system /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetAllPackageTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update a existing package type /// /// /// package type /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdatePackageTypeWithHttpMessagesAsync(PackageType body = default(PackageType), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create new package type /// /// /// package type /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task CreatePackageTypeWithHttpMessagesAsync(PackageType body = default(PackageType), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete package types /// /// /// package type ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeletePackageTypesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Validate address (reserved for future) and also required for expose /// Address in OpenAPI swagger docs /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ValidateAddressWithHttpMessagesAsync(Address body = default(Address), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Commerce. /// public static partial class CommerceExtensions { /// /// Batch create or update seo infos /// /// /// The operations group for this extension method. /// /// /// public static void BatchUpdateSeoInfos(this ICommerce operations, IList body = default(IList)) { operations.BatchUpdateSeoInfosAsync(body).GetAwaiter().GetResult(); } /// /// Batch create or update seo infos /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task BatchUpdateSeoInfosAsync(this ICommerce operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BatchUpdateSeoInfosWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// public static IList GetSeoDuplicates(this ICommerce operations, string objectId = default(string), string objectType = default(string)) { return operations.GetSeoDuplicatesAsync(objectId, objectType).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task> GetSeoDuplicatesAsync(this ICommerce operations, string objectId = default(string), string objectType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSeoDuplicatesWithHttpMessagesAsync(objectId, objectType, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Find all SEO records for object by slug /// /// /// The operations group for this extension method. /// /// /// slug /// public static IList GetSeoInfoBySlug(this ICommerce operations, string slug) { return operations.GetSeoInfoBySlugAsync(slug).GetAwaiter().GetResult(); } /// /// Find all SEO records for object by slug /// /// /// The operations group for this extension method. /// /// /// slug /// /// /// The cancellation token. /// public static async Task> GetSeoInfoBySlugAsync(this ICommerce operations, string slug, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSeoInfoBySlugWithHttpMessagesAsync(slug, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Return all currencies registered in the system /// /// /// The operations group for this extension method. /// public static IList GetAllCurrencies(this ICommerce operations) { return operations.GetAllCurrenciesAsync().GetAwaiter().GetResult(); } /// /// Return all currencies registered in the system /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetAllCurrenciesAsync(this ICommerce operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllCurrenciesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create a existing currency /// /// /// The operations group for this extension method. /// /// /// currency /// public static void CreateCurrency(this ICommerce operations, Currency body = default(Currency)) { operations.CreateCurrencyAsync(body).GetAwaiter().GetResult(); } /// /// Create a existing currency /// /// /// The operations group for this extension method. /// /// /// currency /// /// /// The cancellation token. /// public static async Task CreateCurrencyAsync(this ICommerce operations, Currency body = default(Currency), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CreateCurrencyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Update a existing currency /// /// /// The operations group for this extension method. /// /// /// currency /// public static void UpdateCurrency(this ICommerce operations, Currency body = default(Currency)) { operations.UpdateCurrencyAsync(body).GetAwaiter().GetResult(); } /// /// Update a existing currency /// /// /// The operations group for this extension method. /// /// /// currency /// /// /// The cancellation token. /// public static async Task UpdateCurrencyAsync(this ICommerce operations, Currency body = default(Currency), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateCurrencyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete currencies /// /// /// The operations group for this extension method. /// /// /// currency codes /// public static void DeleteCurrencies(this ICommerce operations, IList codes = default(IList)) { operations.DeleteCurrenciesAsync(codes).GetAwaiter().GetResult(); } /// /// Delete currencies /// /// /// The operations group for this extension method. /// /// /// currency codes /// /// /// The cancellation token. /// public static async Task DeleteCurrenciesAsync(this ICommerce operations, IList codes = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteCurrenciesWithHttpMessagesAsync(codes, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Return all package types registered in the system /// /// /// The operations group for this extension method. /// public static IList GetAllPackageTypes(this ICommerce operations) { return operations.GetAllPackageTypesAsync().GetAwaiter().GetResult(); } /// /// Return all package types registered in the system /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetAllPackageTypesAsync(this ICommerce operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllPackageTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update a existing package type /// /// /// The operations group for this extension method. /// /// /// package type /// public static void UpdatePackageType(this ICommerce operations, PackageType body = default(PackageType)) { operations.UpdatePackageTypeAsync(body).GetAwaiter().GetResult(); } /// /// Update a existing package type /// /// /// The operations group for this extension method. /// /// /// package type /// /// /// The cancellation token. /// public static async Task UpdatePackageTypeAsync(this ICommerce operations, PackageType body = default(PackageType), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdatePackageTypeWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Create new package type /// /// /// The operations group for this extension method. /// /// /// package type /// public static void CreatePackageType(this ICommerce operations, PackageType body = default(PackageType)) { operations.CreatePackageTypeAsync(body).GetAwaiter().GetResult(); } /// /// Create new package type /// /// /// The operations group for this extension method. /// /// /// package type /// /// /// The cancellation token. /// public static async Task CreatePackageTypeAsync(this ICommerce operations, PackageType body = default(PackageType), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CreatePackageTypeWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete package types /// /// /// The operations group for this extension method. /// /// /// package type ids /// public static void DeletePackageTypes(this ICommerce operations, IList ids = default(IList)) { operations.DeletePackageTypesAsync(ids).GetAwaiter().GetResult(); } /// /// Delete package types /// /// /// The operations group for this extension method. /// /// /// package type ids /// /// /// The cancellation token. /// public static async Task DeletePackageTypesAsync(this ICommerce operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeletePackageTypesWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Validate address (reserved for future) and also required for expose Address /// in OpenAPI swagger docs /// /// /// The operations group for this extension method. /// /// /// public static bool? ValidateAddress(this ICommerce operations, Address body = default(Address)) { return operations.ValidateAddressAsync(body).GetAwaiter().GetResult(); } /// /// Validate address (reserved for future) and also required for expose Address /// in OpenAPI swagger docs /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ValidateAddressAsync(this ICommerce operations, Address body = default(Address), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ValidateAddressWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SeoInfo { /// /// Initializes a new instance of the SeoInfo class. /// public SeoInfo() { CustomInit(); } /// /// Initializes a new instance of the SeoInfo class. /// /// Slug /// head title tag content /// <meta name="description" /// /> /// <meta name="keywords" /> /// Tenant StoreId which SEO defined /// SEO related object id /// SEO related object type name /// Active/Inactive public SeoInfo(string name = default(string), string semanticUrl = default(string), string pageTitle = default(string), string metaDescription = default(string), string imageAltDescription = default(string), string metaKeywords = default(string), string storeId = default(string), string objectId = default(string), string objectType = default(string), bool? isActive = default(bool?), string languageCode = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; SemanticUrl = semanticUrl; PageTitle = pageTitle; MetaDescription = metaDescription; ImageAltDescription = imageAltDescription; MetaKeywords = metaKeywords; StoreId = storeId; ObjectId = objectId; ObjectType = objectType; IsActive = isActive; LanguageCode = languageCode; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets slug /// [JsonProperty(PropertyName = "semanticUrl")] public string SemanticUrl { get; set; } /// /// Gets or sets head title tag content /// [JsonProperty(PropertyName = "pageTitle")] public string PageTitle { get; set; } /// /// Gets or sets &lt;meta name="description" /&gt; /// [JsonProperty(PropertyName = "metaDescription")] public string MetaDescription { get; set; } /// /// [JsonProperty(PropertyName = "imageAltDescription")] public string ImageAltDescription { get; set; } /// /// Gets or sets &lt;meta name="keywords" /&gt; /// [JsonProperty(PropertyName = "metaKeywords")] public string MetaKeywords { get; set; } /// /// Gets or sets tenant StoreId which SEO defined /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// Gets or sets SEO related object id /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// Gets or sets SEO related object type name /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets active/Inactive /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NumberFormatInfo { /// /// Initializes a new instance of the NumberFormatInfo class. /// public NumberFormatInfo() { CustomInit(); } /// /// Initializes a new instance of the NumberFormatInfo class. /// /// Possible values include: 'Context', /// 'None', 'NativeNational' public NumberFormatInfo(int? currencyDecimalDigits = default(int?), string currencyDecimalSeparator = default(string), bool? isReadOnly = default(bool?), IList currencyGroupSizes = default(IList), IList numberGroupSizes = default(IList), IList percentGroupSizes = default(IList), string currencyGroupSeparator = default(string), string currencySymbol = default(string), string naNSymbol = default(string), int? currencyNegativePattern = default(int?), int? numberNegativePattern = default(int?), int? percentPositivePattern = default(int?), int? percentNegativePattern = default(int?), string negativeInfinitySymbol = default(string), string negativeSign = default(string), int? numberDecimalDigits = default(int?), string numberDecimalSeparator = default(string), string numberGroupSeparator = default(string), int? currencyPositivePattern = default(int?), string positiveInfinitySymbol = default(string), string positiveSign = default(string), int? percentDecimalDigits = default(int?), string percentDecimalSeparator = default(string), string percentGroupSeparator = default(string), string percentSymbol = default(string), string perMilleSymbol = default(string), IList nativeDigits = default(IList), string digitSubstitution = default(string)) { CurrencyDecimalDigits = currencyDecimalDigits; CurrencyDecimalSeparator = currencyDecimalSeparator; IsReadOnly = isReadOnly; CurrencyGroupSizes = currencyGroupSizes; NumberGroupSizes = numberGroupSizes; PercentGroupSizes = percentGroupSizes; CurrencyGroupSeparator = currencyGroupSeparator; CurrencySymbol = currencySymbol; NaNSymbol = naNSymbol; CurrencyNegativePattern = currencyNegativePattern; NumberNegativePattern = numberNegativePattern; PercentPositivePattern = percentPositivePattern; PercentNegativePattern = percentNegativePattern; NegativeInfinitySymbol = negativeInfinitySymbol; NegativeSign = negativeSign; NumberDecimalDigits = numberDecimalDigits; NumberDecimalSeparator = numberDecimalSeparator; NumberGroupSeparator = numberGroupSeparator; CurrencyPositivePattern = currencyPositivePattern; PositiveInfinitySymbol = positiveInfinitySymbol; PositiveSign = positiveSign; PercentDecimalDigits = percentDecimalDigits; PercentDecimalSeparator = percentDecimalSeparator; PercentGroupSeparator = percentGroupSeparator; PercentSymbol = percentSymbol; PerMilleSymbol = perMilleSymbol; NativeDigits = nativeDigits; DigitSubstitution = digitSubstitution; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "currencyDecimalDigits")] public int? CurrencyDecimalDigits { get; set; } /// /// [JsonProperty(PropertyName = "currencyDecimalSeparator")] public string CurrencyDecimalSeparator { get; set; } /// /// [JsonProperty(PropertyName = "isReadOnly")] public bool? IsReadOnly { get; private set; } /// /// [JsonProperty(PropertyName = "currencyGroupSizes")] public IList CurrencyGroupSizes { get; set; } /// /// [JsonProperty(PropertyName = "numberGroupSizes")] public IList NumberGroupSizes { get; set; } /// /// [JsonProperty(PropertyName = "percentGroupSizes")] public IList PercentGroupSizes { get; set; } /// /// [JsonProperty(PropertyName = "currencyGroupSeparator")] public string CurrencyGroupSeparator { get; set; } /// /// [JsonProperty(PropertyName = "currencySymbol")] public string CurrencySymbol { get; set; } /// /// [JsonProperty(PropertyName = "naNSymbol")] public string NaNSymbol { get; set; } /// /// [JsonProperty(PropertyName = "currencyNegativePattern")] public int? CurrencyNegativePattern { get; set; } /// /// [JsonProperty(PropertyName = "numberNegativePattern")] public int? NumberNegativePattern { get; set; } /// /// [JsonProperty(PropertyName = "percentPositivePattern")] public int? PercentPositivePattern { get; set; } /// /// [JsonProperty(PropertyName = "percentNegativePattern")] public int? PercentNegativePattern { get; set; } /// /// [JsonProperty(PropertyName = "negativeInfinitySymbol")] public string NegativeInfinitySymbol { get; set; } /// /// [JsonProperty(PropertyName = "negativeSign")] public string NegativeSign { get; set; } /// /// [JsonProperty(PropertyName = "numberDecimalDigits")] public int? NumberDecimalDigits { get; set; } /// /// [JsonProperty(PropertyName = "numberDecimalSeparator")] public string NumberDecimalSeparator { get; set; } /// /// [JsonProperty(PropertyName = "numberGroupSeparator")] public string NumberGroupSeparator { get; set; } /// /// [JsonProperty(PropertyName = "currencyPositivePattern")] public int? CurrencyPositivePattern { get; set; } /// /// [JsonProperty(PropertyName = "positiveInfinitySymbol")] public string PositiveInfinitySymbol { get; set; } /// /// [JsonProperty(PropertyName = "positiveSign")] public string PositiveSign { get; set; } /// /// [JsonProperty(PropertyName = "percentDecimalDigits")] public int? PercentDecimalDigits { get; set; } /// /// [JsonProperty(PropertyName = "percentDecimalSeparator")] public string PercentDecimalSeparator { get; set; } /// /// [JsonProperty(PropertyName = "percentGroupSeparator")] public string PercentGroupSeparator { get; set; } /// /// [JsonProperty(PropertyName = "percentSymbol")] public string PercentSymbol { get; set; } /// /// [JsonProperty(PropertyName = "perMilleSymbol")] public string PerMilleSymbol { get; set; } /// /// [JsonProperty(PropertyName = "nativeDigits")] public IList NativeDigits { get; set; } /// /// Gets or sets possible values include: 'Context', 'None', /// 'NativeNational' /// [JsonProperty(PropertyName = "digitSubstitution")] public string DigitSubstitution { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Currency /// public partial class Currency { /// /// Initializes a new instance of the Currency class. /// public Currency() { CustomInit(); } /// /// Initializes a new instance of the Currency class. /// /// Currency code may be used ISO 4217. /// name of the currency /// Flag specifies that this is the primary /// currency /// The exchange rate against the primary /// exchange rate of the currency. /// Currency symbol /// Custom formatting pattern public Currency(string code = default(string), string cultureName = default(string), string englishName = default(string), NumberFormatInfo numberFormat = default(NumberFormatInfo), string name = default(string), bool? isPrimary = default(bool?), double? exchangeRate = default(double?), string symbol = default(string), string customFormatting = default(string)) { Code = code; CultureName = cultureName; EnglishName = englishName; NumberFormat = numberFormat; Name = name; IsPrimary = isPrimary; ExchangeRate = exchangeRate; Symbol = symbol; CustomFormatting = customFormatting; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets currency code may be used ISO 4217. /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "cultureName")] public string CultureName { get; set; } /// /// [JsonProperty(PropertyName = "englishName")] public string EnglishName { get; set; } /// /// [JsonProperty(PropertyName = "numberFormat")] public NumberFormatInfo NumberFormat { get; set; } /// /// Gets or sets name of the currency /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets flag specifies that this is the primary currency /// [JsonProperty(PropertyName = "isPrimary")] public bool? IsPrimary { get; set; } /// /// Gets or sets the exchange rate against the primary exchange rate of /// the currency. /// [JsonProperty(PropertyName = "exchangeRate")] public double? ExchangeRate { get; set; } /// /// Gets or sets currency symbol /// [JsonProperty(PropertyName = "symbol")] public string Symbol { get; set; } /// /// Gets or sets custom formatting pattern /// [JsonProperty(PropertyName = "customFormatting")] public string CustomFormatting { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represent predefined dimensions package type /// public partial class PackageType { /// /// Initializes a new instance of the PackageType class. /// public PackageType() { CustomInit(); } /// /// Initializes a new instance of the PackageType class. /// /// Package type name public PackageType(string name = default(string), double? length = default(double?), double? width = default(double?), double? height = default(double?), string measureUnit = default(string), string id = default(string)) { Name = name; Length = length; Width = width; Height = height; MeasureUnit = measureUnit; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets package type name /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "length")] public double? Length { get; set; } /// /// [JsonProperty(PropertyName = "width")] public double? Width { get; set; } /// /// [JsonProperty(PropertyName = "height")] public double? Height { get; set; } /// /// [JsonProperty(PropertyName = "measureUnit")] public string MeasureUnit { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Address { /// /// Initializes a new instance of the Address class. /// public Address() { CustomInit(); } /// /// Initializes a new instance of the Address class. /// /// Possible values include: 'Billing', /// 'Shipping', 'BillingAndShipping', 'Pickup' public Address(string addressType = default(string), string key = default(string), string name = default(string), string organization = default(string), string countryCode = default(string), string countryName = default(string), string city = default(string), string postalCode = default(string), string zip = default(string), string line1 = default(string), string line2 = default(string), string regionId = default(string), string regionName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), string phone = default(string), string email = default(string)) { AddressType = addressType; Key = key; Name = name; Organization = organization; CountryCode = countryCode; CountryName = countryName; City = city; PostalCode = postalCode; Zip = zip; Line1 = line1; Line2 = line2; RegionId = regionId; RegionName = regionName; FirstName = firstName; MiddleName = middleName; LastName = lastName; Phone = phone; Email = email; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets possible values include: 'Billing', 'Shipping', /// 'BillingAndShipping', 'Pickup' /// [JsonProperty(PropertyName = "addressType")] public string AddressType { get; set; } /// /// [JsonProperty(PropertyName = "key")] public string Key { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "organization")] public string Organization { get; set; } /// /// [JsonProperty(PropertyName = "countryCode")] public string CountryCode { get; set; } /// /// [JsonProperty(PropertyName = "countryName")] public string CountryName { get; set; } /// /// [JsonProperty(PropertyName = "city")] public string City { get; set; } /// /// [JsonProperty(PropertyName = "postalCode")] public string PostalCode { get; set; } /// /// [JsonProperty(PropertyName = "zip")] public string Zip { get; set; } /// /// [JsonProperty(PropertyName = "line1")] public string Line1 { get; set; } /// /// [JsonProperty(PropertyName = "line2")] public string Line2 { get; set; } /// /// [JsonProperty(PropertyName = "regionId")] public string RegionId { get; set; } /// /// [JsonProperty(PropertyName = "regionName")] public string RegionName { get; set; } /// /// [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } /// /// [JsonProperty(PropertyName = "middleName")] public string MiddleName { get; set; } /// /// [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } /// /// [JsonProperty(PropertyName = "phone")] public string Phone { get; set; } /// /// [JsonProperty(PropertyName = "email")] public string Email { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/CustomerModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CustomerModuleClient : ServiceClient, ICustomerModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the ICustomerModule. /// public virtual ICustomerModule CustomerModule { get; private set; } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CustomerModuleClient.Dispose(). False: will not dispose provided httpClient protected CustomerModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CustomerModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected CustomerModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CustomerModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected CustomerModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CustomerModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling CustomerModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public CustomerModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CustomerModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CustomerModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the CustomerModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public CustomerModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { CustomerModule = new CustomerModule(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface ICustomerModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the ICustomerModule. /// ICustomerModule CustomerModule { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CustomerModule operations. /// public partial class CustomerModule : IServiceOperations, ICustomerModule { /// /// Initializes a new instance of the CustomerModule class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public CustomerModule(CustomerModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the CustomerModuleClient /// public CustomerModuleClient Client { get; private set; } /// /// Get organizations /// /// /// Get array of all organizations. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> ListOrganizationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/organizations").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get members /// /// /// Get array of members satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchMemberWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchMember", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get member /// /// /// member id /// /// /// response group /// /// /// member type /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetMemberByIdWithHttpMessagesAsync(string id, string responseGroup = default(string), string memberType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("responseGroup", responseGroup); tracingParameters.Add("memberType", memberType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetMemberById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); List _queryParameters = new List(); if (responseGroup != null) { _queryParameters.Add(string.Format("responseGroup={0}", System.Uri.EscapeDataString(responseGroup))); } if (memberType != null) { _queryParameters.Add(string.Format("memberType={0}", System.Uri.EscapeDataString(memberType))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetMembersByIdsWithHttpMessagesAsync(IList ids = default(IList), string responseGroup = default(string), IList memberTypes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("responseGroup", responseGroup); tracingParameters.Add("memberTypes", memberTypes); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetMembersByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (responseGroup != null) { _queryParameters.Add(string.Format("responseGroup={0}", System.Uri.EscapeDataString(responseGroup))); } if (memberTypes != null) { if (memberTypes.Count == 0) { _queryParameters.Add(string.Format("memberTypes={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in memberTypes) { _queryParameters.Add(string.Format("memberTypes={0}", System.Uri.EscapeDataString("" + _item))); } } } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create new member (can be any object inherited from Member type) /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateMemberWithHttpMessagesAsync(Member body = default(Member), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateMember", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update member /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateMemberWithHttpMessagesAsync(Member body = default(Member), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateMember", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete members /// /// /// Delete members by given array of ids. /// /// /// An array of members ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteMembersWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteMembers", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk create new members (can be any objects inherited from Member type) /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> BulkCreateMembersWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCreateMembers", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk update members /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkUpdateMembersWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkUpdateMembers", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk delete members /// /// /// Bulk delete members by search criteria of members. /// /// /// concrete instance of SearchCriteria type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkDeleteMembersBySearchCriteriaWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkDeleteMembersBySearchCriteria", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/delete").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ResizeIconWithHttpMessagesAsync(IconResizeRequest body = default(IconResizeRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ResizeIcon", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/member/icon/resize").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create contact /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateContactWithHttpMessagesAsync(Contact body = default(Contact), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateContact", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update contact /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateContactWithHttpMessagesAsync(Contact body = default(Contact), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateContact", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete contacts /// /// /// Delete contacts by given array of ids. /// /// /// An array of contacts ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteContactsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteContacts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get plenty contacts /// /// /// contact IDs /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetContactsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetContactsByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk create contacts /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> BulkCreateContactsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCreateContacts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk update contact /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkUpdateContactsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkUpdateContacts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create organization /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateOrganizationWithHttpMessagesAsync(Organization body = default(Organization), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrganization", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update organization /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateOrganizationWithHttpMessagesAsync(Organization body = default(Organization), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateOrganization", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete organizations /// /// /// Delete organizations by given array of ids. /// /// /// An array of organizations ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteOrganizationsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get plenty organizations /// /// /// Organization ids /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetOrganizationsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetOrganizationsByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk create organizations /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkCreateOrganizationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCreateOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Bulk update organization /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task BulkUpdateOrganizationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkUpdateOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get organization /// /// /// Organization id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetOrganizationByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetOrganizationById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Search organizations /// /// /// Get array of organizations satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchOrganizationsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/organizations/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get contact /// /// /// Contact ID /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetContactByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetContactById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Search contacts /// /// /// Get array of contacts satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchContactsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchContacts", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/contacts/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get vendor /// /// /// Vendor ID /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetVendorByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetVendorById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/vendors/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get plenty vendors /// /// /// Vendors IDs /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetVendorsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetVendorsByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/vendors").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Search vendors /// /// /// Get array of vendors satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchVendorsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchVendors", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/vendors/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateAddessesWithHttpMessagesAsync(IList body = default(IList), string memberId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("memberId", memberId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateAddesses", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/addresses").ToString(); List _queryParameters = new List(); if (memberId != null) { _queryParameters.Add(string.Format("memberId={0}", System.Uri.EscapeDataString(memberId))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create employee /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateEmployeeWithHttpMessagesAsync(Employee body = default(Employee), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateEmployee", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/employees").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get plenty employees /// /// /// contact IDs /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetEmployeesByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEmployeesByIds", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/employees").ToString(); List _queryParameters = new List(); if (ids != null) { if (ids.Count == 0) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Empty))); } else { foreach (var _item in ids) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString("" + _item))); } } } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create employee /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> BulkCreateEmployeesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCreateEmployees", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/employees/bulk").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get all member organizations /// /// /// member Id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetMemberOrganizationsWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetMemberOrganizations", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/members/{id}/organizations").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// CustomerModule operations. /// public partial interface ICustomerModule { /// /// Get organizations /// /// /// Get array of all organizations. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> ListOrganizationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get members /// /// /// Get array of members satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by /// using PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchMemberWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get member /// /// /// member id /// /// /// response group /// /// /// member type /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetMemberByIdWithHttpMessagesAsync(string id, string responseGroup = default(string), string memberType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetMembersByIdsWithHttpMessagesAsync(IList ids = default(IList), string responseGroup = default(string), IList memberTypes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create new member (can be any object inherited from Member type) /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateMemberWithHttpMessagesAsync(Member body = default(Member), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update member /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateMemberWithHttpMessagesAsync(Member body = default(Member), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete members /// /// /// Delete members by given array of ids. /// /// /// An array of members ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteMembersWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk create new members (can be any objects inherited from Member /// type) /// /// /// Array of concrete instances of abstract member type will be created /// by using PolymorphicMemberJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> BulkCreateMembersWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk update members /// /// /// Array of concrete instances of abstract member type will be created /// by using PolymorphicMemberJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkUpdateMembersWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk delete members /// /// /// Bulk delete members by search criteria of members. /// /// /// concrete instance of SearchCriteria type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkDeleteMembersBySearchCriteriaWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ResizeIconWithHttpMessagesAsync(IconResizeRequest body = default(IconResizeRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create contact /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateContactWithHttpMessagesAsync(Contact body = default(Contact), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update contact /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateContactWithHttpMessagesAsync(Contact body = default(Contact), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete contacts /// /// /// Delete contacts by given array of ids. /// /// /// An array of contacts ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteContactsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get plenty contacts /// /// /// contact IDs /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetContactsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk create contacts /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> BulkCreateContactsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk update contact /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkUpdateContactsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create organization /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateOrganizationWithHttpMessagesAsync(Organization body = default(Organization), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update organization /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateOrganizationWithHttpMessagesAsync(Organization body = default(Organization), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete organizations /// /// /// Delete organizations by given array of ids. /// /// /// An array of organizations ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteOrganizationsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get plenty organizations /// /// /// Organization ids /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetOrganizationsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk create organizations /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkCreateOrganizationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Bulk update organization /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task BulkUpdateOrganizationsWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get organization /// /// /// Organization id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetOrganizationByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Search organizations /// /// /// Get array of organizations satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by /// using PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchOrganizationsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get contact /// /// /// Contact ID /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetContactByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Search contacts /// /// /// Get array of contacts satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by /// using PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchContactsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get vendor /// /// /// Vendor ID /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetVendorByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get plenty vendors /// /// /// Vendors IDs /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetVendorsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Search vendors /// /// /// Get array of vendors satisfied search criteria. /// /// /// concrete instance of SearchCriteria type type will be created by /// using PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchVendorsWithHttpMessagesAsync(MembersSearchCriteria body = default(MembersSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateAddessesWithHttpMessagesAsync(IList body = default(IList), string memberId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create employee /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateEmployeeWithHttpMessagesAsync(Employee body = default(Employee), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get plenty employees /// /// /// contact IDs /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetEmployeesByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create employee /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> BulkCreateEmployeesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all member organizations /// /// /// member Id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetMemberOrganizationsWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for CustomerModule. /// public static partial class CustomerModuleExtensions { /// /// Get organizations /// /// /// Get array of all organizations. /// /// /// The operations group for this extension method. /// public static IList ListOrganizations(this ICustomerModule operations) { return operations.ListOrganizationsAsync().GetAwaiter().GetResult(); } /// /// Get organizations /// /// /// Get array of all organizations. /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> ListOrganizationsAsync(this ICustomerModule operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListOrganizationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get members /// /// /// Get array of members satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// public static MemberSearchResult SearchMember(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria)) { return operations.SearchMemberAsync(body).GetAwaiter().GetResult(); } /// /// Get members /// /// /// Get array of members satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The cancellation token. /// public static async Task SearchMemberAsync(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchMemberWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get member /// /// /// The operations group for this extension method. /// /// /// member id /// /// /// response group /// /// /// member type /// public static Member GetMemberById(this ICustomerModule operations, string id, string responseGroup = default(string), string memberType = default(string)) { return operations.GetMemberByIdAsync(id, responseGroup, memberType).GetAwaiter().GetResult(); } /// /// Get member /// /// /// The operations group for this extension method. /// /// /// member id /// /// /// response group /// /// /// member type /// /// /// The cancellation token. /// public static async Task GetMemberByIdAsync(this ICustomerModule operations, string id, string responseGroup = default(string), string memberType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMemberByIdWithHttpMessagesAsync(id, responseGroup, memberType, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static IList GetMembersByIds(this ICustomerModule operations, IList ids = default(IList), string responseGroup = default(string), IList memberTypes = default(IList)) { return operations.GetMembersByIdsAsync(ids, responseGroup, memberTypes).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task> GetMembersByIdsAsync(this ICustomerModule operations, IList ids = default(IList), string responseGroup = default(string), IList memberTypes = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMembersByIdsWithHttpMessagesAsync(ids, responseGroup, memberTypes, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create new member (can be any object inherited from Member type) /// /// /// The operations group for this extension method. /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// public static Member CreateMember(this ICustomerModule operations, Member body = default(Member)) { return operations.CreateMemberAsync(body).GetAwaiter().GetResult(); } /// /// Create new member (can be any object inherited from Member type) /// /// /// The operations group for this extension method. /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// The cancellation token. /// public static async Task CreateMemberAsync(this ICustomerModule operations, Member body = default(Member), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateMemberWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update member /// /// /// The operations group for this extension method. /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// public static void UpdateMember(this ICustomerModule operations, Member body = default(Member)) { operations.UpdateMemberAsync(body).GetAwaiter().GetResult(); } /// /// Update member /// /// /// The operations group for this extension method. /// /// /// concrete instance of abstract member type will be created by using /// PolymorphicMemberJsonConverter /// /// /// The cancellation token. /// public static async Task UpdateMemberAsync(this ICustomerModule operations, Member body = default(Member), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateMemberWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete members /// /// /// Delete members by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of members ids /// public static void DeleteMembers(this ICustomerModule operations, IList ids = default(IList)) { operations.DeleteMembersAsync(ids).GetAwaiter().GetResult(); } /// /// Delete members /// /// /// Delete members by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of members ids /// /// /// The cancellation token. /// public static async Task DeleteMembersAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteMembersWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Bulk create new members (can be any objects inherited from Member type) /// /// /// The operations group for this extension method. /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// public static IList BulkCreateMembers(this ICustomerModule operations, IList body = default(IList)) { return operations.BulkCreateMembersAsync(body).GetAwaiter().GetResult(); } /// /// Bulk create new members (can be any objects inherited from Member type) /// /// /// The operations group for this extension method. /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// /// /// The cancellation token. /// public static async Task> BulkCreateMembersAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BulkCreateMembersWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Bulk update members /// /// /// The operations group for this extension method. /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// public static void BulkUpdateMembers(this ICustomerModule operations, IList body = default(IList)) { operations.BulkUpdateMembersAsync(body).GetAwaiter().GetResult(); } /// /// Bulk update members /// /// /// The operations group for this extension method. /// /// /// Array of concrete instances of abstract member type will be created by /// using PolymorphicMemberJsonConverter /// /// /// The cancellation token. /// public static async Task BulkUpdateMembersAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkUpdateMembersWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Bulk delete members /// /// /// Bulk delete members by search criteria of members. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// public static void BulkDeleteMembersBySearchCriteria(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria)) { operations.BulkDeleteMembersBySearchCriteriaAsync(body).GetAwaiter().GetResult(); } /// /// Bulk delete members /// /// /// Bulk delete members by search criteria of members. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The cancellation token. /// public static async Task BulkDeleteMembersBySearchCriteriaAsync(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkDeleteMembersBySearchCriteriaWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void ResizeIcon(this ICustomerModule operations, IconResizeRequest body = default(IconResizeRequest)) { operations.ResizeIconAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ResizeIconAsync(this ICustomerModule operations, IconResizeRequest body = default(IconResizeRequest), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ResizeIconWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Create contact /// /// /// The operations group for this extension method. /// /// /// public static Contact CreateContact(this ICustomerModule operations, Contact body = default(Contact)) { return operations.CreateContactAsync(body).GetAwaiter().GetResult(); } /// /// Create contact /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CreateContactAsync(this ICustomerModule operations, Contact body = default(Contact), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateContactWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update contact /// /// /// The operations group for this extension method. /// /// /// public static void UpdateContact(this ICustomerModule operations, Contact body = default(Contact)) { operations.UpdateContactAsync(body).GetAwaiter().GetResult(); } /// /// Update contact /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdateContactAsync(this ICustomerModule operations, Contact body = default(Contact), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateContactWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete contacts /// /// /// Delete contacts by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of contacts ids /// public static void DeleteContacts(this ICustomerModule operations, IList ids = default(IList)) { operations.DeleteContactsAsync(ids).GetAwaiter().GetResult(); } /// /// Delete contacts /// /// /// Delete contacts by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of contacts ids /// /// /// The cancellation token. /// public static async Task DeleteContactsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteContactsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get plenty contacts /// /// /// The operations group for this extension method. /// /// /// contact IDs /// public static IList GetContactsByIds(this ICustomerModule operations, IList ids = default(IList)) { return operations.GetContactsByIdsAsync(ids).GetAwaiter().GetResult(); } /// /// Get plenty contacts /// /// /// The operations group for this extension method. /// /// /// contact IDs /// /// /// The cancellation token. /// public static async Task> GetContactsByIdsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetContactsByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Bulk create contacts /// /// /// The operations group for this extension method. /// /// /// public static IList BulkCreateContacts(this ICustomerModule operations, IList body = default(IList)) { return operations.BulkCreateContactsAsync(body).GetAwaiter().GetResult(); } /// /// Bulk create contacts /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> BulkCreateContactsAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BulkCreateContactsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Bulk update contact /// /// /// The operations group for this extension method. /// /// /// public static void BulkUpdateContacts(this ICustomerModule operations, IList body = default(IList)) { operations.BulkUpdateContactsAsync(body).GetAwaiter().GetResult(); } /// /// Bulk update contact /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task BulkUpdateContactsAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkUpdateContactsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Create organization /// /// /// The operations group for this extension method. /// /// /// public static Organization CreateOrganization(this ICustomerModule operations, Organization body = default(Organization)) { return operations.CreateOrganizationAsync(body).GetAwaiter().GetResult(); } /// /// Create organization /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CreateOrganizationAsync(this ICustomerModule operations, Organization body = default(Organization), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrganizationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update organization /// /// /// The operations group for this extension method. /// /// /// public static void UpdateOrganization(this ICustomerModule operations, Organization body = default(Organization)) { operations.UpdateOrganizationAsync(body).GetAwaiter().GetResult(); } /// /// Update organization /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdateOrganizationAsync(this ICustomerModule operations, Organization body = default(Organization), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateOrganizationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete organizations /// /// /// Delete organizations by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of organizations ids /// public static void DeleteOrganizations(this ICustomerModule operations, IList ids = default(IList)) { operations.DeleteOrganizationsAsync(ids).GetAwaiter().GetResult(); } /// /// Delete organizations /// /// /// Delete organizations by given array of ids. /// /// /// The operations group for this extension method. /// /// /// An array of organizations ids /// /// /// The cancellation token. /// public static async Task DeleteOrganizationsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteOrganizationsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get plenty organizations /// /// /// The operations group for this extension method. /// /// /// Organization ids /// public static IList GetOrganizationsByIds(this ICustomerModule operations, IList ids = default(IList)) { return operations.GetOrganizationsByIdsAsync(ids).GetAwaiter().GetResult(); } /// /// Get plenty organizations /// /// /// The operations group for this extension method. /// /// /// Organization ids /// /// /// The cancellation token. /// public static async Task> GetOrganizationsByIdsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetOrganizationsByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Bulk create organizations /// /// /// The operations group for this extension method. /// /// /// public static void BulkCreateOrganizations(this ICustomerModule operations, IList body = default(IList)) { operations.BulkCreateOrganizationsAsync(body).GetAwaiter().GetResult(); } /// /// Bulk create organizations /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task BulkCreateOrganizationsAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkCreateOrganizationsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Bulk update organization /// /// /// The operations group for this extension method. /// /// /// public static void BulkUpdateOrganizations(this ICustomerModule operations, IList body = default(IList)) { operations.BulkUpdateOrganizationsAsync(body).GetAwaiter().GetResult(); } /// /// Bulk update organization /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task BulkUpdateOrganizationsAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BulkUpdateOrganizationsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get organization /// /// /// The operations group for this extension method. /// /// /// Organization id /// public static Organization GetOrganizationById(this ICustomerModule operations, string id) { return operations.GetOrganizationByIdAsync(id).GetAwaiter().GetResult(); } /// /// Get organization /// /// /// The operations group for this extension method. /// /// /// Organization id /// /// /// The cancellation token. /// public static async Task GetOrganizationByIdAsync(this ICustomerModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetOrganizationByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Search organizations /// /// /// Get array of organizations satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// public static OrganizationSearchResult SearchOrganizations(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria)) { return operations.SearchOrganizationsAsync(body).GetAwaiter().GetResult(); } /// /// Search organizations /// /// /// Get array of organizations satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The cancellation token. /// public static async Task SearchOrganizationsAsync(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchOrganizationsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get contact /// /// /// The operations group for this extension method. /// /// /// Contact ID /// public static Contact GetContactById(this ICustomerModule operations, string id) { return operations.GetContactByIdAsync(id).GetAwaiter().GetResult(); } /// /// Get contact /// /// /// The operations group for this extension method. /// /// /// Contact ID /// /// /// The cancellation token. /// public static async Task GetContactByIdAsync(this ICustomerModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetContactByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Search contacts /// /// /// Get array of contacts satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// public static ContactSearchResult SearchContacts(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria)) { return operations.SearchContactsAsync(body).GetAwaiter().GetResult(); } /// /// Search contacts /// /// /// Get array of contacts satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The cancellation token. /// public static async Task SearchContactsAsync(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchContactsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get vendor /// /// /// The operations group for this extension method. /// /// /// Vendor ID /// public static Vendor GetVendorById(this ICustomerModule operations, string id) { return operations.GetVendorByIdAsync(id).GetAwaiter().GetResult(); } /// /// Get vendor /// /// /// The operations group for this extension method. /// /// /// Vendor ID /// /// /// The cancellation token. /// public static async Task GetVendorByIdAsync(this ICustomerModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetVendorByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get plenty vendors /// /// /// The operations group for this extension method. /// /// /// Vendors IDs /// public static IList GetVendorsByIds(this ICustomerModule operations, IList ids = default(IList)) { return operations.GetVendorsByIdsAsync(ids).GetAwaiter().GetResult(); } /// /// Get plenty vendors /// /// /// The operations group for this extension method. /// /// /// Vendors IDs /// /// /// The cancellation token. /// public static async Task> GetVendorsByIdsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetVendorsByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Search vendors /// /// /// Get array of vendors satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// public static VendorSearchResult SearchVendors(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria)) { return operations.SearchVendorsAsync(body).GetAwaiter().GetResult(); } /// /// Search vendors /// /// /// Get array of vendors satisfied search criteria. /// /// /// The operations group for this extension method. /// /// /// concrete instance of SearchCriteria type type will be created by using /// PolymorphicMemberSearchCriteriaJsonConverter /// /// /// The cancellation token. /// public static async Task SearchVendorsAsync(this ICustomerModule operations, MembersSearchCriteria body = default(MembersSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchVendorsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// public static void UpdateAddesses(this ICustomerModule operations, IList body = default(IList), string memberId = default(string)) { operations.UpdateAddessesAsync(body, memberId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task UpdateAddessesAsync(this ICustomerModule operations, IList body = default(IList), string memberId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateAddessesWithHttpMessagesAsync(body, memberId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Create employee /// /// /// The operations group for this extension method. /// /// /// public static Employee CreateEmployee(this ICustomerModule operations, Employee body = default(Employee)) { return operations.CreateEmployeeAsync(body).GetAwaiter().GetResult(); } /// /// Create employee /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CreateEmployeeAsync(this ICustomerModule operations, Employee body = default(Employee), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateEmployeeWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get plenty employees /// /// /// The operations group for this extension method. /// /// /// contact IDs /// public static IList GetEmployeesByIds(this ICustomerModule operations, IList ids = default(IList)) { return operations.GetEmployeesByIdsAsync(ids).GetAwaiter().GetResult(); } /// /// Get plenty employees /// /// /// The operations group for this extension method. /// /// /// contact IDs /// /// /// The cancellation token. /// public static async Task> GetEmployeesByIdsAsync(this ICustomerModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetEmployeesByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create employee /// /// /// The operations group for this extension method. /// /// /// public static IList BulkCreateEmployees(this ICustomerModule operations, IList body = default(IList)) { return operations.BulkCreateEmployeesAsync(body).GetAwaiter().GetResult(); } /// /// Create employee /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> BulkCreateEmployeesAsync(this ICustomerModule operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BulkCreateEmployeesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get all member organizations /// /// /// The operations group for this extension method. /// /// /// member Id /// public static IList GetMemberOrganizations(this ICustomerModule operations, string id) { return operations.GetMemberOrganizationsAsync(id).GetAwaiter().GetResult(); } /// /// Get all member organizations /// /// /// The operations group for this extension method. /// /// /// member Id /// /// /// The cancellation token. /// public static async Task> GetMemberOrganizationsAsync(this ICustomerModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMemberOrganizationsWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class CustomerAddress { /// /// Initializes a new instance of the CustomerAddress class. /// public CustomerAddress() { CustomInit(); } /// /// Initializes a new instance of the CustomerAddress class. /// /// Possible values include: 'Undefined', /// 'Billing', 'Shipping', 'BillingAndShipping', 'Pickup' public CustomerAddress(string addressType = default(string), string key = default(string), string name = default(string), string organization = default(string), string countryCode = default(string), string countryName = default(string), string city = default(string), string postalCode = default(string), string zip = default(string), string line1 = default(string), string line2 = default(string), string regionId = default(string), string regionName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), string phone = default(string), string email = default(string), string outerId = default(string), bool? isDefault = default(bool?), string description = default(string)) { AddressType = addressType; Key = key; Name = name; Organization = organization; CountryCode = countryCode; CountryName = countryName; City = city; PostalCode = postalCode; Zip = zip; Line1 = line1; Line2 = line2; RegionId = regionId; RegionName = regionName; FirstName = firstName; MiddleName = middleName; LastName = lastName; Phone = phone; Email = email; OuterId = outerId; IsDefault = isDefault; Description = description; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets possible values include: 'Undefined', 'Billing', /// 'Shipping', 'BillingAndShipping', 'Pickup' /// [JsonProperty(PropertyName = "addressType")] public string AddressType { get; set; } /// /// [JsonProperty(PropertyName = "key")] public string Key { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "organization")] public string Organization { get; set; } /// /// [JsonProperty(PropertyName = "countryCode")] public string CountryCode { get; set; } /// /// [JsonProperty(PropertyName = "countryName")] public string CountryName { get; set; } /// /// [JsonProperty(PropertyName = "city")] public string City { get; set; } /// /// [JsonProperty(PropertyName = "postalCode")] public string PostalCode { get; set; } /// /// [JsonProperty(PropertyName = "zip")] public string Zip { get; set; } /// /// [JsonProperty(PropertyName = "line1")] public string Line1 { get; set; } /// /// [JsonProperty(PropertyName = "line2")] public string Line2 { get; set; } /// /// [JsonProperty(PropertyName = "regionId")] public string RegionId { get; set; } /// /// [JsonProperty(PropertyName = "regionName")] public string RegionName { get; set; } /// /// [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } /// /// [JsonProperty(PropertyName = "middleName")] public string MiddleName { get; set; } /// /// [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } /// /// [JsonProperty(PropertyName = "phone")] public string Phone { get; set; } /// /// [JsonProperty(PropertyName = "email")] public string Email { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "isDefault")] public bool? IsDefault { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Note { /// /// Initializes a new instance of the Note class. /// public Note() { CustomInit(); } /// /// Initializes a new instance of the Note class. /// public Note(string title = default(string), string body = default(string), string outerId = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Title = title; Body = body; OuterId = outerId; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "body")] public string Body { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyObjectValue { /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// public DynamicPropertyObjectValue() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' public DynamicPropertyObjectValue(string objectType = default(string), string objectId = default(string), string locale = default(string), object value = default(object), string valueId = default(string), string valueType = default(string), string propertyId = default(string), string propertyName = default(string)) { ObjectType = objectType; ObjectId = objectId; Locale = locale; Value = value; ValueId = valueId; ValueType = valueType; PropertyId = propertyId; PropertyName = propertyName; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "valueId")] public string ValueId { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "propertyName")] public string PropertyName { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyName { /// /// Initializes a new instance of the DynamicPropertyName class. /// public DynamicPropertyName() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyName class. /// public DynamicPropertyName(string locale = default(string), string name = default(string)) { Locale = locale; Name = name; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicObjectProperty { /// /// Initializes a new instance of the DynamicObjectProperty class. /// public DynamicObjectProperty() { CustomInit(); } /// /// Initializes a new instance of the DynamicObjectProperty class. /// /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' public DynamicObjectProperty(string objectId = default(string), IList values = default(IList), string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ObjectId = objectId; Values = values; Name = name; Description = description; ObjectType = objectType; IsArray = isArray; IsDictionary = isDictionary; IsMultilingual = isMultilingual; IsRequired = isRequired; DisplayOrder = displayOrder; ValueType = valueType; DisplayNames = displayNames; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "values")] public IList Values { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } /// /// [JsonProperty(PropertyName = "isRequired")] public bool? IsRequired { get; set; } /// /// [JsonProperty(PropertyName = "displayOrder")] public int? DisplayOrder { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SeoInfo { /// /// Initializes a new instance of the SeoInfo class. /// public SeoInfo() { CustomInit(); } /// /// Initializes a new instance of the SeoInfo class. /// /// Slug /// head title tag content /// <meta name="description" /// /> /// <meta name="keywords" /> /// Tenant StoreId which SEO defined /// SEO related object id /// SEO related object type name /// Active/Inactive public SeoInfo(string name = default(string), string semanticUrl = default(string), string pageTitle = default(string), string metaDescription = default(string), string imageAltDescription = default(string), string metaKeywords = default(string), string storeId = default(string), string objectId = default(string), string objectType = default(string), bool? isActive = default(bool?), string languageCode = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; SemanticUrl = semanticUrl; PageTitle = pageTitle; MetaDescription = metaDescription; ImageAltDescription = imageAltDescription; MetaKeywords = metaKeywords; StoreId = storeId; ObjectId = objectId; ObjectType = objectType; IsActive = isActive; LanguageCode = languageCode; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets slug /// [JsonProperty(PropertyName = "semanticUrl")] public string SemanticUrl { get; set; } /// /// Gets or sets head title tag content /// [JsonProperty(PropertyName = "pageTitle")] public string PageTitle { get; set; } /// /// Gets or sets &lt;meta name="description" /&gt; /// [JsonProperty(PropertyName = "metaDescription")] public string MetaDescription { get; set; } /// /// [JsonProperty(PropertyName = "imageAltDescription")] public string ImageAltDescription { get; set; } /// /// Gets or sets &lt;meta name="keywords" /&gt; /// [JsonProperty(PropertyName = "metaKeywords")] public string MetaKeywords { get; set; } /// /// Gets or sets tenant StoreId which SEO defined /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// Gets or sets SEO related object id /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// Gets or sets SEO related object type name /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets active/Inactive /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Organization { /// /// Initializes a new instance of the Organization class. /// public Organization() { CustomInit(); } /// /// Initializes a new instance of the Organization class. /// public Organization(string description = default(string), string businessCategory = default(string), string ownerId = default(string), string parentId = default(string), string objectType = default(string), string name = default(string), string memberType = default(string), string outerId = default(string), string status = default(string), IList addresses = default(IList), IList phones = default(IList), IList emails = default(IList), IList notes = default(IList), IList groups = default(IList), string iconUrl = default(string), IList dynamicProperties = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Description = description; BusinessCategory = businessCategory; OwnerId = ownerId; ParentId = parentId; ObjectType = objectType; Name = name; MemberType = memberType; OuterId = outerId; Status = status; Addresses = addresses; Phones = phones; Emails = emails; Notes = notes; Groups = groups; IconUrl = iconUrl; DynamicProperties = dynamicProperties; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "businessCategory")] public string BusinessCategory { get; set; } /// /// [JsonProperty(PropertyName = "ownerId")] public string OwnerId { get; set; } /// /// [JsonProperty(PropertyName = "parentId")] public string ParentId { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "addresses")] public IList Addresses { get; set; } /// /// [JsonProperty(PropertyName = "phones")] public IList Phones { get; set; } /// /// [JsonProperty(PropertyName = "emails")] public IList Emails { get; set; } /// /// [JsonProperty(PropertyName = "notes")] public IList Notes { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Member { /// /// Initializes a new instance of the Member class. /// public Member() { CustomInit(); } /// /// Initializes a new instance of the Member class. /// public Member(string name = default(string), string memberType = default(string), string outerId = default(string), string status = default(string), IList addresses = default(IList), IList phones = default(IList), IList emails = default(IList), IList notes = default(IList), IList groups = default(IList), string iconUrl = default(string), string objectType = default(string), IList dynamicProperties = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; MemberType = memberType; OuterId = outerId; Status = status; Addresses = addresses; Phones = phones; Emails = emails; Notes = notes; Groups = groups; IconUrl = iconUrl; ObjectType = objectType; DynamicProperties = dynamicProperties; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "addresses")] public IList Addresses { get; set; } /// /// [JsonProperty(PropertyName = "phones")] public IList Phones { get; set; } /// /// [JsonProperty(PropertyName = "emails")] public IList Emails { get; set; } /// /// [JsonProperty(PropertyName = "notes")] public IList Notes { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PermissionScope { /// /// Initializes a new instance of the PermissionScope class. /// public PermissionScope() { CustomInit(); } /// /// Initializes a new instance of the PermissionScope class. /// public PermissionScope(string type = default(string), string label = default(string), string scope = default(string)) { Type = type; Label = label; Scope = scope; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } /// /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Permission { /// /// Initializes a new instance of the Permission class. /// public Permission() { CustomInit(); } /// /// Initializes a new instance of the Permission class. /// public Permission(string id = default(string), string name = default(string), string moduleId = default(string), string groupName = default(string), IList assignedScopes = default(IList), IList availableScopes = default(IList)) { Id = id; Name = name; ModuleId = moduleId; GroupName = groupName; AssignedScopes = assignedScopes; AvailableScopes = availableScopes; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "moduleId")] public string ModuleId { get; set; } /// /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } /// /// [JsonProperty(PropertyName = "assignedScopes")] public IList AssignedScopes { get; set; } /// /// [JsonProperty(PropertyName = "availableScopes")] public IList AvailableScopes { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Role { /// /// Initializes a new instance of the Role class. /// public Role() { CustomInit(); } /// /// Initializes a new instance of the Role class. /// public Role(string description = default(string), IList permissions = default(IList), string id = default(string), string name = default(string), string normalizedName = default(string), string concurrencyStamp = default(string)) { Description = description; Permissions = permissions; Id = id; Name = name; NormalizedName = normalizedName; ConcurrencyStamp = concurrencyStamp; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "normalizedName")] public string NormalizedName { get; set; } /// /// [JsonProperty(PropertyName = "concurrencyStamp")] public string ConcurrencyStamp { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ApplicationUserLogin { /// /// Initializes a new instance of the ApplicationUserLogin class. /// public ApplicationUserLogin() { CustomInit(); } /// /// Initializes a new instance of the ApplicationUserLogin class. /// public ApplicationUserLogin(string loginProvider = default(string), string providerKey = default(string)) { LoginProvider = loginProvider; ProviderKey = providerKey; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "loginProvider")] public string LoginProvider { get; set; } /// /// [JsonProperty(PropertyName = "providerKey")] public string ProviderKey { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ApplicationUser { /// /// Initializes a new instance of the ApplicationUser class. /// public ApplicationUser() { CustomInit(); } /// /// Initializes a new instance of the ApplicationUser class. /// /// Possible values include: 'PendingApproval', /// 'Approved', 'Rejected' public ApplicationUser(string storeId = default(string), string memberId = default(string), bool? isAdministrator = default(bool?), string photoUrl = default(string), string userType = default(string), string status = default(string), string password = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), IList roles = default(IList), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), string userState = default(string), IList permissions = default(IList), IList logins = default(IList), bool? passwordExpired = default(bool?), System.DateTime? lastPasswordChangedDate = default(System.DateTime?), System.DateTime? lastPasswordChangeRequestDate = default(System.DateTime?), string id = default(string), string userName = default(string), string normalizedUserName = default(string), string email = default(string), string normalizedEmail = default(string), bool? emailConfirmed = default(bool?), string passwordHash = default(string), string securityStamp = default(string), string concurrencyStamp = default(string), string phoneNumber = default(string), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEnd = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?)) { StoreId = storeId; MemberId = memberId; IsAdministrator = isAdministrator; PhotoUrl = photoUrl; UserType = userType; Status = status; Password = password; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Roles = roles; LockoutEndDateUtc = lockoutEndDateUtc; UserState = userState; Permissions = permissions; Logins = logins; PasswordExpired = passwordExpired; LastPasswordChangedDate = lastPasswordChangedDate; LastPasswordChangeRequestDate = lastPasswordChangeRequestDate; Id = id; UserName = userName; NormalizedUserName = normalizedUserName; Email = email; NormalizedEmail = normalizedEmail; EmailConfirmed = emailConfirmed; PasswordHash = passwordHash; SecurityStamp = securityStamp; ConcurrencyStamp = concurrencyStamp; PhoneNumber = phoneNumber; PhoneNumberConfirmed = phoneNumberConfirmed; TwoFactorEnabled = twoFactorEnabled; LockoutEnd = lockoutEnd; LockoutEnabled = lockoutEnabled; AccessFailedCount = accessFailedCount; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "memberId")] public string MemberId { get; set; } /// /// [JsonProperty(PropertyName = "isAdministrator")] public bool? IsAdministrator { get; set; } /// /// [JsonProperty(PropertyName = "photoUrl")] public string PhotoUrl { get; set; } /// /// [JsonProperty(PropertyName = "userType")] public string UserType { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "roles")] public IList Roles { get; set; } /// /// [JsonProperty(PropertyName = "lockoutEndDateUtc")] public System.DateTime? LockoutEndDateUtc { get; set; } /// /// Gets or sets possible values include: 'PendingApproval', /// 'Approved', 'Rejected' /// [JsonProperty(PropertyName = "userState")] public string UserState { get; set; } /// /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// /// [JsonProperty(PropertyName = "logins")] public IList Logins { get; set; } /// /// [JsonProperty(PropertyName = "passwordExpired")] public bool? PasswordExpired { get; set; } /// /// [JsonProperty(PropertyName = "lastPasswordChangedDate")] public System.DateTime? LastPasswordChangedDate { get; set; } /// /// [JsonProperty(PropertyName = "lastPasswordChangeRequestDate")] public System.DateTime? LastPasswordChangeRequestDate { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "normalizedUserName")] public string NormalizedUserName { get; set; } /// /// [JsonProperty(PropertyName = "email")] public string Email { get; set; } /// /// [JsonProperty(PropertyName = "normalizedEmail")] public string NormalizedEmail { get; set; } /// /// [JsonProperty(PropertyName = "emailConfirmed")] public bool? EmailConfirmed { get; set; } /// /// [JsonProperty(PropertyName = "passwordHash")] public string PasswordHash { get; set; } /// /// [JsonProperty(PropertyName = "securityStamp")] public string SecurityStamp { get; set; } /// /// [JsonProperty(PropertyName = "concurrencyStamp")] public string ConcurrencyStamp { get; set; } /// /// [JsonProperty(PropertyName = "phoneNumber")] public string PhoneNumber { get; set; } /// /// [JsonProperty(PropertyName = "phoneNumberConfirmed")] public bool? PhoneNumberConfirmed { get; set; } /// /// [JsonProperty(PropertyName = "twoFactorEnabled")] public bool? TwoFactorEnabled { get; set; } /// /// [JsonProperty(PropertyName = "lockoutEnd")] public System.DateTime? LockoutEnd { get; set; } /// /// [JsonProperty(PropertyName = "lockoutEnabled")] public bool? LockoutEnabled { get; set; } /// /// [JsonProperty(PropertyName = "accessFailedCount")] public int? AccessFailedCount { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Contact { /// /// Initializes a new instance of the Contact class. /// public Contact() { CustomInit(); } /// /// Initializes a new instance of the Contact class. /// public Contact(string salutation = default(string), string fullName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), System.DateTime? birthDate = default(System.DateTime?), string defaultLanguage = default(string), string timeZone = default(string), IList organizations = default(IList), IList associatedOrganizations = default(IList), string taxPayerId = default(string), string preferredDelivery = default(string), string preferredCommunication = default(string), string defaultShippingAddressId = default(string), string defaultBillingAddressId = default(string), string photoUrl = default(string), bool? isAnonymized = default(bool?), string about = default(string), string objectType = default(string), IList securityAccounts = default(IList), string name = default(string), string memberType = default(string), string outerId = default(string), string status = default(string), IList addresses = default(IList), IList phones = default(IList), IList emails = default(IList), IList notes = default(IList), IList groups = default(IList), string iconUrl = default(string), IList dynamicProperties = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Salutation = salutation; FullName = fullName; FirstName = firstName; MiddleName = middleName; LastName = lastName; BirthDate = birthDate; DefaultLanguage = defaultLanguage; TimeZone = timeZone; Organizations = organizations; AssociatedOrganizations = associatedOrganizations; TaxPayerId = taxPayerId; PreferredDelivery = preferredDelivery; PreferredCommunication = preferredCommunication; DefaultShippingAddressId = defaultShippingAddressId; DefaultBillingAddressId = defaultBillingAddressId; PhotoUrl = photoUrl; IsAnonymized = isAnonymized; About = about; ObjectType = objectType; SecurityAccounts = securityAccounts; Name = name; MemberType = memberType; OuterId = outerId; Status = status; Addresses = addresses; Phones = phones; Emails = emails; Notes = notes; Groups = groups; IconUrl = iconUrl; DynamicProperties = dynamicProperties; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "salutation")] public string Salutation { get; set; } /// /// [JsonProperty(PropertyName = "fullName")] public string FullName { get; set; } /// /// [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } /// /// [JsonProperty(PropertyName = "middleName")] public string MiddleName { get; set; } /// /// [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } /// /// [JsonProperty(PropertyName = "birthDate")] public System.DateTime? BirthDate { get; set; } /// /// [JsonProperty(PropertyName = "defaultLanguage")] public string DefaultLanguage { get; set; } /// /// [JsonProperty(PropertyName = "timeZone")] public string TimeZone { get; set; } /// /// [JsonProperty(PropertyName = "organizations")] public IList Organizations { get; set; } /// /// [JsonProperty(PropertyName = "associatedOrganizations")] public IList AssociatedOrganizations { get; set; } /// /// [JsonProperty(PropertyName = "taxPayerId")] public string TaxPayerId { get; set; } /// /// [JsonProperty(PropertyName = "preferredDelivery")] public string PreferredDelivery { get; set; } /// /// [JsonProperty(PropertyName = "preferredCommunication")] public string PreferredCommunication { get; set; } /// /// [JsonProperty(PropertyName = "defaultShippingAddressId")] public string DefaultShippingAddressId { get; set; } /// /// [JsonProperty(PropertyName = "defaultBillingAddressId")] public string DefaultBillingAddressId { get; set; } /// /// [JsonProperty(PropertyName = "photoUrl")] public string PhotoUrl { get; set; } /// /// [JsonProperty(PropertyName = "isAnonymized")] public bool? IsAnonymized { get; set; } /// /// [JsonProperty(PropertyName = "about")] public string About { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "securityAccounts")] public IList SecurityAccounts { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "addresses")] public IList Addresses { get; set; } /// /// [JsonProperty(PropertyName = "phones")] public IList Phones { get; set; } /// /// [JsonProperty(PropertyName = "emails")] public IList Emails { get; set; } /// /// [JsonProperty(PropertyName = "notes")] public IList Notes { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Vendor { /// /// Initializes a new instance of the Vendor class. /// public Vendor() { CustomInit(); } /// /// Initializes a new instance of the Vendor class. /// public Vendor(string description = default(string), string siteUrl = default(string), string logoUrl = default(string), string groupName = default(string), IList securityAccounts = default(IList), string objectType = default(string), string name = default(string), string memberType = default(string), string outerId = default(string), string status = default(string), IList addresses = default(IList), IList phones = default(IList), IList emails = default(IList), IList notes = default(IList), IList groups = default(IList), string iconUrl = default(string), IList dynamicProperties = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Description = description; SiteUrl = siteUrl; LogoUrl = logoUrl; GroupName = groupName; SecurityAccounts = securityAccounts; ObjectType = objectType; Name = name; MemberType = memberType; OuterId = outerId; Status = status; Addresses = addresses; Phones = phones; Emails = emails; Notes = notes; Groups = groups; IconUrl = iconUrl; DynamicProperties = dynamicProperties; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "siteUrl")] public string SiteUrl { get; set; } /// /// [JsonProperty(PropertyName = "logoUrl")] public string LogoUrl { get; set; } /// /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } /// /// [JsonProperty(PropertyName = "securityAccounts")] public IList SecurityAccounts { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "addresses")] public IList Addresses { get; set; } /// /// [JsonProperty(PropertyName = "phones")] public IList Phones { get; set; } /// /// [JsonProperty(PropertyName = "emails")] public IList Emails { get; set; } /// /// [JsonProperty(PropertyName = "notes")] public IList Notes { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Employee { /// /// Initializes a new instance of the Employee class. /// public Employee() { CustomInit(); } /// /// Initializes a new instance of the Employee class. /// public Employee(string salutation = default(string), string fullName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), System.DateTime? birthDate = default(System.DateTime?), string defaultLanguage = default(string), string timeZone = default(string), IList organizations = default(IList), string employeeType = default(string), bool? isActive = default(bool?), string photoUrl = default(string), string objectType = default(string), IList securityAccounts = default(IList), string name = default(string), string memberType = default(string), string outerId = default(string), string status = default(string), IList addresses = default(IList), IList phones = default(IList), IList emails = default(IList), IList notes = default(IList), IList groups = default(IList), string iconUrl = default(string), IList dynamicProperties = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Salutation = salutation; FullName = fullName; FirstName = firstName; MiddleName = middleName; LastName = lastName; BirthDate = birthDate; DefaultLanguage = defaultLanguage; TimeZone = timeZone; Organizations = organizations; EmployeeType = employeeType; IsActive = isActive; PhotoUrl = photoUrl; ObjectType = objectType; SecurityAccounts = securityAccounts; Name = name; MemberType = memberType; OuterId = outerId; Status = status; Addresses = addresses; Phones = phones; Emails = emails; Notes = notes; Groups = groups; IconUrl = iconUrl; DynamicProperties = dynamicProperties; SeoObjectType = seoObjectType; SeoInfos = seoInfos; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "salutation")] public string Salutation { get; set; } /// /// [JsonProperty(PropertyName = "fullName")] public string FullName { get; set; } /// /// [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } /// /// [JsonProperty(PropertyName = "middleName")] public string MiddleName { get; set; } /// /// [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } /// /// [JsonProperty(PropertyName = "birthDate")] public System.DateTime? BirthDate { get; set; } /// /// [JsonProperty(PropertyName = "defaultLanguage")] public string DefaultLanguage { get; set; } /// /// [JsonProperty(PropertyName = "timeZone")] public string TimeZone { get; set; } /// /// [JsonProperty(PropertyName = "organizations")] public IList Organizations { get; set; } /// /// [JsonProperty(PropertyName = "employeeType")] public string EmployeeType { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "photoUrl")] public string PhotoUrl { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "securityAccounts")] public IList SecurityAccounts { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "addresses")] public IList Addresses { get; set; } /// /// [JsonProperty(PropertyName = "phones")] public IList Phones { get; set; } /// /// [JsonProperty(PropertyName = "emails")] public IList Emails { get; set; } /// /// [JsonProperty(PropertyName = "notes")] public IList Notes { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ContactSearchResult { /// /// Initializes a new instance of the ContactSearchResult class. /// public ContactSearchResult() { CustomInit(); } /// /// Initializes a new instance of the ContactSearchResult class. /// public ContactSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class IconResizeRequest { /// /// Initializes a new instance of the IconResizeRequest class. /// public IconResizeRequest() { CustomInit(); } /// /// Initializes a new instance of the IconResizeRequest class. /// public IconResizeRequest(string url = default(string), int? width = default(int?), int? height = default(int?)) { Url = url; Width = width; Height = height; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "width")] public int? Width { get; set; } /// /// [JsonProperty(PropertyName = "height")] public int? Height { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class MemberSearchResult { /// /// Initializes a new instance of the MemberSearchResult class. /// public MemberSearchResult() { CustomInit(); } /// /// Initializes a new instance of the MemberSearchResult class. /// public MemberSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class MembersSearchCriteria { /// /// Initializes a new instance of the MembersSearchCriteria class. /// public MembersSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the MembersSearchCriteria class. /// public MembersSearchCriteria(string memberType = default(string), IList memberTypes = default(IList), string group = default(string), IList groups = default(IList), string memberId = default(string), bool? deepSearch = default(bool?), IList outerIds = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { MemberType = memberType; MemberTypes = memberTypes; Group = group; Groups = groups; MemberId = memberId; DeepSearch = deepSearch; OuterIds = outerIds; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "memberType")] public string MemberType { get; set; } /// /// [JsonProperty(PropertyName = "memberTypes")] public IList MemberTypes { get; set; } /// /// [JsonProperty(PropertyName = "group")] public string Group { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "memberId")] public string MemberId { get; set; } /// /// [JsonProperty(PropertyName = "deepSearch")] public bool? DeepSearch { get; set; } /// /// [JsonProperty(PropertyName = "outerIds")] public IList OuterIds { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OrganizationSearchResult { /// /// Initializes a new instance of the OrganizationSearchResult class. /// public OrganizationSearchResult() { CustomInit(); } /// /// Initializes a new instance of the OrganizationSearchResult class. /// public OrganizationSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class StringIdentityUserRole { /// /// Initializes a new instance of the StringIdentityUserRole class. /// public StringIdentityUserRole() { CustomInit(); } /// /// Initializes a new instance of the StringIdentityUserRole class. /// public StringIdentityUserRole(string userId = default(string), string roleId = default(string)) { UserId = userId; RoleId = roleId; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "userId")] public string UserId { get; set; } /// /// [JsonProperty(PropertyName = "roleId")] public string RoleId { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class VendorSearchResult { /// /// Initializes a new instance of the VendorSearchResult class. /// public VendorSearchResult() { CustomInit(); } /// /// Initializes a new instance of the VendorSearchResult class. /// public VendorSearchResult(IList vendors = default(IList), int? totalCount = default(int?), IList results = default(IList)) { Vendors = vendors; TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "vendors")] public IList Vendors { get; private set; } /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/NotificationsModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationsModuleClient : ServiceClient, INotificationsModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the INotifications. /// public virtual INotifications Notifications { get; private set; } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling NotificationsModuleClient.Dispose(). False: will not dispose provided httpClient protected NotificationsModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected NotificationsModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected NotificationsModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected NotificationsModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected NotificationsModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public NotificationsModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling NotificationsModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public NotificationsModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public NotificationsModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public NotificationsModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the NotificationsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public NotificationsModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { Notifications = new Notifications(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface INotificationsModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the INotifications. /// INotifications Notifications { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Notifications operations. /// public partial class Notifications : IServiceOperations, INotifications { /// /// Initializes a new instance of the Notifications class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Notifications(NotificationsModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the NotificationsModuleClient /// public NotificationsModuleClient Client { get; private set; } /// /// Get all registered notification types by criteria /// /// /// criteria for search(keyword, skip, take and etc.) /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetNotificationsWithHttpMessagesAsync(NotificationSearchCriteria body = default(NotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNotifications", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get notification by type /// /// /// Get all notification templates by notification type, tenantId, teantTypeId. /// Tenant id and tenant type id - params of tenant, that initialize creating /// of /// template. By default tenant id and tenant type id = "Platform". For example /// for store with id = "SampleStore", tenantId = "SampleStore", tenantType = /// "Store". /// /// /// Notification type of template /// /// /// Tenant id of template /// /// /// Tenant type id of template /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetNotificationByTypeIdWithHttpMessagesAsync(string type, string tenantId = default(string), string tenantType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (type == null) { throw new ValidationException(ValidationRules.CannotBeNull, "type"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("type", type); tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("tenantType", tenantType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNotificationByTypeId", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/{type}").ToString(); _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); List _queryParameters = new List(); if (tenantId != null) { _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (tenantType != null) { _queryParameters.Add(string.Format("tenantType={0}", System.Uri.EscapeDataString(tenantType))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update notification with templates /// /// /// /// /// Notification /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task UpdateNotificationWithHttpMessagesAsync(string type, Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (type == null) { throw new ValidationException(ValidationRules.CannotBeNull, "type"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("type", type); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateNotification", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/{type}").ToString(); _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Render content /// /// /// /// /// /// /// request of Notification Template with text and data /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task RenderingTemplateWithHttpMessagesAsync(string language, string type, NotificationTemplateRequest body = default(NotificationTemplateRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (language == null) { throw new ValidationException(ValidationRules.CannotBeNull, "language"); } if (type == null) { throw new ValidationException(ValidationRules.CannotBeNull, "type"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("language", language); tracingParameters.Add("type", type); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RenderingTemplate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/{type}/templates/{language}/rendercontent").ToString(); _url = _url.Replace("{language}", System.Uri.EscapeDataString(language)); _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Sending notification /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SendNotificationWithHttpMessagesAsync(Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SendNotification", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/send").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Schedule sending notification /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ScheduleSendNotificationWithHttpMessagesAsync(Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ScheduleSendNotification", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/schedule").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Sending notification /// /// /// Method sending notification, that based on notification template. Template /// for rendering chosen by type, objectId, objectTypeId, language. /// Parameters for template may be prepared by the method of /// getTestingParameters. Method returns string. If sending finished with /// success status /// this string is empty, otherwise string contains error message. /// /// /// Notification request /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SendNotificationByRequestWithHttpMessagesAsync(NotificationRequest body = default(NotificationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SendNotificationByRequest", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/notification/template/sendnotification").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get all notification journal /// /// /// Method returns notification journal page with array of notification, that /// was send, sending or will be send in future. Result contains total count, /// that can be used /// for paging. /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetNotificationJournalWithHttpMessagesAsync(NotificationMessageSearchCriteria body = default(NotificationMessageSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetNotificationJournal", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/journal").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetObjectNotificationJournalWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetObjectNotificationJournal", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/notifications/journal/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Notifications operations. /// public partial interface INotifications { /// /// Get all registered notification types by criteria /// /// /// criteria for search(keyword, skip, take and etc.) /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetNotificationsWithHttpMessagesAsync(NotificationSearchCriteria body = default(NotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get notification by type /// /// /// Get all notification templates by notification type, tenantId, /// teantTypeId. Tenant id and tenant type id - params of tenant, that /// initialize creating of /// template. By default tenant id and tenant type id = "Platform". For /// example for store with id = "SampleStore", tenantId = /// "SampleStore", tenantType = "Store". /// /// /// Notification type of template /// /// /// Tenant id of template /// /// /// Tenant type id of template /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetNotificationByTypeIdWithHttpMessagesAsync(string type, string tenantId = default(string), string tenantType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update notification with templates /// /// /// /// /// Notification /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task UpdateNotificationWithHttpMessagesAsync(string type, Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Render content /// /// /// /// /// /// /// request of Notification Template with text and data /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task RenderingTemplateWithHttpMessagesAsync(string language, string type, NotificationTemplateRequest body = default(NotificationTemplateRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Sending notification /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SendNotificationWithHttpMessagesAsync(Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Schedule sending notification /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ScheduleSendNotificationWithHttpMessagesAsync(Notification body = default(Notification), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Sending notification /// /// /// Method sending notification, that based on notification template. /// Template for rendering chosen by type, objectId, objectTypeId, /// language. /// Parameters for template may be prepared by the method of /// getTestingParameters. Method returns string. If sending finished /// with success status /// this string is empty, otherwise string contains error message. /// /// /// Notification request /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SendNotificationByRequestWithHttpMessagesAsync(NotificationRequest body = default(NotificationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all notification journal /// /// /// Method returns notification journal page with array of /// notification, that was send, sending or will be send in future. /// Result contains total count, that can be used /// for paging. /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetNotificationJournalWithHttpMessagesAsync(NotificationMessageSearchCriteria body = default(NotificationMessageSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetObjectNotificationJournalWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Notifications. /// public static partial class NotificationsExtensions { /// /// Get all registered notification types by criteria /// /// /// The operations group for this extension method. /// /// /// criteria for search(keyword, skip, take and etc.) /// public static NotificationSearchResult GetNotifications(this INotifications operations, NotificationSearchCriteria body = default(NotificationSearchCriteria)) { return operations.GetNotificationsAsync(body).GetAwaiter().GetResult(); } /// /// Get all registered notification types by criteria /// /// /// The operations group for this extension method. /// /// /// criteria for search(keyword, skip, take and etc.) /// /// /// The cancellation token. /// public static async Task GetNotificationsAsync(this INotifications operations, NotificationSearchCriteria body = default(NotificationSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNotificationsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get notification by type /// /// /// Get all notification templates by notification type, tenantId, teantTypeId. /// Tenant id and tenant type id - params of tenant, that initialize creating /// of /// template. By default tenant id and tenant type id = "Platform". For example /// for store with id = "SampleStore", tenantId = "SampleStore", tenantType = /// "Store". /// /// /// The operations group for this extension method. /// /// /// Notification type of template /// /// /// Tenant id of template /// /// /// Tenant type id of template /// public static Notification GetNotificationByTypeId(this INotifications operations, string type, string tenantId = default(string), string tenantType = default(string)) { return operations.GetNotificationByTypeIdAsync(type, tenantId, tenantType).GetAwaiter().GetResult(); } /// /// Get notification by type /// /// /// Get all notification templates by notification type, tenantId, teantTypeId. /// Tenant id and tenant type id - params of tenant, that initialize creating /// of /// template. By default tenant id and tenant type id = "Platform". For example /// for store with id = "SampleStore", tenantId = "SampleStore", tenantType = /// "Store". /// /// /// The operations group for this extension method. /// /// /// Notification type of template /// /// /// Tenant id of template /// /// /// Tenant type id of template /// /// /// The cancellation token. /// public static async Task GetNotificationByTypeIdAsync(this INotifications operations, string type, string tenantId = default(string), string tenantType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNotificationByTypeIdWithHttpMessagesAsync(type, tenantId, tenantType, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update notification with templates /// /// /// The operations group for this extension method. /// /// /// /// /// Notification /// public static void UpdateNotification(this INotifications operations, string type, Notification body = default(Notification)) { operations.UpdateNotificationAsync(type, body).GetAwaiter().GetResult(); } /// /// Update notification with templates /// /// /// The operations group for this extension method. /// /// /// /// /// Notification /// /// /// The cancellation token. /// public static async Task UpdateNotificationAsync(this INotifications operations, string type, Notification body = default(Notification), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateNotificationWithHttpMessagesAsync(type, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Render content /// /// /// The operations group for this extension method. /// /// /// /// /// /// /// request of Notification Template with text and data /// public static void RenderingTemplate(this INotifications operations, string language, string type, NotificationTemplateRequest body = default(NotificationTemplateRequest)) { operations.RenderingTemplateAsync(language, type, body).GetAwaiter().GetResult(); } /// /// Render content /// /// /// The operations group for this extension method. /// /// /// /// /// /// /// request of Notification Template with text and data /// /// /// The cancellation token. /// public static async Task RenderingTemplateAsync(this INotifications operations, string language, string type, NotificationTemplateRequest body = default(NotificationTemplateRequest), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.RenderingTemplateWithHttpMessagesAsync(language, type, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Sending notification /// /// /// The operations group for this extension method. /// /// /// public static NotificationSendResult SendNotification(this INotifications operations, Notification body = default(Notification)) { return operations.SendNotificationAsync(body).GetAwaiter().GetResult(); } /// /// Sending notification /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SendNotificationAsync(this INotifications operations, Notification body = default(Notification), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SendNotificationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Schedule sending notification /// /// /// The operations group for this extension method. /// /// /// public static void ScheduleSendNotification(this INotifications operations, Notification body = default(Notification)) { operations.ScheduleSendNotificationAsync(body).GetAwaiter().GetResult(); } /// /// Schedule sending notification /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ScheduleSendNotificationAsync(this INotifications operations, Notification body = default(Notification), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ScheduleSendNotificationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Sending notification /// /// /// Method sending notification, that based on notification template. Template /// for rendering chosen by type, objectId, objectTypeId, language. /// Parameters for template may be prepared by the method of /// getTestingParameters. Method returns string. If sending finished with /// success status /// this string is empty, otherwise string contains error message. /// /// /// The operations group for this extension method. /// /// /// Notification request /// public static NotificationSendResult SendNotificationByRequest(this INotifications operations, NotificationRequest body = default(NotificationRequest)) { return operations.SendNotificationByRequestAsync(body).GetAwaiter().GetResult(); } /// /// Sending notification /// /// /// Method sending notification, that based on notification template. Template /// for rendering chosen by type, objectId, objectTypeId, language. /// Parameters for template may be prepared by the method of /// getTestingParameters. Method returns string. If sending finished with /// success status /// this string is empty, otherwise string contains error message. /// /// /// The operations group for this extension method. /// /// /// Notification request /// /// /// The cancellation token. /// public static async Task SendNotificationByRequestAsync(this INotifications operations, NotificationRequest body = default(NotificationRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SendNotificationByRequestWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get all notification journal /// /// /// Method returns notification journal page with array of notification, that /// was send, sending or will be send in future. Result contains total count, /// that can be used /// for paging. /// /// /// The operations group for this extension method. /// /// /// public static NotificationMessageSearchResult GetNotificationJournal(this INotifications operations, NotificationMessageSearchCriteria body = default(NotificationMessageSearchCriteria)) { return operations.GetNotificationJournalAsync(body).GetAwaiter().GetResult(); } /// /// Get all notification journal /// /// /// Method returns notification journal page with array of notification, that /// was send, sending or will be send in future. Result contains total count, /// that can be used /// for paging. /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetNotificationJournalAsync(this INotifications operations, NotificationMessageSearchCriteria body = default(NotificationMessageSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNotificationJournalWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static NotificationMessage GetObjectNotificationJournal(this INotifications operations, string id) { return operations.GetObjectNotificationJournalAsync(id).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetObjectNotificationJournalAsync(this INotifications operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetObjectNotificationJournalWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Criteria for searching /// public partial class NotificationSearchCriteria { /// /// Initializes a new instance of the NotificationSearchCriteria class. /// public NotificationSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the NotificationSearchCriteria class. /// /// Owner Id of Notification /// Owner Type of Notification /// only active notification public NotificationSearchCriteria(string notificationType = default(string), string tenantId = default(string), string tenantType = default(string), bool? isActive = default(bool?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { NotificationType = notificationType; TenantId = tenantId; TenantType = tenantType; IsActive = isActive; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "notificationType")] public string NotificationType { get; set; } /// /// Gets or sets owner Id of Notification /// [JsonProperty(PropertyName = "tenantId")] public string TenantId { get; set; } /// /// Gets or sets owner Type of Notification /// [JsonProperty(PropertyName = "tenantType")] public string TenantType { get; set; } /// /// Gets or sets only active notification /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class TenantIdentity { /// /// Initializes a new instance of the TenantIdentity class. /// public TenantIdentity() { CustomInit(); } /// /// Initializes a new instance of the TenantIdentity class. /// public TenantIdentity(string id = default(string), string type = default(string), bool? isEmpty = default(bool?), bool? isValid = default(bool?)) { Id = id; Type = type; IsEmpty = isEmpty; IsValid = isValid; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "isEmpty")] public bool? IsEmpty { get; private set; } /// /// [JsonProperty(PropertyName = "isValid")] public bool? IsValid { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Template of Notification with a different language /// public partial class NotificationTemplate { /// /// Initializes a new instance of the NotificationTemplate class. /// public NotificationTemplate() { CustomInit(); } /// /// Initializes a new instance of the NotificationTemplate class. /// /// Code of Language /// For detecting kind of notifications (email, sms /// and etc.) public NotificationTemplate(string languageCode = default(string), string kind = default(string), bool? isReadonly = default(bool?), string outerId = default(string), bool? isPredefined = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { LanguageCode = languageCode; Kind = kind; IsReadonly = isReadonly; OuterId = outerId; IsPredefined = isPredefined; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets code of Language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// Gets for detecting kind of notifications (email, sms and etc.) /// [JsonProperty(PropertyName = "kind")] public string Kind { get; private set; } /// /// [JsonProperty(PropertyName = "isReadonly")] public bool? IsReadonly { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "isPredefined")] public bool? IsPredefined { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Base class for Notification /// public partial class Notification { /// /// Initializes a new instance of the Notification class. /// public Notification() { CustomInit(); } /// /// Initializes a new instance of the Notification class. /// /// This field represents an alias for the /// notification type /// and is used only for backward compatibility with old notification /// names /// that are stored and used by API clients. /// Type of notifications, like Identifier /// For detecting kind of notifications (email, sms /// and etc.) public Notification(TenantIdentity tenantIdentity = default(TenantIdentity), bool? isActive = default(bool?), string languageCode = default(string), string alias = default(string), string type = default(string), string kind = default(string), string outerId = default(string), IList templates = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { TenantIdentity = tenantIdentity; IsActive = isActive; LanguageCode = languageCode; Alias = alias; Type = type; Kind = kind; OuterId = outerId; Templates = templates; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "tenantIdentity")] public TenantIdentity TenantIdentity { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// Gets or sets this field represents an alias for the notification /// type /// and is used only for backward compatibility with old notification /// names /// that are stored and used by API clients. /// [JsonProperty(PropertyName = "alias")] public string Alias { get; set; } /// /// Gets or sets type of notifications, like Identifier /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// Gets for detecting kind of notifications (email, sms and etc.) /// [JsonProperty(PropertyName = "kind")] public string Kind { get; private set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// [JsonProperty(PropertyName = "templates")] public IList Templates { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationSearchResult { /// /// Initializes a new instance of the NotificationSearchResult class. /// public NotificationSearchResult() { CustomInit(); } /// /// Initializes a new instance of the NotificationSearchResult class. /// public NotificationSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationTemplateRequest { /// /// Initializes a new instance of the NotificationTemplateRequest /// class. /// public NotificationTemplateRequest() { CustomInit(); } /// /// Initializes a new instance of the NotificationTemplateRequest /// class. /// public NotificationTemplateRequest(string text = default(string), Notification data = default(Notification)) { Text = text; Data = data; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "text")] public string Text { get; set; } /// /// [JsonProperty(PropertyName = "data")] public Notification Data { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Result of notification sending /// public partial class NotificationSendResult { /// /// Initializes a new instance of the NotificationSendResult class. /// public NotificationSendResult() { CustomInit(); } /// /// Initializes a new instance of the NotificationSendResult class. /// public NotificationSendResult(string errorMessage = default(string), bool? isSuccess = default(bool?)) { ErrorMessage = errorMessage; IsSuccess = isSuccess; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "errorMessage")] public string ErrorMessage { get; set; } /// /// [JsonProperty(PropertyName = "isSuccess")] public bool? IsSuccess { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationParameter { /// /// Initializes a new instance of the NotificationParameter class. /// public NotificationParameter() { CustomInit(); } /// /// Initializes a new instance of the NotificationParameter class. /// /// Possible values include: 'String', 'Integer', /// 'Decimal', 'DateTime', 'Boolean' public NotificationParameter(string parameterName = default(string), string parameterDescription = default(string), string parameterCodeInView = default(string), bool? isDictionary = default(bool?), bool? isArray = default(bool?), string type = default(string), object value = default(object)) { ParameterName = parameterName; ParameterDescription = parameterDescription; ParameterCodeInView = parameterCodeInView; IsDictionary = isDictionary; IsArray = isArray; Type = type; Value = value; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "parameterName")] public string ParameterName { get; set; } /// /// [JsonProperty(PropertyName = "parameterDescription")] public string ParameterDescription { get; set; } /// /// [JsonProperty(PropertyName = "parameterCodeInView")] public string ParameterCodeInView { get; set; } /// /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// /// Gets or sets possible values include: 'String', 'Integer', /// 'Decimal', 'DateTime', 'Boolean' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationRequest { /// /// Initializes a new instance of the NotificationRequest class. /// public NotificationRequest() { CustomInit(); } /// /// Initializes a new instance of the NotificationRequest class. /// public NotificationRequest(string type = default(string), string objectId = default(string), string objectTypeId = default(string), string language = default(string), IList notificationParameters = default(IList)) { Type = type; ObjectId = objectId; ObjectTypeId = objectTypeId; Language = language; NotificationParameters = notificationParameters; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "objectTypeId")] public string ObjectTypeId { get; set; } /// /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } /// /// [JsonProperty(PropertyName = "notificationParameters")] public IList NotificationParameters { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationMessageSearchCriteria { /// /// Initializes a new instance of the NotificationMessageSearchCriteria /// class. /// public NotificationMessageSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the NotificationMessageSearchCriteria /// class. /// public NotificationMessageSearchCriteria(string notificationType = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { NotificationType = notificationType; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "notificationType")] public string NotificationType { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Base class for message of a notification with information about sending /// public partial class NotificationMessage { /// /// Initializes a new instance of the NotificationMessage class. /// public NotificationMessage() { CustomInit(); } /// /// Initializes a new instance of the NotificationMessage class. /// /// Id of Notification /// Type of Notification /// Count of sending attempt /// Max count of sending /// attempt /// The last error of sending /// The last date of sending /// attempt /// Date of sending /// Code of language public NotificationMessage(string kind = default(string), TenantIdentity tenantIdentity = default(TenantIdentity), string notificationId = default(string), string notificationType = default(string), int? sendAttemptCount = default(int?), int? maxSendAttemptCount = default(int?), string lastSendError = default(string), System.DateTime? lastSendAttemptDate = default(System.DateTime?), System.DateTime? sendDate = default(System.DateTime?), string languageCode = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Kind = kind; TenantIdentity = tenantIdentity; NotificationId = notificationId; NotificationType = notificationType; SendAttemptCount = sendAttemptCount; MaxSendAttemptCount = maxSendAttemptCount; LastSendError = lastSendError; LastSendAttemptDate = lastSendAttemptDate; SendDate = sendDate; LanguageCode = languageCode; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "kind")] public string Kind { get; private set; } /// /// [JsonProperty(PropertyName = "tenantIdentity")] public TenantIdentity TenantIdentity { get; set; } /// /// Gets or sets id of Notification /// [JsonProperty(PropertyName = "notificationId")] public string NotificationId { get; set; } /// /// Gets or sets type of Notification /// [JsonProperty(PropertyName = "notificationType")] public string NotificationType { get; set; } /// /// Gets or sets count of sending attempt /// [JsonProperty(PropertyName = "sendAttemptCount")] public int? SendAttemptCount { get; set; } /// /// Gets or sets max count of sending attempt /// [JsonProperty(PropertyName = "maxSendAttemptCount")] public int? MaxSendAttemptCount { get; set; } /// /// Gets or sets the last error of sending /// [JsonProperty(PropertyName = "lastSendError")] public string LastSendError { get; set; } /// /// Gets or sets the last date of sending attempt /// [JsonProperty(PropertyName = "lastSendAttemptDate")] public System.DateTime? LastSendAttemptDate { get; set; } /// /// Gets or sets date of sending /// [JsonProperty(PropertyName = "sendDate")] public System.DateTime? SendDate { get; set; } /// /// Gets or sets code of language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class NotificationMessageSearchResult { /// /// Initializes a new instance of the NotificationMessageSearchResult /// class. /// public NotificationMessageSearchResult() { CustomInit(); } /// /// Initializes a new instance of the NotificationMessageSearchResult /// class. /// public NotificationMessageSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/PlatformModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Virto Commerce provides API documentation in two formats, JSON and /// YAML, with schema files generated as swagger.json and swagger.yaml. To /// ensure secure access, authorization filters can be applied using a /// specific key to grant access. This allows authorized users to securely /// interact with the API and access the necessary resources while /// maintaining confidentiality and data integrity. /// public partial class PlatformModuleClient : ServiceClient, IPlatformModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the IAuthorization. /// public virtual IAuthorization Authorization { get; private set; } /// /// Gets the IExternalSignIn. /// public virtual IExternalSignIn ExternalSignIn { get; private set; } /// /// Gets the IApps. /// public virtual IApps Apps { get; private set; } /// /// Gets the IChangeLog. /// public virtual IChangeLog ChangeLog { get; private set; } /// /// Gets the IDiagnostics. /// public virtual IDiagnostics Diagnostics { get; private set; } /// /// Gets the IDynamicProperties. /// public virtual IDynamicProperties DynamicProperties { get; private set; } /// /// Gets the IJobs. /// public virtual IJobs Jobs { get; private set; } /// /// Gets the IModules. /// public virtual IModules Modules { get; private set; } /// /// Gets the IOAuthApps. /// public virtual IOAuthApps OAuthApps { get; private set; } /// /// Gets the IPushNotificationOperations. /// public virtual IPushNotificationOperations PushNotification { get; private set; } /// /// Gets the ISecurity. /// public virtual ISecurity Security { get; private set; } /// /// Gets the ISetting. /// public virtual ISetting Setting { get; private set; } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling PlatformModuleClient.Dispose(). False: will not dispose provided httpClient protected PlatformModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected PlatformModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected PlatformModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected PlatformModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected PlatformModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public PlatformModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling PlatformModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public PlatformModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public PlatformModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public PlatformModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the PlatformModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public PlatformModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { Authorization = new Authorization(this); ExternalSignIn = new ExternalSignIn(this); Apps = new Apps(this); ChangeLog = new ChangeLog(this); Diagnostics = new Diagnostics(this); DynamicProperties = new DynamicProperties(this); Jobs = new Jobs(this); Modules = new Modules(this); OAuthApps = new OAuthApps(this); PushNotification = new PushNotificationOperations(this); Security = new Security(this); Setting = new Setting(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Virto Commerce provides API documentation in two formats, JSON and /// YAML, with schema files generated as swagger.json and swagger.yaml. To /// ensure secure access, authorization filters can be applied using a /// specific key to grant access. This allows authorized users to securely /// interact with the API and access the necessary resources while /// maintaining confidentiality and data integrity. /// public partial interface IPlatformModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the IAuthorization. /// IAuthorization Authorization { get; } /// /// Gets the IExternalSignIn. /// IExternalSignIn ExternalSignIn { get; } /// /// Gets the IApps. /// IApps Apps { get; } /// /// Gets the IChangeLog. /// IChangeLog ChangeLog { get; } /// /// Gets the IDiagnostics. /// IDiagnostics Diagnostics { get; } /// /// Gets the IDynamicProperties. /// IDynamicProperties DynamicProperties { get; } /// /// Gets the IJobs. /// IJobs Jobs { get; } /// /// Gets the IModules. /// IModules Modules { get; } /// /// Gets the IOAuthApps. /// IOAuthApps OAuthApps { get; } /// /// Gets the IPushNotificationOperations. /// IPushNotificationOperations PushNotification { get; } /// /// Gets the ISecurity. /// ISecurity Security { get; } /// /// Gets the ISetting. /// ISetting Setting { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Authorization operations. /// public partial class Authorization : IServiceOperations, IAuthorization { /// /// Initializes a new instance of the Authorization class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Authorization(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ExchangeWithHttpMessagesAsync(Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (body == null) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } if (body != null) { body.Validate(); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Exchange", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "connect/token").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 400) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Authorization operations. /// public partial interface IAuthorization { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ExchangeWithHttpMessagesAsync(Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Authorization. /// public static partial class AuthorizationExtensions { /// /// The operations group for this extension method. /// /// /// public static OpenIddictResponse Exchange(this IAuthorization operations, Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body) { return operations.ExchangeAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ExchangeAsync(this IAuthorization operations, Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ExchangeWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// ExternalSignIn operations. /// public partial class ExternalSignIn : IServiceOperations, IExternalSignIn { /// /// Initializes a new instance of the ExternalSignIn class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public ExternalSignIn(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SignInWithHttpMessagesAsync(string authenticationType = default(string), string returnUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("authenticationType", authenticationType); tracingParameters.Add("returnUrl", returnUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SignIn", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "externalsignin").ToString(); List _queryParameters = new List(); if (authenticationType != null) { _queryParameters.Add(string.Format("authenticationType={0}", System.Uri.EscapeDataString(authenticationType))); } if (returnUrl != null) { _queryParameters.Add(string.Format("returnUrl={0}", System.Uri.EscapeDataString(returnUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SignOutWithHttpMessagesAsync(string authenticationType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("authenticationType", authenticationType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SignOut", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "externalsignin/signout").ToString(); List _queryParameters = new List(); if (authenticationType != null) { _queryParameters.Add(string.Format("authenticationType={0}", System.Uri.EscapeDataString(authenticationType))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SignInCallbackWithHttpMessagesAsync(string returnUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("returnUrl", returnUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SignInCallback", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "externalsignin/callback").ToString(); List _queryParameters = new List(); if (returnUrl != null) { _queryParameters.Add(string.Format("returnUrl={0}", System.Uri.EscapeDataString(returnUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetExternalLoginProvidersWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetExternalLoginProviders", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "externalsignin/providers").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// ExternalSignIn operations. /// public partial interface IExternalSignIn { /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SignInWithHttpMessagesAsync(string authenticationType = default(string), string returnUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SignOutWithHttpMessagesAsync(string authenticationType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SignInCallbackWithHttpMessagesAsync(string returnUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetExternalLoginProvidersWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for ExternalSignIn. /// public static partial class ExternalSignInExtensions { /// /// The operations group for this extension method. /// /// /// /// /// public static void SignIn(this IExternalSignIn operations, string authenticationType = default(string), string returnUrl = default(string)) { operations.SignInAsync(authenticationType, returnUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task SignInAsync(this IExternalSignIn operations, string authenticationType = default(string), string returnUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SignInWithHttpMessagesAsync(authenticationType, returnUrl, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void SignOut(this IExternalSignIn operations, string authenticationType = default(string)) { operations.SignOutAsync(authenticationType).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SignOutAsync(this IExternalSignIn operations, string authenticationType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SignOutWithHttpMessagesAsync(authenticationType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void SignInCallback(this IExternalSignIn operations, string returnUrl = default(string)) { operations.SignInCallbackAsync(returnUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SignInCallbackAsync(this IExternalSignIn operations, string returnUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SignInCallbackWithHttpMessagesAsync(returnUrl, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// public static IList GetExternalLoginProviders(this IExternalSignIn operations) { return operations.GetExternalLoginProvidersAsync().GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetExternalLoginProvidersAsync(this IExternalSignIn operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetExternalLoginProvidersWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Apps operations. /// public partial class Apps : IServiceOperations, IApps { /// /// Initializes a new instance of the Apps class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Apps(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Gets the list of available apps, filtered by user permissions. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetAppsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetApps", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/apps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Apps operations. /// public partial interface IApps { /// /// Gets the list of available apps, filtered by user permissions. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetAppsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Apps. /// public static partial class AppsExtensions { /// /// Gets the list of available apps, filtered by user permissions. /// /// /// The operations group for this extension method. /// public static IList GetApps(this IApps operations) { return operations.GetAppsAsync().GetAwaiter().GetResult(); } /// /// Gets the list of available apps, filtered by user permissions. /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetAppsAsync(this IApps operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAppsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// ChangeLog operations. /// public partial class ChangeLog : IServiceOperations, IChangeLog { /// /// Initializes a new instance of the ChangeLog class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public ChangeLog(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Force set changes last modified date /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ForceChanges", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/force").ToString(); List _queryParameters = new List(); if (scope != null) { _queryParameters.Add(string.Format("Scope={0}", System.Uri.EscapeDataString(scope))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ResetPlatformCacheWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ResetPlatformCache", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform-cache/reset").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get last modified date for given scope /// Used for signal of what something changed and for cache invalidation in /// external platform clients /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetLastModifiedDate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/lastmodifieddate").ToString(); List _queryParameters = new List(); if (scope != null) { _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetChangedEntitiesWithHttpMessagesAsync(ChangedEntitiesRequest body = default(ChangedEntitiesRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetChangedEntities", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/changed-entities").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ResetChangedEntitiesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ResetChangedEntities", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/changed-entities/reset").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchChanges", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (type == null) { throw new ValidationException(ValidationRules.CannotBeNull, "type"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("type", type); tracingParameters.Add("start", start); tracingParameters.Add("end", end); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchTypeChangeHistory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/{type}/changes").ToString(); _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); List _queryParameters = new List(); if (start != null) { _queryParameters.Add(string.Format("start={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(start, Client.SerializationSettings).Trim('"')))); } if (end != null) { _queryParameters.Add(string.Format("end={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(end, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// ChangeLog operations. /// public partial interface IChangeLog { /// /// Force set changes last modified date /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ResetPlatformCacheWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get last modified date for given scope /// Used for signal of what something changed and for cache /// invalidation in external platform clients /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetChangedEntitiesWithHttpMessagesAsync(ChangedEntitiesRequest body = default(ChangedEntitiesRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ResetChangedEntitiesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for ChangeLog. /// public static partial class ChangeLogExtensions { /// /// Force set changes last modified date /// /// /// The operations group for this extension method. /// /// /// public static void ForceChanges(this IChangeLog operations, string scope = default(string)) { operations.ForceChangesAsync(scope).GetAwaiter().GetResult(); } /// /// Force set changes last modified date /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ForceChangesAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ForceChangesWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// public static void ResetPlatformCache(this IChangeLog operations) { operations.ResetPlatformCacheAsync().GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task ResetPlatformCacheAsync(this IChangeLog operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ResetPlatformCacheWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get last modified date for given scope /// Used for signal of what something changed and for cache invalidation in /// external platform clients /// /// /// The operations group for this extension method. /// /// /// public static LastModifiedResponse GetLastModifiedDate(this IChangeLog operations, string scope = default(string)) { return operations.GetLastModifiedDateAsync(scope).GetAwaiter().GetResult(); } /// /// Get last modified date for given scope /// Used for signal of what something changed and for cache invalidation in /// external platform clients /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetLastModifiedDateAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetLastModifiedDateWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static ChangedEntitiesResponse GetChangedEntities(this IChangeLog operations, ChangedEntitiesRequest body = default(ChangedEntitiesRequest)) { return operations.GetChangedEntitiesAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetChangedEntitiesAsync(this IChangeLog operations, ChangedEntitiesRequest body = default(ChangedEntitiesRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetChangedEntitiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static void ResetChangedEntities(this IChangeLog operations, IList body = default(IList)) { operations.ResetChangedEntitiesAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ResetChangedEntitiesAsync(this IChangeLog operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ResetChangedEntitiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static ChangeLogSearchResult SearchChanges(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria)) { return operations.SearchChangesAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchChangesAsync(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static IList SearchTypeChangeHistory(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) { return operations.SearchTypeChangeHistoryAsync(type, start, end).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task> SearchTypeChangeHistoryAsync(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchTypeChangeHistoryWithHttpMessagesAsync(type, start, end, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Diagnostics operations. /// public partial class Diagnostics : IServiceOperations, IDiagnostics { /// /// Initializes a new instance of the Diagnostics class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Diagnostics(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSystemInfo", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/diagnostics/systeminfo").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get installed modules with errors /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetModulesErrorsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetModulesErrors", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/diagnostics/errors").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Diagnostics operations. /// public partial interface IDiagnostics { /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get installed modules with errors /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetModulesErrorsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Diagnostics. /// public static partial class DiagnosticsExtensions { /// /// The operations group for this extension method. /// public static SystemInfo GetSystemInfo(this IDiagnostics operations) { return operations.GetSystemInfoAsync().GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetSystemInfoAsync(this IDiagnostics operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSystemInfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get installed modules with errors /// /// /// The operations group for this extension method. /// public static IList GetModulesErrors(this IDiagnostics operations) { return operations.GetModulesErrorsAsync().GetAwaiter().GetResult(); } /// /// Get installed modules with errors /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetModulesErrorsAsync(this IDiagnostics operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetModulesErrorsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// DynamicProperties operations. /// public partial class DynamicProperties : IServiceOperations, IDynamicProperties { /// /// Initializes a new instance of the DynamicProperties class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public DynamicProperties(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Get object types which support dynamic properties /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetObjectTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/types").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get dynamic properties registered for object type /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchDynamicProperties", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Add new dynamic property /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreatePropertyAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update existing dynamic property /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdatePropertyAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete dynamic property /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("propertyIds", propertyIds); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeletePropertyAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); List _queryParameters = new List(); if (propertyIds != null) { _queryParameters.Add(string.Format("propertyIds={0}", System.Uri.EscapeDataString(string.Join(",", propertyIds)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ExposeDynamicObjectProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get dictionary items /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchDictionaryItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Add or update dictionary items /// /// /// Fill item ID to update existing item or leave it empty to create a new /// item. /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveDictionaryItemsAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete dictionary items /// /// /// IDs of dictionary items to delete. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteDictionaryItemAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// DynamicProperties operations. /// public partial interface IDynamicProperties { /// /// Get object types which support dynamic properties /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get dynamic properties registered for object type /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Add new dynamic property /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update existing dynamic property /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete dynamic property /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Does nothing. Just a way to expose DynamicObjectProperty thru /// Swagger. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get dictionary items /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Add or update dictionary items /// /// /// Fill item ID to update existing item or leave it empty to create a /// new item. /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete dictionary items /// /// /// IDs of dictionary items to delete. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for DynamicProperties. /// public static partial class DynamicPropertiesExtensions { /// /// Get object types which support dynamic properties /// /// /// The operations group for this extension method. /// public static IList GetObjectTypes(this IDynamicProperties operations) { return operations.GetObjectTypesAsync().GetAwaiter().GetResult(); } /// /// Get object types which support dynamic properties /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetObjectTypesAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetObjectTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get dynamic properties registered for object type /// /// /// The operations group for this extension method. /// /// /// public static DynamicPropertySearchResult SearchDynamicProperties(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria)) { return operations.SearchDynamicPropertiesAsync(body).GetAwaiter().GetResult(); } /// /// Get dynamic properties registered for object type /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchDynamicPropertiesAsync(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchDynamicPropertiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Add new dynamic property /// /// /// The operations group for this extension method. /// /// /// public static DynamicProperty CreatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) { return operations.CreatePropertyAsyncAsync(body).GetAwaiter().GetResult(); } /// /// Add new dynamic property /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CreatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update existing dynamic property /// /// /// The operations group for this extension method. /// /// /// public static void UpdatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) { operations.UpdatePropertyAsyncAsync(body).GetAwaiter().GetResult(); } /// /// Update existing dynamic property /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete dynamic property /// /// /// The operations group for this extension method. /// /// /// public static void DeletePropertyAsync(this IDynamicProperties operations, IList propertyIds = default(IList)) { operations.DeletePropertyAsyncAsync(propertyIds).GetAwaiter().GetResult(); } /// /// Delete dynamic property /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task DeletePropertyAsyncAsync(this IDynamicProperties operations, IList propertyIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeletePropertyAsyncWithHttpMessagesAsync(propertyIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. /// /// /// The operations group for this extension method. /// public static DynamicObjectProperty ExposeDynamicObjectProperty(this IDynamicProperties operations) { return operations.ExposeDynamicObjectPropertyAsync().GetAwaiter().GetResult(); } /// /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task ExposeDynamicObjectPropertyAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ExposeDynamicObjectPropertyWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get dictionary items /// /// /// The operations group for this extension method. /// /// /// public static DynamicPropertyDictionaryItemSearchResult SearchDictionaryItems(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria)) { return operations.SearchDictionaryItemsAsync(body).GetAwaiter().GetResult(); } /// /// Get dictionary items /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchDictionaryItemsAsync(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchDictionaryItemsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Add or update dictionary items /// /// /// Fill item ID to update existing item or leave it empty to create a new /// item. /// /// /// The operations group for this extension method. /// /// /// public static void SaveDictionaryItemsAsync(this IDynamicProperties operations, IList body = default(IList)) { operations.SaveDictionaryItemsAsyncAsync(body).GetAwaiter().GetResult(); } /// /// Add or update dictionary items /// /// /// Fill item ID to update existing item or leave it empty to create a new /// item. /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SaveDictionaryItemsAsyncAsync(this IDynamicProperties operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SaveDictionaryItemsAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete dictionary items /// /// /// The operations group for this extension method. /// /// /// IDs of dictionary items to delete. /// public static void DeleteDictionaryItemAsync(this IDynamicProperties operations, IList ids = default(IList)) { operations.DeleteDictionaryItemAsyncAsync(ids).GetAwaiter().GetResult(); } /// /// Delete dictionary items /// /// /// The operations group for this extension method. /// /// /// IDs of dictionary items to delete. /// /// /// The cancellation token. /// public static async Task DeleteDictionaryItemAsyncAsync(this IDynamicProperties operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteDictionaryItemAsyncWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Jobs operations. /// public partial class Jobs : IServiceOperations, IJobs { /// /// Initializes a new instance of the Jobs class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Jobs(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Get background job status /// /// /// Job ID. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetStatus", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/jobs/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Jobs operations. /// public partial interface IJobs { /// /// Get background job status /// /// /// Job ID. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Jobs. /// public static partial class JobsExtensions { /// /// Get background job status /// /// /// The operations group for this extension method. /// /// /// Job ID. /// public static Job GetStatus(this IJobs operations, string id) { return operations.GetStatusAsync(id).GetAwaiter().GetResult(); } /// /// Get background job status /// /// /// The operations group for this extension method. /// /// /// Job ID. /// /// /// The cancellation token. /// public static async Task GetStatusAsync(this IJobs operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetStatusWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Modules operations. /// public partial class Modules : IServiceOperations, IModules { /// /// Initializes a new instance of the Modules class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Modules(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Reload modules /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ReloadModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/reload").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get installed modules /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get all dependent modules for module /// /// /// modules descriptors /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetDependingModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getdependents").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Returns a flat expanded list of modules that depend on passed modules /// /// /// modules descriptors /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetMissingDependencies", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getmissingdependencies").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Upload module package for installation or update /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UploadModuleArchive", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/localstorage").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Install modules /// /// /// modules for install /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "InstallModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/install").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Uninstall module /// /// /// modules /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UninstallModule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/uninstall").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Restart web application /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Restart", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/restart").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Auto-install modules with specified groups /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "TryToAutoInstallModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/autoinstall").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Modules operations. /// public partial interface IModules { /// /// Reload modules /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get installed modules /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all dependent modules for module /// /// /// modules descriptors /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns a flat expanded list of modules that depend on passed /// modules /// /// /// modules descriptors /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Upload module package for installation or update /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Install modules /// /// /// modules for install /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Uninstall module /// /// /// modules /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Restart web application /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Auto-install modules with specified groups /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Modules. /// public static partial class ModulesExtensions { /// /// Reload modules /// /// /// The operations group for this extension method. /// public static void ReloadModules(this IModules operations) { operations.ReloadModulesAsync().GetAwaiter().GetResult(); } /// /// Reload modules /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task ReloadModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ReloadModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get installed modules /// /// /// The operations group for this extension method. /// public static IList GetModules(this IModules operations) { return operations.GetModulesAsync().GetAwaiter().GetResult(); } /// /// Get installed modules /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get all dependent modules for module /// /// /// The operations group for this extension method. /// /// /// modules descriptors /// public static IList GetDependingModules(this IModules operations, IList body = default(IList)) { return operations.GetDependingModulesAsync(body).GetAwaiter().GetResult(); } /// /// Get all dependent modules for module /// /// /// The operations group for this extension method. /// /// /// modules descriptors /// /// /// The cancellation token. /// public static async Task> GetDependingModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDependingModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Returns a flat expanded list of modules that depend on passed modules /// /// /// The operations group for this extension method. /// /// /// modules descriptors /// public static IList GetMissingDependencies(this IModules operations, IList body = default(IList)) { return operations.GetMissingDependenciesAsync(body).GetAwaiter().GetResult(); } /// /// Returns a flat expanded list of modules that depend on passed modules /// /// /// The operations group for this extension method. /// /// /// modules descriptors /// /// /// The cancellation token. /// public static async Task> GetMissingDependenciesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMissingDependenciesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Upload module package for installation or update /// /// /// The operations group for this extension method. /// public static ModuleDescriptor UploadModuleArchive(this IModules operations) { return operations.UploadModuleArchiveAsync().GetAwaiter().GetResult(); } /// /// Upload module package for installation or update /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task UploadModuleArchiveAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UploadModuleArchiveWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Install modules /// /// /// The operations group for this extension method. /// /// /// modules for install /// public static ModulePushNotification InstallModules(this IModules operations, IList body = default(IList)) { return operations.InstallModulesAsync(body).GetAwaiter().GetResult(); } /// /// Install modules /// /// /// The operations group for this extension method. /// /// /// modules for install /// /// /// The cancellation token. /// public static async Task InstallModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.InstallModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Uninstall module /// /// /// The operations group for this extension method. /// /// /// modules /// public static ModulePushNotification UninstallModule(this IModules operations, IList body = default(IList)) { return operations.UninstallModuleAsync(body).GetAwaiter().GetResult(); } /// /// Uninstall module /// /// /// The operations group for this extension method. /// /// /// modules /// /// /// The cancellation token. /// public static async Task UninstallModuleAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UninstallModuleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Restart web application /// /// /// The operations group for this extension method. /// public static void Restart(this IModules operations) { operations.RestartAsync().GetAwaiter().GetResult(); } /// /// Restart web application /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task RestartAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.RestartWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Auto-install modules with specified groups /// /// /// The operations group for this extension method. /// public static ModuleAutoInstallPushNotification TryToAutoInstallModules(this IModules operations) { return operations.TryToAutoInstallModulesAsync().GetAwaiter().GetResult(); } /// /// Auto-install modules with specified groups /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task TryToAutoInstallModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.TryToAutoInstallModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// OAuthApps operations. /// public partial class OAuthApps : IServiceOperations, IOAuthApps { /// /// Initializes a new instance of the OAuthApps class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public OAuthApps(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "NewOperation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/new").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("clientIds", clientIds); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); List _queryParameters = new List(); if (clientIds != null) { _queryParameters.Add(string.Format("clientIds={0}", System.Uri.EscapeDataString(string.Join(",", clientIds)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// OAuthApps operations. /// public partial interface IOAuthApps { /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for OAuthApps. /// public static partial class OAuthAppsExtensions { /// /// The operations group for this extension method. /// public static OpenIddictApplicationDescriptor NewOperation(this IOAuthApps operations) { return operations.NewOperationAsync().GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task NewOperationAsync(this IOAuthApps operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.NewOperationWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static OpenIddictApplicationDescriptor SaveAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor)) { return operations.SaveAsyncAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SaveAsyncAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SaveAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static void DeleteAsync(this IOAuthApps operations, IList clientIds = default(IList)) { operations.DeleteAsyncAsync(clientIds).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task DeleteAsyncAsync(this IOAuthApps operations, IList clientIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteAsyncWithHttpMessagesAsync(clientIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static OAuthAppSearchResult SearchAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria)) { return operations.SearchAsyncAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchAsyncAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// PushNotificationOperations operations. /// public partial class PushNotificationOperations : IServiceOperations, IPushNotificationOperations { /// /// Initializes a new instance of the PushNotificationOperations class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public PushNotificationOperations(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// SearchAsync push notifications /// /// /// SearchAsync parameters. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchPushNotificationWithHttpMessagesAsync(PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchPushNotification", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Mark all notifications as read /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "MarkAllAsRead", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications/markAllAsRead").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// PushNotificationOperations operations. /// public partial interface IPushNotificationOperations { /// /// SearchAsync push notifications /// /// /// SearchAsync parameters. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchPushNotificationWithHttpMessagesAsync(PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Mark all notifications as read /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for PushNotificationOperations. /// public static partial class PushNotificationOperationsExtensions { /// /// SearchAsync push notifications /// /// /// The operations group for this extension method. /// /// /// SearchAsync parameters. /// public static PushNotificationSearchResult SearchPushNotification(this IPushNotificationOperations operations, PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria)) { return operations.SearchPushNotificationAsync(body).GetAwaiter().GetResult(); } /// /// SearchAsync push notifications /// /// /// The operations group for this extension method. /// /// /// SearchAsync parameters. /// /// /// The cancellation token. /// public static async Task SearchPushNotificationAsync(this IPushNotificationOperations operations, PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchPushNotificationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Mark all notifications as read /// /// /// The operations group for this extension method. /// public static PushNotificationSearchResult MarkAllAsRead(this IPushNotificationOperations operations) { return operations.MarkAllAsReadAsync().GetAwaiter().GetResult(); } /// /// Mark all notifications as read /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task MarkAllAsReadAsync(this IPushNotificationOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.MarkAllAsReadWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Security operations. /// public partial class Security : IServiceOperations, ISecurity { /// /// Initializes a new instance of the Security class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Security(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Sign in with user name and password /// /// /// Verifies provided credentials and if succeeded returns full user details, /// otherwise returns 401 Unauthorized. /// /// /// Login request. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> LoginWithHttpMessagesAsync(LoginRequest body = default(LoginRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Login", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/login").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Sign out /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task LogoutWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Logout", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/logout").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get current user details /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetCurrentUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> UserinfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Userinfo", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/userinfo").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get all registered permissions /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetAllRegisteredPermissionsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAllRegisteredPermissions", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/permissions").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// SearchAsync roles by keyword /// /// /// SearchAsync parameters. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchRolesWithHttpMessagesAsync(RoleSearchCriteria body = default(RoleSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchRoles", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get role by ID /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetRoleWithHttpMessagesAsync(string roleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (roleName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("roleName", roleName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetRole", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/{roleName}").ToString(); _url = _url.Replace("{roleName}", System.Uri.EscapeDataString(roleName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete roles by ID /// /// /// An array of role IDs. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteRolesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteRoles", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update an existing role or create new /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> UpdateRoleWithHttpMessagesAsync(Role body = default(Role), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateRole", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// SearchAsync users by keyword /// /// /// Search criteria. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchUsersWithHttpMessagesAsync(UserSearchCriteria body = default(UserSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchUsers", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get user details by user name /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserByName", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}").ToString(); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get user details by user ID /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/id/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get user details by user email /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (email == null) { throw new ValidationException(ValidationRules.CannotBeNull, "email"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("email", email); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserByEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/email/{email}").ToString(); _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get user details by external login provider /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (loginProvider == null) { throw new ValidationException(ValidationRules.CannotBeNull, "loginProvider"); } if (providerKey == null) { throw new ValidationException(ValidationRules.CannotBeNull, "providerKey"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("loginProvider", loginProvider); tracingParameters.Add("providerKey", providerKey); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserByLogin", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/login/external/{loginProvider}/{providerKey}").ToString(); _url = _url.Replace("{loginProvider}", System.Uri.EscapeDataString(loginProvider)); _url = _url.Replace("{providerKey}", System.Uri.EscapeDataString(providerKey)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create new user /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/create").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Change password for current user. /// /// /// Old and new passwords. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ChangeCurrentUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ChangeCurrentUserPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser/changepassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Change password /// /// /// user name /// /// /// Old and new passwords. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ChangePassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/changepassword").ToString(); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Reset password confirmation /// /// /// /// /// Password reset information containing new password. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ResetPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/resetpassword").ToString(); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Reset password confirmation /// /// /// /// /// New password. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ResetPasswordByToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/resetpasswordconfirm").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Validate password reset token /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ValidatePasswordResetToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/validatepasswordresettoken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Send email with instructions on how to reset user password. /// /// /// Verifies provided userName and (if succeeded) sends email. /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (loginOrEmail == null) { throw new ValidationException(ValidationRules.CannotBeNull, "loginOrEmail"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("loginOrEmail", loginOrEmail); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RequestPasswordReset", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{loginOrEmail}/requestpasswordreset").ToString(); _url = _url.Replace("{loginOrEmail}", System.Uri.EscapeDataString(loginOrEmail)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ValidatePassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/validatepassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> ValidateUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ValidateUserPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/validateuserpassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update user details by user ID /// /// /// User details. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete users by name /// /// /// An array of user names. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("names", names); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); List _queryParameters = new List(); if (names != null) { _queryParameters.Add(string.Format("names={0}", System.Uri.EscapeDataString(string.Join(",", names)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Checks if user locked /// /// /// User id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "IsUserLocked", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/locked").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Checks if manual password change is enabled /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> PasswordChangeEnabledWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "PasswordChangeEnabled", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/passwordchangeenabled").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Lock user /// /// /// >User id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "LockUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/lock").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Unlock user /// /// /// >User id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UnlockUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/unlock").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserApiKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/apikeys").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SaveUserApiKey", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateUserApiKey", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteUserApiKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get allowed login types /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetLoginTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetLoginTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/logintypes").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Verify user email /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task SendVerificationEmailWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SendVerificationEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/sendVerificationEmail").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> ConfirmEmailWithHttpMessagesAsync(string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ConfirmEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/confirmEmail").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GenerateChangeEmailTokenWithHttpMessagesAsync(string userId, string newEmail = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("newEmail", newEmail); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateChangeEmailToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateChangeEmailToken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); List _queryParameters = new List(); if (newEmail != null) { _queryParameters.Add(string.Format("newEmail={0}", System.Uri.EscapeDataString(newEmail))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GenerateEmailConfirmationTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateEmailConfirmationToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateEmailConfirmationToken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GeneratePasswordResetTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GeneratePasswordResetToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generatePasswordResetToken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GenerateUserTokenWithHttpMessagesAsync(string userId, string tokenProvider = default(string), string purpose = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("tokenProvider", tokenProvider); tracingParameters.Add("purpose", purpose); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateUserToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateToken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); List _queryParameters = new List(); if (tokenProvider != null) { _queryParameters.Add(string.Format("tokenProvider={0}", System.Uri.EscapeDataString(tokenProvider))); } if (purpose != null) { _queryParameters.Add(string.Format("purpose={0}", System.Uri.EscapeDataString(purpose))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> VerifyUserTokenWithHttpMessagesAsync(string userId, VerifyTokenRequest body = default(VerifyTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "VerifyUserToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/verifyToken").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Security operations. /// public partial interface ISecurity { /// /// Sign in with user name and password /// /// /// Verifies provided credentials and if succeeded returns full user /// details, otherwise returns 401 Unauthorized. /// /// /// Login request. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> LoginWithHttpMessagesAsync(LoginRequest body = default(LoginRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Sign out /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task LogoutWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get current user details /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> UserinfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all registered permissions /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetAllRegisteredPermissionsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// SearchAsync roles by keyword /// /// /// SearchAsync parameters. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchRolesWithHttpMessagesAsync(RoleSearchCriteria body = default(RoleSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get role by ID /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetRoleWithHttpMessagesAsync(string roleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete roles by ID /// /// /// An array of role IDs. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteRolesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update an existing role or create new /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> UpdateRoleWithHttpMessagesAsync(Role body = default(Role), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// SearchAsync users by keyword /// /// /// Search criteria. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchUsersWithHttpMessagesAsync(UserSearchCriteria body = default(UserSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get user details by user name /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get user details by user ID /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get user details by user email /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get user details by external login provider /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create new user /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Change password for current user. /// /// /// Old and new passwords. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ChangeCurrentUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Change password /// /// /// user name /// /// /// Old and new passwords. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Reset password confirmation /// /// /// /// /// Password reset information containing new password. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Reset password confirmation /// /// /// /// /// New password. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Validate password reset token /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send email with instructions on how to reset user password. /// /// /// Verifies provided userName and (if succeeded) sends email. /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> ValidateUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update user details by user ID /// /// /// User details. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete users by name /// /// /// An array of user names. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks if user locked /// /// /// User id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks if manual password change is enabled /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> PasswordChangeEnabledWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lock user /// /// /// >User id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Unlock user /// /// /// >User id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get allowed login types /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetLoginTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Verify user email /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task SendVerificationEmailWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> ConfirmEmailWithHttpMessagesAsync(string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GenerateChangeEmailTokenWithHttpMessagesAsync(string userId, string newEmail = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GenerateEmailConfirmationTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GeneratePasswordResetTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GenerateUserTokenWithHttpMessagesAsync(string userId, string tokenProvider = default(string), string purpose = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> VerifyUserTokenWithHttpMessagesAsync(string userId, VerifyTokenRequest body = default(VerifyTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Security. /// public static partial class SecurityExtensions { /// /// Sign in with user name and password /// /// /// Verifies provided credentials and if succeeded returns full user details, /// otherwise returns 401 Unauthorized. /// /// /// The operations group for this extension method. /// /// /// Login request. /// public static SignInResult Login(this ISecurity operations, LoginRequest body = default(LoginRequest)) { return operations.LoginAsync(body).GetAwaiter().GetResult(); } /// /// Sign in with user name and password /// /// /// Verifies provided credentials and if succeeded returns full user details, /// otherwise returns 401 Unauthorized. /// /// /// The operations group for this extension method. /// /// /// Login request. /// /// /// The cancellation token. /// public static async Task LoginAsync(this ISecurity operations, LoginRequest body = default(LoginRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.LoginWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Sign out /// /// /// The operations group for this extension method. /// public static void Logout(this ISecurity operations) { operations.LogoutAsync().GetAwaiter().GetResult(); } /// /// Sign out /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task LogoutAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.LogoutWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get current user details /// /// /// The operations group for this extension method. /// public static UserDetail GetCurrentUser(this ISecurity operations) { return operations.GetCurrentUserAsync().GetAwaiter().GetResult(); } /// /// Get current user details /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetCurrentUserAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetCurrentUserWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// public static IList Userinfo(this ISecurity operations) { return operations.UserinfoAsync().GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> UserinfoAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UserinfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get all registered permissions /// /// /// The operations group for this extension method. /// public static IList GetAllRegisteredPermissions(this ISecurity operations) { return operations.GetAllRegisteredPermissionsAsync().GetAwaiter().GetResult(); } /// /// Get all registered permissions /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetAllRegisteredPermissionsAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllRegisteredPermissionsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// SearchAsync roles by keyword /// /// /// The operations group for this extension method. /// /// /// SearchAsync parameters. /// public static RoleSearchResult SearchRoles(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria)) { return operations.SearchRolesAsync(body).GetAwaiter().GetResult(); } /// /// SearchAsync roles by keyword /// /// /// The operations group for this extension method. /// /// /// SearchAsync parameters. /// /// /// The cancellation token. /// public static async Task SearchRolesAsync(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchRolesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get role by ID /// /// /// The operations group for this extension method. /// /// /// public static Role GetRole(this ISecurity operations, string roleName) { return operations.GetRoleAsync(roleName).GetAwaiter().GetResult(); } /// /// Get role by ID /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetRoleAsync(this ISecurity operations, string roleName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetRoleWithHttpMessagesAsync(roleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Delete roles by ID /// /// /// The operations group for this extension method. /// /// /// An array of role IDs. /// public static void DeleteRoles(this ISecurity operations, IList ids = default(IList)) { operations.DeleteRolesAsync(ids).GetAwaiter().GetResult(); } /// /// Delete roles by ID /// /// /// The operations group for this extension method. /// /// /// An array of role IDs. /// /// /// The cancellation token. /// public static async Task DeleteRolesAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteRolesWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Update an existing role or create new /// /// /// The operations group for this extension method. /// /// /// public static SecurityResult UpdateRole(this ISecurity operations, Role body = default(Role)) { return operations.UpdateRoleAsync(body).GetAwaiter().GetResult(); } /// /// Update an existing role or create new /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdateRoleAsync(this ISecurity operations, Role body = default(Role), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateRoleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// SearchAsync users by keyword /// /// /// The operations group for this extension method. /// /// /// Search criteria. /// public static UserSearchResult SearchUsers(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria)) { return operations.SearchUsersAsync(body).GetAwaiter().GetResult(); } /// /// SearchAsync users by keyword /// /// /// The operations group for this extension method. /// /// /// Search criteria. /// /// /// The cancellation token. /// public static async Task SearchUsersAsync(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchUsersWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get user details by user name /// /// /// The operations group for this extension method. /// /// /// public static ApplicationUser GetUserByName(this ISecurity operations, string userName) { return operations.GetUserByNameAsync(userName).GetAwaiter().GetResult(); } /// /// Get user details by user name /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetUserByNameAsync(this ISecurity operations, string userName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserByNameWithHttpMessagesAsync(userName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get user details by user ID /// /// /// The operations group for this extension method. /// /// /// public static ApplicationUser GetUserById(this ISecurity operations, string id) { return operations.GetUserByIdAsync(id).GetAwaiter().GetResult(); } /// /// Get user details by user ID /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetUserByIdAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get user details by user email /// /// /// The operations group for this extension method. /// /// /// public static ApplicationUser GetUserByEmail(this ISecurity operations, string email) { return operations.GetUserByEmailAsync(email).GetAwaiter().GetResult(); } /// /// Get user details by user email /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetUserByEmailAsync(this ISecurity operations, string email, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserByEmailWithHttpMessagesAsync(email, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get user details by external login provider /// /// /// The operations group for this extension method. /// /// /// /// /// public static ApplicationUser GetUserByLogin(this ISecurity operations, string loginProvider, string providerKey) { return operations.GetUserByLoginAsync(loginProvider, providerKey).GetAwaiter().GetResult(); } /// /// Get user details by external login provider /// /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task GetUserByLoginAsync(this ISecurity operations, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserByLoginWithHttpMessagesAsync(loginProvider, providerKey, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create new user /// /// /// The operations group for this extension method. /// /// /// public static SecurityResult Create(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) { return operations.CreateAsync(body).GetAwaiter().GetResult(); } /// /// Create new user /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task CreateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Change password for current user. /// /// /// The operations group for this extension method. /// /// /// Old and new passwords. /// public static SecurityResult ChangeCurrentUserPassword(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest)) { return operations.ChangeCurrentUserPasswordAsync(body).GetAwaiter().GetResult(); } /// /// Change password for current user. /// /// /// The operations group for this extension method. /// /// /// Old and new passwords. /// /// /// The cancellation token. /// public static async Task ChangeCurrentUserPasswordAsync(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ChangeCurrentUserPasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Change password /// /// /// The operations group for this extension method. /// /// /// user name /// /// /// Old and new passwords. /// public static SecurityResult ChangePassword(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest)) { return operations.ChangePasswordAsync(userName, body).GetAwaiter().GetResult(); } /// /// Change password /// /// /// The operations group for this extension method. /// /// /// user name /// /// /// Old and new passwords. /// /// /// The cancellation token. /// public static async Task ChangePasswordAsync(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ChangePasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Reset password confirmation /// /// /// The operations group for this extension method. /// /// /// /// /// Password reset information containing new password. /// public static SecurityResult ResetPassword(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) { return operations.ResetPasswordAsync(userName, body).GetAwaiter().GetResult(); } /// /// Reset password confirmation /// /// /// The operations group for this extension method. /// /// /// /// /// Password reset information containing new password. /// /// /// The cancellation token. /// public static async Task ResetPasswordAsync(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ResetPasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Reset password confirmation /// /// /// The operations group for this extension method. /// /// /// /// /// New password. /// public static SecurityResult ResetPasswordByToken(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) { return operations.ResetPasswordByTokenAsync(userId, body).GetAwaiter().GetResult(); } /// /// Reset password confirmation /// /// /// The operations group for this extension method. /// /// /// /// /// New password. /// /// /// The cancellation token. /// public static async Task ResetPasswordByTokenAsync(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ResetPasswordByTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Validate password reset token /// /// /// The operations group for this extension method. /// /// /// /// /// public static bool? ValidatePasswordResetToken(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest)) { return operations.ValidatePasswordResetTokenAsync(userId, body).GetAwaiter().GetResult(); } /// /// Validate password reset token /// /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task ValidatePasswordResetTokenAsync(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ValidatePasswordResetTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Send email with instructions on how to reset user password. /// /// /// Verifies provided userName and (if succeeded) sends email. /// /// /// The operations group for this extension method. /// /// /// public static void RequestPasswordReset(this ISecurity operations, string loginOrEmail) { operations.RequestPasswordResetAsync(loginOrEmail).GetAwaiter().GetResult(); } /// /// Send email with instructions on how to reset user password. /// /// /// Verifies provided userName and (if succeeded) sends email. /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task RequestPasswordResetAsync(this ISecurity operations, string loginOrEmail, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.RequestPasswordResetWithHttpMessagesAsync(loginOrEmail, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static IdentityResult ValidatePassword(this ISecurity operations, string body = default(string)) { return operations.ValidatePasswordAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ValidatePasswordAsync(this ISecurity operations, string body = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ValidatePasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static IdentityResult ValidateUserPassword(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest)) { return operations.ValidateUserPasswordAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task ValidateUserPasswordAsync(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ValidateUserPasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update user details by user ID /// /// /// The operations group for this extension method. /// /// /// User details. /// public static SecurityResult Update(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) { return operations.UpdateAsync(body).GetAwaiter().GetResult(); } /// /// Update user details by user ID /// /// /// The operations group for this extension method. /// /// /// User details. /// /// /// The cancellation token. /// public static async Task UpdateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Delete users by name /// /// /// The operations group for this extension method. /// /// /// An array of user names. /// public static void Delete(this ISecurity operations, IList names = default(IList)) { operations.DeleteAsync(names).GetAwaiter().GetResult(); } /// /// Delete users by name /// /// /// The operations group for this extension method. /// /// /// An array of user names. /// /// /// The cancellation token. /// public static async Task DeleteAsync(this ISecurity operations, IList names = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Checks if user locked /// /// /// The operations group for this extension method. /// /// /// User id /// public static UserLockedResult IsUserLocked(this ISecurity operations, string id) { return operations.IsUserLockedAsync(id).GetAwaiter().GetResult(); } /// /// Checks if user locked /// /// /// The operations group for this extension method. /// /// /// User id /// /// /// The cancellation token. /// public static async Task IsUserLockedAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.IsUserLockedWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Checks if manual password change is enabled /// /// /// The operations group for this extension method. /// public static UserLockedResult PasswordChangeEnabled(this ISecurity operations) { return operations.PasswordChangeEnabledAsync().GetAwaiter().GetResult(); } /// /// Checks if manual password change is enabled /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task PasswordChangeEnabledAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PasswordChangeEnabledWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Lock user /// /// /// The operations group for this extension method. /// /// /// >User id /// public static SecurityResult LockUser(this ISecurity operations, string id) { return operations.LockUserAsync(id).GetAwaiter().GetResult(); } /// /// Lock user /// /// /// The operations group for this extension method. /// /// /// >User id /// /// /// The cancellation token. /// public static async Task LockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.LockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Unlock user /// /// /// The operations group for this extension method. /// /// /// >User id /// public static SecurityResult UnlockUser(this ISecurity operations, string id) { return operations.UnlockUserAsync(id).GetAwaiter().GetResult(); } /// /// Unlock user /// /// /// The operations group for this extension method. /// /// /// >User id /// /// /// The cancellation token. /// public static async Task UnlockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UnlockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static IList GetUserApiKeys(this ISecurity operations, string id) { return operations.GetUserApiKeysAsync(id).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> GetUserApiKeysAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserApiKeysWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static IList SaveUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) { return operations.SaveUserApiKeyAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> SaveUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SaveUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static IList UpdateUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) { return operations.UpdateUserApiKeyAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> UpdateUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static IList DeleteUserApiKeys(this ISecurity operations, IList ids = default(IList)) { return operations.DeleteUserApiKeysAsync(ids).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> DeleteUserApiKeysAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteUserApiKeysWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get allowed login types /// /// /// The operations group for this extension method. /// public static IList GetLoginTypes(this ISecurity operations) { return operations.GetLoginTypesAsync().GetAwaiter().GetResult(); } /// /// Get allowed login types /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetLoginTypesAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetLoginTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Verify user email /// /// /// The operations group for this extension method. /// /// /// public static void SendVerificationEmail(this ISecurity operations, string userId) { operations.SendVerificationEmailAsync(userId).GetAwaiter().GetResult(); } /// /// Verify user email /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SendVerificationEmailAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SendVerificationEmailWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// /// /// public static SecurityResult ConfirmEmail(this ISecurity operations, string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest)) { return operations.ConfirmEmailAsync(userId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task ConfirmEmailAsync(this ISecurity operations, string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ConfirmEmailWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// public static string GenerateChangeEmailToken(this ISecurity operations, string userId, string newEmail = default(string)) { return operations.GenerateChangeEmailTokenAsync(userId, newEmail).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task GenerateChangeEmailTokenAsync(this ISecurity operations, string userId, string newEmail = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateChangeEmailTokenWithHttpMessagesAsync(userId, newEmail, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static string GenerateEmailConfirmationToken(this ISecurity operations, string userId) { return operations.GenerateEmailConfirmationTokenAsync(userId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GenerateEmailConfirmationTokenAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateEmailConfirmationTokenWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static string GeneratePasswordResetToken(this ISecurity operations, string userId) { return operations.GeneratePasswordResetTokenAsync(userId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GeneratePasswordResetTokenAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GeneratePasswordResetTokenWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static string GenerateUserToken(this ISecurity operations, string userId, string tokenProvider = default(string), string purpose = default(string)) { return operations.GenerateUserTokenAsync(userId, tokenProvider, purpose).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task GenerateUserTokenAsync(this ISecurity operations, string userId, string tokenProvider = default(string), string purpose = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateUserTokenWithHttpMessagesAsync(userId, tokenProvider, purpose, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// public static bool? VerifyUserToken(this ISecurity operations, string userId, VerifyTokenRequest body = default(VerifyTokenRequest)) { return operations.VerifyUserTokenAsync(userId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task VerifyUserTokenAsync(this ISecurity operations, string userId, VerifyTokenRequest body = default(VerifyTokenRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.VerifyUserTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Setting operations. /// public partial class Setting : IServiceOperations, ISetting { /// /// Initializes a new instance of the Setting class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public Setting(PlatformModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the PlatformModuleClient /// public PlatformModuleClient Client { get; private set; } /// /// Get all settings /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetAllGlobalSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAllGlobalSettings", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/settings").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update settings values /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/settings").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get settings registered by specific module /// /// /// Module ID. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetGlobalModuleSettingsAsyncWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetGlobalModuleSettingsAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/settings/modules/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get setting details by name /// /// /// Setting system name. /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetGlobalSettingAsyncWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetGlobalSettingAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/settings/{name}").ToString(); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get UI customization setting /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GetUICustomizationSettingWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUICustomizationSetting", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/settings/ui/customization").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Setting operations. /// public partial interface ISetting { /// /// Get all settings /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetAllGlobalSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update settings values /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get settings registered by specific module /// /// /// Module ID. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetGlobalModuleSettingsAsyncWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get setting details by name /// /// /// Setting system name. /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetGlobalSettingAsyncWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get UI customization setting /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GetUICustomizationSettingWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for Setting. /// public static partial class SettingExtensions { /// /// Get all settings /// /// /// The operations group for this extension method. /// public static ObjectSettingEntry GetAllGlobalSettings(this ISetting operations) { return operations.GetAllGlobalSettingsAsync().GetAwaiter().GetResult(); } /// /// Get all settings /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetAllGlobalSettingsAsync(this ISetting operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllGlobalSettingsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update settings values /// /// /// The operations group for this extension method. /// /// /// public static void UpdateAsync(this ISetting operations, IList body = default(IList)) { operations.UpdateAsyncAsync(body).GetAwaiter().GetResult(); } /// /// Update settings values /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdateAsyncAsync(this ISetting operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get settings registered by specific module /// /// /// The operations group for this extension method. /// /// /// Module ID. /// public static IList GetGlobalModuleSettingsAsync(this ISetting operations, string id) { return operations.GetGlobalModuleSettingsAsyncAsync(id).GetAwaiter().GetResult(); } /// /// Get settings registered by specific module /// /// /// The operations group for this extension method. /// /// /// Module ID. /// /// /// The cancellation token. /// public static async Task> GetGlobalModuleSettingsAsyncAsync(this ISetting operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetGlobalModuleSettingsAsyncWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get setting details by name /// /// /// The operations group for this extension method. /// /// /// Setting system name. /// public static ObjectSettingEntry GetGlobalSettingAsync(this ISetting operations, string name) { return operations.GetGlobalSettingAsyncAsync(name).GetAwaiter().GetResult(); } /// /// Get setting details by name /// /// /// The operations group for this extension method. /// /// /// Setting system name. /// /// /// The cancellation token. /// public static async Task GetGlobalSettingAsyncAsync(this ISetting operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetGlobalSettingAsyncWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get UI customization setting /// /// /// The operations group for this extension method. /// public static ObjectSettingEntry GetUICustomizationSetting(this ISetting operations) { return operations.GetUICustomizationSettingAsync().GetAwaiter().GetResult(); } /// /// Get UI customization setting /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task GetUICustomizationSettingAsync(this ISetting operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUICustomizationSettingWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema { /// /// Initializes a new instance of the /// Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema /// class. /// public Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema() { CustomInit(); } /// /// Initializes a new instance of the /// Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema /// class. /// public Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema(string grantType, string scope = default(string), string username = default(string), string password = default(string)) { GrantType = grantType; Scope = scope; Username = username; Password = password; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "grant_type")] public string GrantType { get; set; } /// /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } /// /// [JsonProperty(PropertyName = "username")] public string Username { get; set; } /// /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } /// /// Validate the object. /// /// /// Thrown if validation fails /// public virtual void Validate() { if (GrantType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "GrantType"); } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ExternalSignInProviderInfo { /// /// Initializes a new instance of the ExternalSignInProviderInfo class. /// public ExternalSignInProviderInfo() { CustomInit(); } /// /// Initializes a new instance of the ExternalSignInProviderInfo class. /// public ExternalSignInProviderInfo(string authenticationType = default(string), string displayName = default(string)) { AuthenticationType = authenticationType; DisplayName = displayName; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType { get; set; } /// /// [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class AppDescriptor { /// /// Initializes a new instance of the AppDescriptor class. /// public AppDescriptor() { CustomInit(); } /// /// Initializes a new instance of the AppDescriptor class. /// public AppDescriptor(string title = default(string), string description = default(string), string iconUrl = default(string), string relativeUrl = default(string), string permission = default(string), string id = default(string)) { Title = title; Description = description; IconUrl = iconUrl; RelativeUrl = relativeUrl; Permission = permission; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "relativeUrl")] public string RelativeUrl { get; set; } /// /// [JsonProperty(PropertyName = "permission")] public string Permission { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OperationLog { /// /// Initializes a new instance of the OperationLog class. /// public OperationLog() { CustomInit(); } /// /// Initializes a new instance of the OperationLog class. /// /// Possible values include: 'Detached', /// 'Unchanged', 'Added', 'Deleted', 'Modified' public OperationLog(string objectType = default(string), string objectId = default(string), string operationType = default(string), string detail = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ObjectType = objectType; ObjectId = objectId; OperationType = operationType; Detail = detail; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// Gets or sets possible values include: 'Detached', 'Unchanged', /// 'Added', 'Deleted', 'Modified' /// [JsonProperty(PropertyName = "operationType")] public string OperationType { get; set; } /// /// [JsonProperty(PropertyName = "detail")] public string Detail { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SemanticVersion { /// /// Initializes a new instance of the SemanticVersion class. /// public SemanticVersion() { CustomInit(); } /// /// Initializes a new instance of the SemanticVersion class. /// /// Major version X (X.y.z) /// Minor version Y (x.Y.z) /// Patch version Z (x.y.Z) public SemanticVersion(int? major = default(int?), int? minor = default(int?), int? patch = default(int?), string prerelease = default(string)) { Major = major; Minor = minor; Patch = patch; Prerelease = prerelease; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets major version X (X.y.z) /// [JsonProperty(PropertyName = "major")] public int? Major { get; private set; } /// /// Gets minor version Y (x.Y.z) /// [JsonProperty(PropertyName = "minor")] public int? Minor { get; private set; } /// /// Gets patch version Z (x.y.Z) /// [JsonProperty(PropertyName = "patch")] public int? Patch { get; private set; } /// /// [JsonProperty(PropertyName = "prerelease")] public string Prerelease { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ModuleIdentity { /// /// Initializes a new instance of the ModuleIdentity class. /// public ModuleIdentity() { CustomInit(); } /// /// Initializes a new instance of the ModuleIdentity class. /// public ModuleIdentity(string id = default(string), SemanticVersion version = default(SemanticVersion)) { Id = id; Version = version; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "version")] public SemanticVersion Version { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ModuleDescriptor { /// /// Initializes a new instance of the ModuleDescriptor class. /// public ModuleDescriptor() { CustomInit(); } /// /// Initializes a new instance of the ModuleDescriptor class. /// public ModuleDescriptor(string version = default(string), string platformVersion = default(string), string title = default(string), string description = default(string), IList authors = default(IList), IList owners = default(IList), string licenseUrl = default(string), string projectUrl = default(string), string iconUrl = default(string), bool? requireLicenseAcceptance = default(bool?), string releaseNotes = default(string), string copyright = default(string), string tags = default(string), IList groups = default(IList), IList dependencies = default(IList), IList validationErrors = default(IList), bool? isRemovable = default(bool?), bool? isInstalled = default(bool?), ModuleIdentity installedVersion = default(ModuleIdentity), string id = default(string)) { Version = version; PlatformVersion = platformVersion; Title = title; Description = description; Authors = authors; Owners = owners; LicenseUrl = licenseUrl; ProjectUrl = projectUrl; IconUrl = iconUrl; RequireLicenseAcceptance = requireLicenseAcceptance; ReleaseNotes = releaseNotes; Copyright = copyright; Tags = tags; Groups = groups; Dependencies = dependencies; ValidationErrors = validationErrors; IsRemovable = isRemovable; IsInstalled = isInstalled; InstalledVersion = installedVersion; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "version")] public string Version { get; set; } /// /// [JsonProperty(PropertyName = "platformVersion")] public string PlatformVersion { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "authors")] public IList Authors { get; set; } /// /// [JsonProperty(PropertyName = "owners")] public IList Owners { get; set; } /// /// [JsonProperty(PropertyName = "licenseUrl")] public string LicenseUrl { get; set; } /// /// [JsonProperty(PropertyName = "projectUrl")] public string ProjectUrl { get; set; } /// /// [JsonProperty(PropertyName = "iconUrl")] public string IconUrl { get; set; } /// /// [JsonProperty(PropertyName = "requireLicenseAcceptance")] public bool? RequireLicenseAcceptance { get; set; } /// /// [JsonProperty(PropertyName = "releaseNotes")] public string ReleaseNotes { get; set; } /// /// [JsonProperty(PropertyName = "copyright")] public string Copyright { get; set; } /// /// [JsonProperty(PropertyName = "tags")] public string Tags { get; set; } /// /// [JsonProperty(PropertyName = "groups")] public IList Groups { get; set; } /// /// [JsonProperty(PropertyName = "dependencies")] public IList Dependencies { get; set; } /// /// [JsonProperty(PropertyName = "validationErrors")] public IList ValidationErrors { get; set; } /// /// [JsonProperty(PropertyName = "isRemovable")] public bool? IsRemovable { get; set; } /// /// [JsonProperty(PropertyName = "isInstalled")] public bool? IsInstalled { get; set; } /// /// [JsonProperty(PropertyName = "installedVersion")] public ModuleIdentity InstalledVersion { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyDictionaryItemName { /// /// Initializes a new instance of the DynamicPropertyDictionaryItemName /// class. /// public DynamicPropertyDictionaryItemName() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyDictionaryItemName /// class. /// /// Language ID, e.g. en-US. public DynamicPropertyDictionaryItemName(string locale = default(string), string name = default(string)) { Locale = locale; Name = name; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets language ID, e.g. en-US. /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyDictionaryItem { /// /// Initializes a new instance of the DynamicPropertyDictionaryItem /// class. /// public DynamicPropertyDictionaryItem() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyDictionaryItem /// class. /// /// Item names for different /// languages. public DynamicPropertyDictionaryItem(string propertyId = default(string), string name = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { PropertyId = propertyId; Name = name; DisplayNames = displayNames; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets item names for different languages. /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ClaimsIdentity { /// /// Initializes a new instance of the ClaimsIdentity class. /// public ClaimsIdentity() { CustomInit(); } /// /// Initializes a new instance of the ClaimsIdentity class. /// public ClaimsIdentity(string authenticationType = default(string), bool? isAuthenticated = default(bool?), ClaimsIdentity actor = default(ClaimsIdentity), object bootstrapContext = default(object), IList claims = default(IList), string label = default(string), string name = default(string), string nameClaimType = default(string), string roleClaimType = default(string)) { AuthenticationType = authenticationType; IsAuthenticated = isAuthenticated; Actor = actor; BootstrapContext = bootstrapContext; Claims = claims; Label = label; Name = name; NameClaimType = nameClaimType; RoleClaimType = roleClaimType; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType { get; set; } /// /// [JsonProperty(PropertyName = "isAuthenticated")] public bool? IsAuthenticated { get; private set; } /// /// [JsonProperty(PropertyName = "actor")] public ClaimsIdentity Actor { get; set; } /// /// [JsonProperty(PropertyName = "bootstrapContext")] public object BootstrapContext { get; set; } /// /// [JsonProperty(PropertyName = "claims")] public IList Claims { get; set; } /// /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// /// [JsonProperty(PropertyName = "nameClaimType")] public string NameClaimType { get; private set; } /// /// [JsonProperty(PropertyName = "roleClaimType")] public string RoleClaimType { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Claim { /// /// Initializes a new instance of the Claim class. /// public Claim() { CustomInit(); } /// /// Initializes a new instance of the Claim class. /// public Claim(string issuer = default(string), string originalIssuer = default(string), IDictionary properties = default(IDictionary), ClaimsIdentity subject = default(ClaimsIdentity), string type = default(string), string value = default(string), string valueType = default(string)) { Issuer = issuer; OriginalIssuer = originalIssuer; Properties = properties; Subject = subject; Type = type; Value = value; ValueType = valueType; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "issuer")] public string Issuer { get; set; } /// /// [JsonProperty(PropertyName = "originalIssuer")] public string OriginalIssuer { get; set; } /// /// [JsonProperty(PropertyName = "properties")] public IDictionary Properties { get; private set; } /// /// [JsonProperty(PropertyName = "subject")] public ClaimsIdentity Subject { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } /// /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PermissionScope { /// /// Initializes a new instance of the PermissionScope class. /// public PermissionScope() { CustomInit(); } /// /// Initializes a new instance of the PermissionScope class. /// /// Scope type name /// Display label for particular scope value used /// only for representation /// Represent string scope value public PermissionScope(string type = default(string), string label = default(string), string scope = default(string)) { Type = type; Label = label; Scope = scope; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets scope type name /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// Gets or sets display label for particular scope value used only for /// representation /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } /// /// Gets or sets represent string scope value /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Permission { /// /// Initializes a new instance of the Permission class. /// public Permission() { CustomInit(); } /// /// Initializes a new instance of the Permission class. /// /// Id of the module which has registered this /// permission. /// Display name of the group to which this /// permission belongs. The '|' character is used to separate Child and /// parent groups. public Permission(string id = default(string), string name = default(string), string moduleId = default(string), string groupName = default(string), IList assignedScopes = default(IList), IList availableScopes = default(IList)) { Id = id; Name = name; ModuleId = moduleId; GroupName = groupName; AssignedScopes = assignedScopes; AvailableScopes = availableScopes; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets id of the module which has registered this permission. /// [JsonProperty(PropertyName = "moduleId")] public string ModuleId { get; set; } /// /// Gets or sets display name of the group to which this permission /// belongs. The '|' character is used to separate Child and parent /// groups. /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } /// /// [JsonProperty(PropertyName = "assignedScopes")] public IList AssignedScopes { get; set; } /// /// [JsonProperty(PropertyName = "availableScopes")] public IList AvailableScopes { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class UserApiKey { /// /// Initializes a new instance of the UserApiKey class. /// public UserApiKey() { CustomInit(); } /// /// Initializes a new instance of the UserApiKey class. /// public UserApiKey(string apiKey = default(string), string userName = default(string), string userId = default(string), bool? isActive = default(bool?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ApiKey = apiKey; UserName = userName; UserId = userId; IsActive = isActive; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "apiKey")] public string ApiKey { get; set; } /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "userId")] public string UserId { get; set; } /// /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class LoginType { /// /// Initializes a new instance of the LoginType class. /// public LoginType() { CustomInit(); } /// /// Initializes a new instance of the LoginType class. /// public LoginType(bool? enabled = default(bool?), bool? hasLoginForm = default(bool?), string authenticationType = default(string), int? priority = default(int?)) { Enabled = enabled; HasLoginForm = hasLoginForm; AuthenticationType = authenticationType; Priority = priority; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "enabled")] public bool? Enabled { get; set; } /// /// [JsonProperty(PropertyName = "hasLoginForm")] public bool? HasLoginForm { get; set; } /// /// [JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType { get; set; } /// /// [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ObjectSettingEntry { /// /// Initializes a new instance of the ObjectSettingEntry class. /// public ObjectSettingEntry() { CustomInit(); } /// /// Initializes a new instance of the ObjectSettingEntry class. /// /// Setting may belong to any object in /// system /// Flag indicates the this setting is read /// only and can't be changed /// The flag indicates that you need to /// restart the application to apply this setting changes. /// The module id which setting belong /// to /// Setting group name /// Setting name /// Display setting name /// Flag indicates that this setting doesn't /// need to be displayed on the UI /// Possible values include: 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', /// 'SecureString', 'Json', 'PositiveInteger' /// The flag indicates what current setting /// is just editable dictionary and hasn't any concrete value public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), bool? isReadOnly = default(bool?), object value = default(object), string id = default(string), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), string displayName = default(string), bool? isRequired = default(bool?), bool? isHidden = default(bool?), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) { ItHasValues = itHasValues; ObjectId = objectId; ObjectType = objectType; IsReadOnly = isReadOnly; Value = value; Id = id; RestartRequired = restartRequired; ModuleId = moduleId; GroupName = groupName; Name = name; DisplayName = displayName; IsRequired = isRequired; IsHidden = isHidden; ValueType = valueType; AllowedValues = allowedValues; DefaultValue = defaultValue; IsDictionary = isDictionary; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "itHasValues")] public bool? ItHasValues { get; private set; } /// /// Gets or sets setting may belong to any object in system /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets flag indicates the this setting is read only and can't /// be changed /// [JsonProperty(PropertyName = "isReadOnly")] public bool? IsReadOnly { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the flag indicates that you need to restart the /// application to apply this setting changes. /// [JsonProperty(PropertyName = "restartRequired")] public bool? RestartRequired { get; set; } /// /// Gets or sets the module id which setting belong to /// [JsonProperty(PropertyName = "moduleId")] public string ModuleId { get; set; } /// /// Gets or sets setting group name /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } /// /// Gets or sets setting name /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets display setting name /// [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } /// /// [JsonProperty(PropertyName = "isRequired")] public bool? IsRequired { get; set; } /// /// Gets or sets flag indicates that this setting doesn't need to be /// displayed on the UI /// [JsonProperty(PropertyName = "isHidden")] public bool? IsHidden { get; set; } /// /// Gets or sets possible values include: 'ShortText', 'LongText', /// 'Integer', 'Decimal', 'DateTime', 'Boolean', 'SecureString', /// 'Json', 'PositiveInteger' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "allowedValues")] public IList AllowedValues { get; set; } /// /// [JsonProperty(PropertyName = "defaultValue")] public object DefaultValue { get; set; } /// /// Gets or sets the flag indicates what current setting is just /// editable dictionary and hasn't any concrete value /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Role { /// /// Initializes a new instance of the Role class. /// public Role() { CustomInit(); } /// /// Initializes a new instance of the Role class. /// public Role(string description = default(string), IList permissions = default(IList), string id = default(string), string name = default(string), string normalizedName = default(string), string concurrencyStamp = default(string)) { Description = description; Permissions = permissions; Id = id; Name = name; NormalizedName = normalizedName; ConcurrencyStamp = concurrencyStamp; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "normalizedName")] public string NormalizedName { get; set; } /// /// [JsonProperty(PropertyName = "concurrencyStamp")] public string ConcurrencyStamp { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ApplicationUserLogin { /// /// Initializes a new instance of the ApplicationUserLogin class. /// public ApplicationUserLogin() { CustomInit(); } /// /// Initializes a new instance of the ApplicationUserLogin class. /// public ApplicationUserLogin(string loginProvider = default(string), string providerKey = default(string)) { LoginProvider = loginProvider; ProviderKey = providerKey; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "loginProvider")] public string LoginProvider { get; set; } /// /// [JsonProperty(PropertyName = "providerKey")] public string ProviderKey { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ApplicationUser { /// /// Initializes a new instance of the ApplicationUser class. /// public ApplicationUser() { CustomInit(); } /// /// Initializes a new instance of the ApplicationUser class. /// /// Tenant id /// Obsolete. Use LockoutEnd. DateTime /// in UTC when lockout ends, any time in the past is considered not /// locked out. /// Possible values include: 'PendingApproval', /// 'Approved', 'Rejected' /// Obsolete. All permissions from assigned /// roles. /// External provider logins. /// Indicates that the password for this /// user is expired and must be changed. /// The last date when the /// password was changed /// The last date when the /// requested password change. /// The last login date public ApplicationUser(string storeId = default(string), string memberId = default(string), bool? isAdministrator = default(bool?), string photoUrl = default(string), string userType = default(string), string status = default(string), string password = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), IList roles = default(IList), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), string userState = default(string), IList permissions = default(IList), IList logins = default(IList), bool? passwordExpired = default(bool?), System.DateTime? lastPasswordChangedDate = default(System.DateTime?), System.DateTime? lastPasswordChangeRequestDate = default(System.DateTime?), System.DateTime? lastLoginDate = default(System.DateTime?), string id = default(string), string userName = default(string), string normalizedUserName = default(string), string email = default(string), string normalizedEmail = default(string), bool? emailConfirmed = default(bool?), string passwordHash = default(string), string securityStamp = default(string), string concurrencyStamp = default(string), string phoneNumber = default(string), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEnd = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?)) { StoreId = storeId; MemberId = memberId; IsAdministrator = isAdministrator; PhotoUrl = photoUrl; UserType = userType; Status = status; Password = password; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Roles = roles; LockoutEndDateUtc = lockoutEndDateUtc; UserState = userState; Permissions = permissions; Logins = logins; PasswordExpired = passwordExpired; LastPasswordChangedDate = lastPasswordChangedDate; LastPasswordChangeRequestDate = lastPasswordChangeRequestDate; LastLoginDate = lastLoginDate; Id = id; UserName = userName; NormalizedUserName = normalizedUserName; Email = email; NormalizedEmail = normalizedEmail; EmailConfirmed = emailConfirmed; PasswordHash = passwordHash; SecurityStamp = securityStamp; ConcurrencyStamp = concurrencyStamp; PhoneNumber = phoneNumber; PhoneNumberConfirmed = phoneNumberConfirmed; TwoFactorEnabled = twoFactorEnabled; LockoutEnd = lockoutEnd; LockoutEnabled = lockoutEnabled; AccessFailedCount = accessFailedCount; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets tenant id /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "memberId")] public string MemberId { get; set; } /// /// [JsonProperty(PropertyName = "isAdministrator")] public bool? IsAdministrator { get; set; } /// /// [JsonProperty(PropertyName = "photoUrl")] public string PhotoUrl { get; set; } /// /// [JsonProperty(PropertyName = "userType")] public string UserType { get; set; } /// /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } /// /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "roles")] public IList Roles { get; set; } /// /// Gets or sets obsolete. Use LockoutEnd. DateTime in UTC when lockout /// ends, any time in the past is considered not locked out. /// [JsonProperty(PropertyName = "lockoutEndDateUtc")] public System.DateTime? LockoutEndDateUtc { get; set; } /// /// Gets or sets possible values include: 'PendingApproval', /// 'Approved', 'Rejected' /// [JsonProperty(PropertyName = "userState")] public string UserState { get; set; } /// /// Gets or sets obsolete. All permissions from assigned roles. /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// /// Gets or sets external provider logins. /// [JsonProperty(PropertyName = "logins")] public IList Logins { get; set; } /// /// Gets or sets indicates that the password for this user is expired /// and must be changed. /// [JsonProperty(PropertyName = "passwordExpired")] public bool? PasswordExpired { get; set; } /// /// Gets or sets the last date when the password was changed /// [JsonProperty(PropertyName = "lastPasswordChangedDate")] public System.DateTime? LastPasswordChangedDate { get; set; } /// /// Gets or sets the last date when the requested password change. /// [JsonProperty(PropertyName = "lastPasswordChangeRequestDate")] public System.DateTime? LastPasswordChangeRequestDate { get; set; } /// /// Gets or sets the last login date /// [JsonProperty(PropertyName = "lastLoginDate")] public System.DateTime? LastLoginDate { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "normalizedUserName")] public string NormalizedUserName { get; set; } /// /// [JsonProperty(PropertyName = "email")] public string Email { get; set; } /// /// [JsonProperty(PropertyName = "normalizedEmail")] public string NormalizedEmail { get; set; } /// /// [JsonProperty(PropertyName = "emailConfirmed")] public bool? EmailConfirmed { get; set; } /// /// [JsonProperty(PropertyName = "passwordHash")] public string PasswordHash { get; set; } /// /// [JsonProperty(PropertyName = "securityStamp")] public string SecurityStamp { get; set; } /// /// [JsonProperty(PropertyName = "concurrencyStamp")] public string ConcurrencyStamp { get; set; } /// /// [JsonProperty(PropertyName = "phoneNumber")] public string PhoneNumber { get; set; } /// /// [JsonProperty(PropertyName = "phoneNumberConfirmed")] public bool? PhoneNumberConfirmed { get; set; } /// /// [JsonProperty(PropertyName = "twoFactorEnabled")] public bool? TwoFactorEnabled { get; set; } /// /// [JsonProperty(PropertyName = "lockoutEnd")] public System.DateTime? LockoutEnd { get; set; } /// /// [JsonProperty(PropertyName = "lockoutEnabled")] public bool? LockoutEnabled { get; set; } /// /// [JsonProperty(PropertyName = "accessFailedCount")] public int? AccessFailedCount { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangedEntitiesRequest { /// /// Initializes a new instance of the ChangedEntitiesRequest class. /// public ChangedEntitiesRequest() { CustomInit(); } /// /// Initializes a new instance of the ChangedEntitiesRequest class. /// public ChangedEntitiesRequest(IList entityNames = default(IList), System.DateTime? modifiedSince = default(System.DateTime?)) { EntityNames = entityNames; ModifiedSince = modifiedSince; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "entityNames")] public IList EntityNames { get; set; } /// /// [JsonProperty(PropertyName = "modifiedSince")] public System.DateTime? ModifiedSince { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangedEntity { /// /// Initializes a new instance of the ChangedEntity class. /// public ChangedEntity() { CustomInit(); } /// /// Initializes a new instance of the ChangedEntity class. /// public ChangedEntity(string name = default(string), System.DateTime? modifiedDate = default(System.DateTime?)) { Name = name; ModifiedDate = modifiedDate; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangedEntitiesResponse { /// /// Initializes a new instance of the ChangedEntitiesResponse class. /// public ChangedEntitiesResponse() { CustomInit(); } /// /// Initializes a new instance of the ChangedEntitiesResponse class. /// public ChangedEntitiesResponse(IList entities = default(IList)) { Entities = entities; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "entities")] public IList Entities { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangeLogSearchCriteria { /// /// Initializes a new instance of the ChangeLogSearchCriteria class. /// public ChangeLogSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the ChangeLogSearchCriteria class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public ChangeLogSearchCriteria(IList operationTypes = default(IList), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { OperationTypes = operationTypes; StartDate = startDate; EndDate = endDate; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "operationTypes")] public IList OperationTypes { get; set; } /// /// [JsonProperty(PropertyName = "startDate")] public System.DateTime? StartDate { get; set; } /// /// [JsonProperty(PropertyName = "endDate")] public System.DateTime? EndDate { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangeLogSearchResult { /// /// Initializes a new instance of the ChangeLogSearchResult class. /// public ChangeLogSearchResult() { CustomInit(); } /// /// Initializes a new instance of the ChangeLogSearchResult class. /// public ChangeLogSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ChangePasswordRequest { /// /// Initializes a new instance of the ChangePasswordRequest class. /// public ChangePasswordRequest() { CustomInit(); } /// /// Initializes a new instance of the ChangePasswordRequest class. /// public ChangePasswordRequest(string userName = default(string), string oldPassword = default(string), string newPassword = default(string)) { UserName = userName; OldPassword = oldPassword; NewPassword = newPassword; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "oldPassword")] public string OldPassword { get; set; } /// /// [JsonProperty(PropertyName = "newPassword")] public string NewPassword { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ConfirmEmailRequest { /// /// Initializes a new instance of the ConfirmEmailRequest class. /// public ConfirmEmailRequest() { CustomInit(); } /// /// Initializes a new instance of the ConfirmEmailRequest class. /// public ConfirmEmailRequest(string token = default(string)) { Token = token; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "token")] public string Token { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyObjectValue { /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// public DynamicPropertyObjectValue() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' public DynamicPropertyObjectValue(string objectType = default(string), string objectId = default(string), string locale = default(string), object value = default(object), string valueId = default(string), string valueType = default(string), string propertyId = default(string), string propertyName = default(string)) { ObjectType = objectType; ObjectId = objectId; Locale = locale; Value = value; ValueId = valueId; ValueType = valueType; PropertyId = propertyId; PropertyName = propertyName; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "valueId")] public string ValueId { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "propertyName")] public string PropertyName { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyName { /// /// Initializes a new instance of the DynamicPropertyName class. /// public DynamicPropertyName() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyName class. /// /// Language ID, e.g. en-US. public DynamicPropertyName(string locale = default(string), string name = default(string)) { Locale = locale; Name = name; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets language ID, e.g. en-US. /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicObjectProperty { /// /// Initializes a new instance of the DynamicObjectProperty class. /// public DynamicObjectProperty() { CustomInit(); } /// /// Initializes a new instance of the DynamicObjectProperty class. /// /// dynamic property description /// Defines whether a property supports multiple /// values. /// Dictionary has a predefined set of /// values. User can select one or more of them and cannot enter /// arbitrary values. /// For multilingual properties user can /// enter different values for each of registered languages. /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' /// Property names for different /// languages. public DynamicObjectProperty(string objectId = default(string), IList values = default(IList), string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ObjectId = objectId; Values = values; Name = name; Description = description; ObjectType = objectType; IsArray = isArray; IsDictionary = isDictionary; IsMultilingual = isMultilingual; IsRequired = isRequired; DisplayOrder = displayOrder; ValueType = valueType; DisplayNames = displayNames; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "values")] public IList Values { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets dynamic property description /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets defines whether a property supports multiple values. /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// /// Gets or sets dictionary has a predefined set of values. User can /// select one or more of them and cannot enter arbitrary values. /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// /// Gets or sets for multilingual properties user can enter different /// values for each of registered languages. /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } /// /// [JsonProperty(PropertyName = "isRequired")] public bool? IsRequired { get; set; } /// /// [JsonProperty(PropertyName = "displayOrder")] public int? DisplayOrder { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// Gets or sets property names for different languages. /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicProperty { /// /// Initializes a new instance of the DynamicProperty class. /// public DynamicProperty() { CustomInit(); } /// /// Initializes a new instance of the DynamicProperty class. /// /// dynamic property description /// Defines whether a property supports multiple /// values. /// Dictionary has a predefined set of /// values. User can select one or more of them and cannot enter /// arbitrary values. /// For multilingual properties user can /// enter different values for each of registered languages. /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' /// Property names for different /// languages. public DynamicProperty(string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; Description = description; ObjectType = objectType; IsArray = isArray; IsDictionary = isDictionary; IsMultilingual = isMultilingual; IsRequired = isRequired; DisplayOrder = displayOrder; ValueType = valueType; DisplayNames = displayNames; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets dynamic property description /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets defines whether a property supports multiple values. /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// /// Gets or sets dictionary has a predefined set of values. User can /// select one or more of them and cannot enter arbitrary values. /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// /// Gets or sets for multilingual properties user can enter different /// values for each of registered languages. /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } /// /// [JsonProperty(PropertyName = "isRequired")] public bool? IsRequired { get; set; } /// /// [JsonProperty(PropertyName = "displayOrder")] public int? DisplayOrder { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// Gets or sets property names for different languages. /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyDictionaryItemSearchCriteria { /// /// Initializes a new instance of the /// DynamicPropertyDictionaryItemSearchCriteria class. /// public DynamicPropertyDictionaryItemSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the /// DynamicPropertyDictionaryItemSearchCriteria class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public DynamicPropertyDictionaryItemSearchCriteria(string propertyId = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { PropertyId = propertyId; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyDictionaryItemSearchResult { /// /// Initializes a new instance of the /// DynamicPropertyDictionaryItemSearchResult class. /// public DynamicPropertyDictionaryItemSearchResult() { CustomInit(); } /// /// Initializes a new instance of the /// DynamicPropertyDictionaryItemSearchResult class. /// public DynamicPropertyDictionaryItemSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertySearchCriteria { /// /// Initializes a new instance of the DynamicPropertySearchCriteria /// class. /// public DynamicPropertySearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertySearchCriteria /// class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public DynamicPropertySearchCriteria(string typeName = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { TypeName = typeName; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "typeName")] public string TypeName { get; private set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertySearchResult { /// /// Initializes a new instance of the DynamicPropertySearchResult /// class. /// public DynamicPropertySearchResult() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertySearchResult /// class. /// public DynamicPropertySearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class IdentityError { /// /// Initializes a new instance of the IdentityError class. /// public IdentityError() { CustomInit(); } /// /// Initializes a new instance of the IdentityError class. /// public IdentityError(string code = default(string), string description = default(string)) { Code = code; Description = description; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class IdentityResult { /// /// Initializes a new instance of the IdentityResult class. /// public IdentityResult() { CustomInit(); } /// /// Initializes a new instance of the IdentityResult class. /// public IdentityResult(bool? succeeded = default(bool?), IList errors = default(IList)) { Succeeded = succeeded; Errors = errors; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "succeeded")] public bool? Succeeded { get; private set; } /// /// [JsonProperty(PropertyName = "errors")] public IList Errors { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Job { /// /// Initializes a new instance of the Job class. /// public Job() { CustomInit(); } /// /// Initializes a new instance of the Job class. /// public Job(string state = default(string), bool? completed = default(bool?), string id = default(string)) { State = state; Completed = completed; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "state")] public string State { get; set; } /// /// [JsonProperty(PropertyName = "completed")] public bool? Completed { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class JsonElement { /// /// Initializes a new instance of the JsonElement class. /// public JsonElement() { CustomInit(); } /// /// Initializes a new instance of the JsonElement class. /// /// Possible values include: 'Undefined', /// 'Object', 'Array', 'String', 'Number', 'True', 'False', /// 'Null' public JsonElement(string valueKind = default(string)) { ValueKind = valueKind; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets possible values include: 'Undefined', 'Object', /// 'Array', 'String', 'Number', 'True', 'False', 'Null' /// [JsonProperty(PropertyName = "valueKind")] public string ValueKind { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class LastModifiedResponse { /// /// Initializes a new instance of the LastModifiedResponse class. /// public LastModifiedResponse() { CustomInit(); } /// /// Initializes a new instance of the LastModifiedResponse class. /// public LastModifiedResponse(string scope = default(string), System.DateTime? lastModifiedDate = default(System.DateTime?)) { Scope = scope; LastModifiedDate = lastModifiedDate; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } /// /// [JsonProperty(PropertyName = "lastModifiedDate")] public System.DateTime? LastModifiedDate { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class License { /// /// Initializes a new instance of the License class. /// public License() { CustomInit(); } /// /// Initializes a new instance of the License class. /// public License(string type = default(string), string customerName = default(string), string customerEmail = default(string), System.DateTime? expirationDate = default(System.DateTime?), string rawLicense = default(string)) { Type = type; CustomerName = customerName; CustomerEmail = customerEmail; ExpirationDate = expirationDate; RawLicense = rawLicense; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "customerName")] public string CustomerName { get; set; } /// /// [JsonProperty(PropertyName = "customerEmail")] public string CustomerEmail { get; set; } /// /// [JsonProperty(PropertyName = "expirationDate")] public System.DateTime? ExpirationDate { get; set; } /// /// [JsonProperty(PropertyName = "rawLicense")] public string RawLicense { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class LoginRequest { /// /// Initializes a new instance of the LoginRequest class. /// public LoginRequest() { CustomInit(); } /// /// Initializes a new instance of the LoginRequest class. /// public LoginRequest(string userName = default(string), string password = default(string), bool? rememberMe = default(bool?)) { UserName = userName; Password = password; RememberMe = rememberMe; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } /// /// [JsonProperty(PropertyName = "rememberMe")] public bool? RememberMe { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ProgressMessage { /// /// Initializes a new instance of the ProgressMessage class. /// public ProgressMessage() { CustomInit(); } /// /// Initializes a new instance of the ProgressMessage class. /// /// Possible values include: 'Info', 'Warning', /// 'Debug', 'Error' public ProgressMessage(string message = default(string), string level = default(string)) { Message = message; Level = level; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "message")] public string Message { get; set; } /// /// Gets or sets possible values include: 'Info', 'Warning', 'Debug', /// 'Error' /// [JsonProperty(PropertyName = "level")] public string Level { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ModuleAutoInstallPushNotification { /// /// Initializes a new instance of the ModuleAutoInstallPushNotification /// class. /// public ModuleAutoInstallPushNotification() { CustomInit(); } /// /// Initializes a new instance of the ModuleAutoInstallPushNotification /// class. /// /// Gets the count of errors during /// processing. public ModuleAutoInstallPushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), int? errorCount = default(int?), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { Started = started; Finished = finished; ProgressLog = progressLog; ErrorCount = errorCount; ServerId = serverId; Creator = creator; Created = created; IsNew = isNew; NotifyType = notifyType; Description = description; Title = title; RepeatCount = repeatCount; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "started")] public System.DateTime? Started { get; set; } /// /// [JsonProperty(PropertyName = "finished")] public System.DateTime? Finished { get; set; } /// /// [JsonProperty(PropertyName = "progressLog")] public IList ProgressLog { get; set; } /// /// Gets the count of errors during processing. /// [JsonProperty(PropertyName = "errorCount")] public int? ErrorCount { get; private set; } /// /// [JsonProperty(PropertyName = "serverId")] public string ServerId { get; set; } /// /// [JsonProperty(PropertyName = "creator")] public string Creator { get; set; } /// /// [JsonProperty(PropertyName = "created")] public System.DateTime? Created { get; set; } /// /// [JsonProperty(PropertyName = "isNew")] public bool? IsNew { get; set; } /// /// [JsonProperty(PropertyName = "notifyType")] public string NotifyType { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "repeatCount")] public int? RepeatCount { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ModulePushNotification { /// /// Initializes a new instance of the ModulePushNotification class. /// public ModulePushNotification() { CustomInit(); } /// /// Initializes a new instance of the ModulePushNotification class. /// /// Gets the count of errors during /// processing. public ModulePushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), int? errorCount = default(int?), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { Started = started; Finished = finished; ProgressLog = progressLog; ErrorCount = errorCount; ServerId = serverId; Creator = creator; Created = created; IsNew = isNew; NotifyType = notifyType; Description = description; Title = title; RepeatCount = repeatCount; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "started")] public System.DateTime? Started { get; set; } /// /// [JsonProperty(PropertyName = "finished")] public System.DateTime? Finished { get; set; } /// /// [JsonProperty(PropertyName = "progressLog")] public IList ProgressLog { get; set; } /// /// Gets the count of errors during processing. /// [JsonProperty(PropertyName = "errorCount")] public int? ErrorCount { get; private set; } /// /// [JsonProperty(PropertyName = "serverId")] public string ServerId { get; set; } /// /// [JsonProperty(PropertyName = "creator")] public string Creator { get; set; } /// /// [JsonProperty(PropertyName = "created")] public System.DateTime? Created { get; set; } /// /// [JsonProperty(PropertyName = "isNew")] public bool? IsNew { get; set; } /// /// [JsonProperty(PropertyName = "notifyType")] public string NotifyType { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "repeatCount")] public int? RepeatCount { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OAuthAppSearchCriteria { /// /// Initializes a new instance of the OAuthAppSearchCriteria class. /// public OAuthAppSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the OAuthAppSearchCriteria class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public OAuthAppSearchCriteria(string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OpenIddictApplicationDescriptor { /// /// Initializes a new instance of the OpenIddictApplicationDescriptor /// class. /// public OpenIddictApplicationDescriptor() { CustomInit(); } /// /// Initializes a new instance of the OpenIddictApplicationDescriptor /// class. /// public OpenIddictApplicationDescriptor(string clientId = default(string), string clientSecret = default(string), string consentType = default(string), string displayName = default(string), IDictionary displayNames = default(IDictionary), IList permissions = default(IList), IList postLogoutRedirectUris = default(IList), IDictionary properties = default(IDictionary), IList redirectUris = default(IList), IList requirements = default(IList), string type = default(string)) { ClientId = clientId; ClientSecret = clientSecret; ConsentType = consentType; DisplayName = displayName; DisplayNames = displayNames; Permissions = permissions; PostLogoutRedirectUris = postLogoutRedirectUris; Properties = properties; RedirectUris = redirectUris; Requirements = requirements; Type = type; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "clientId")] public string ClientId { get; set; } /// /// [JsonProperty(PropertyName = "clientSecret")] public string ClientSecret { get; set; } /// /// [JsonProperty(PropertyName = "consentType")] public string ConsentType { get; set; } /// /// [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } /// /// [JsonProperty(PropertyName = "displayNames")] public IDictionary DisplayNames { get; private set; } /// /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; private set; } /// /// [JsonProperty(PropertyName = "postLogoutRedirectUris")] public IList PostLogoutRedirectUris { get; private set; } /// /// [JsonProperty(PropertyName = "properties")] public IDictionary Properties { get; private set; } /// /// [JsonProperty(PropertyName = "redirectUris")] public IList RedirectUris { get; private set; } /// /// [JsonProperty(PropertyName = "requirements")] public IList Requirements { get; private set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OAuthAppSearchResult { /// /// Initializes a new instance of the OAuthAppSearchResult class. /// public OAuthAppSearchResult() { CustomInit(); } /// /// Initializes a new instance of the OAuthAppSearchResult class. /// public OAuthAppSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class OpenIddictResponse { /// /// Initializes a new instance of the OpenIddictResponse class. /// public OpenIddictResponse() { CustomInit(); } /// /// Initializes a new instance of the OpenIddictResponse class. /// public OpenIddictResponse(string accessToken = default(string), string code = default(string), string deviceCode = default(string), string error = default(string), string errorDescription = default(string), string errorUri = default(string), long? expiresIn = default(long?), string idToken = default(string), string refreshToken = default(string), string scope = default(string), string state = default(string), string tokenType = default(string), string userCode = default(string), int? count = default(int?)) { AccessToken = accessToken; Code = code; DeviceCode = deviceCode; Error = error; ErrorDescription = errorDescription; ErrorUri = errorUri; ExpiresIn = expiresIn; IdToken = idToken; RefreshToken = refreshToken; Scope = scope; State = state; TokenType = tokenType; UserCode = userCode; Count = count; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "accessToken")] public string AccessToken { get; set; } /// /// [JsonProperty(PropertyName = "code")] public string Code { get; set; } /// /// [JsonProperty(PropertyName = "deviceCode")] public string DeviceCode { get; set; } /// /// [JsonProperty(PropertyName = "error")] public string Error { get; set; } /// /// [JsonProperty(PropertyName = "errorDescription")] public string ErrorDescription { get; set; } /// /// [JsonProperty(PropertyName = "errorUri")] public string ErrorUri { get; set; } /// /// [JsonProperty(PropertyName = "expiresIn")] public long? ExpiresIn { get; set; } /// /// [JsonProperty(PropertyName = "idToken")] public string IdToken { get; set; } /// /// [JsonProperty(PropertyName = "refreshToken")] public string RefreshToken { get; set; } /// /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } /// /// [JsonProperty(PropertyName = "state")] public string State { get; set; } /// /// [JsonProperty(PropertyName = "tokenType")] public string TokenType { get; set; } /// /// [JsonProperty(PropertyName = "userCode")] public string UserCode { get; set; } /// /// [JsonProperty(PropertyName = "count")] public int? Count { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PushNotification { /// /// Initializes a new instance of the PushNotification class. /// public PushNotification() { CustomInit(); } /// /// Initializes a new instance of the PushNotification class. /// public PushNotification(string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { ServerId = serverId; Creator = creator; Created = created; IsNew = isNew; NotifyType = notifyType; Description = description; Title = title; RepeatCount = repeatCount; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "serverId")] public string ServerId { get; set; } /// /// [JsonProperty(PropertyName = "creator")] public string Creator { get; set; } /// /// [JsonProperty(PropertyName = "created")] public System.DateTime? Created { get; set; } /// /// [JsonProperty(PropertyName = "isNew")] public bool? IsNew { get; set; } /// /// [JsonProperty(PropertyName = "notifyType")] public string NotifyType { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "repeatCount")] public int? RepeatCount { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PushNotificationSearchCriteria { /// /// Initializes a new instance of the PushNotificationSearchCriteria /// class. /// public PushNotificationSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the PushNotificationSearchCriteria /// class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public PushNotificationSearchCriteria(IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { Ids = ids; OnlyNew = onlyNew; StartDate = startDate; EndDate = endDate; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "ids")] public IList Ids { get; set; } /// /// [JsonProperty(PropertyName = "onlyNew")] public bool? OnlyNew { get; set; } /// /// [JsonProperty(PropertyName = "startDate")] public System.DateTime? StartDate { get; set; } /// /// [JsonProperty(PropertyName = "endDate")] public System.DateTime? EndDate { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class PushNotificationSearchResult { /// /// Initializes a new instance of the PushNotificationSearchResult /// class. /// public PushNotificationSearchResult() { CustomInit(); } /// /// Initializes a new instance of the PushNotificationSearchResult /// class. /// public PushNotificationSearchResult(int? totalCount = default(int?), int? newCount = default(int?), IList notifyEvents = default(IList)) { TotalCount = totalCount; NewCount = newCount; NotifyEvents = notifyEvents; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "newCount")] public int? NewCount { get; set; } /// /// [JsonProperty(PropertyName = "notifyEvents")] public IList NotifyEvents { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ResetPasswordConfirmRequest { /// /// Initializes a new instance of the ResetPasswordConfirmRequest /// class. /// public ResetPasswordConfirmRequest() { CustomInit(); } /// /// Initializes a new instance of the ResetPasswordConfirmRequest /// class. /// public ResetPasswordConfirmRequest(string token = default(string), string newPassword = default(string), bool? forcePasswordChangeOnNextSignIn = default(bool?)) { Token = token; NewPassword = newPassword; ForcePasswordChangeOnNextSignIn = forcePasswordChangeOnNextSignIn; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "token")] public string Token { get; set; } /// /// [JsonProperty(PropertyName = "newPassword")] public string NewPassword { get; set; } /// /// [JsonProperty(PropertyName = "forcePasswordChangeOnNextSignIn")] public bool? ForcePasswordChangeOnNextSignIn { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class RoleSearchCriteria { /// /// Initializes a new instance of the RoleSearchCriteria class. /// public RoleSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the RoleSearchCriteria class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public RoleSearchCriteria(string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class RoleSearchResult { /// /// Initializes a new instance of the RoleSearchResult class. /// public RoleSearchResult() { CustomInit(); } /// /// Initializes a new instance of the RoleSearchResult class. /// public RoleSearchResult(IList roles = default(IList), int? totalCount = default(int?), IList results = default(IList)) { Roles = roles; TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "roles")] public IList Roles { get; private set; } /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SecurityResult { /// /// Initializes a new instance of the SecurityResult class. /// public SecurityResult() { CustomInit(); } /// /// Initializes a new instance of the SecurityResult class. /// public SecurityResult(bool? succeeded = default(bool?), IList errors = default(IList)) { Succeeded = succeeded; Errors = errors; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "succeeded")] public bool? Succeeded { get; set; } /// /// [JsonProperty(PropertyName = "errors")] public IList Errors { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SignInResult { /// /// Initializes a new instance of the SignInResult class. /// public SignInResult() { CustomInit(); } /// /// Initializes a new instance of the SignInResult class. /// public SignInResult(bool? succeeded = default(bool?), bool? isLockedOut = default(bool?), bool? isNotAllowed = default(bool?), bool? requiresTwoFactor = default(bool?)) { Succeeded = succeeded; IsLockedOut = isLockedOut; IsNotAllowed = isNotAllowed; RequiresTwoFactor = requiresTwoFactor; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "succeeded")] public bool? Succeeded { get; private set; } /// /// [JsonProperty(PropertyName = "isLockedOut")] public bool? IsLockedOut { get; private set; } /// /// [JsonProperty(PropertyName = "isNotAllowed")] public bool? IsNotAllowed { get; private set; } /// /// [JsonProperty(PropertyName = "requiresTwoFactor")] public bool? RequiresTwoFactor { get; private set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class StringIdentityUserRole { /// /// Initializes a new instance of the StringIdentityUserRole class. /// public StringIdentityUserRole() { CustomInit(); } /// /// Initializes a new instance of the StringIdentityUserRole class. /// public StringIdentityUserRole(string userId = default(string), string roleId = default(string)) { UserId = userId; RoleId = roleId; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "userId")] public string UserId { get; set; } /// /// [JsonProperty(PropertyName = "roleId")] public string RoleId { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SystemInfo { /// /// Initializes a new instance of the SystemInfo class. /// public SystemInfo() { CustomInit(); } /// /// Initializes a new instance of the SystemInfo class. /// public SystemInfo(string platformVersion = default(string), License license = default(License), IList installedModules = default(IList), string version = default(string), bool? is64BitOperatingSystem = default(bool?), bool? is64BitProcess = default(bool?), string databaseProvider = default(string)) { PlatformVersion = platformVersion; License = license; InstalledModules = installedModules; Version = version; Is64BitOperatingSystem = is64BitOperatingSystem; Is64BitProcess = is64BitProcess; DatabaseProvider = databaseProvider; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "platformVersion")] public string PlatformVersion { get; set; } /// /// [JsonProperty(PropertyName = "license")] public License License { get; set; } /// /// [JsonProperty(PropertyName = "installedModules")] public IList InstalledModules { get; set; } /// /// [JsonProperty(PropertyName = "version")] public string Version { get; set; } /// /// [JsonProperty(PropertyName = "is64BitOperatingSystem")] public bool? Is64BitOperatingSystem { get; set; } /// /// [JsonProperty(PropertyName = "is64BitProcess")] public bool? Is64BitProcess { get; set; } /// /// [JsonProperty(PropertyName = "databaseProvider")] public string DatabaseProvider { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class UserDetail { /// /// Initializes a new instance of the UserDetail class. /// public UserDetail() { CustomInit(); } /// /// Initializes a new instance of the UserDetail class. /// public UserDetail(IList permissions = default(IList), string userName = default(string), bool? isAdministrator = default(bool?), bool? passwordExpired = default(bool?), int? daysTillPasswordExpiry = default(int?), string id = default(string)) { Permissions = permissions; UserName = userName; IsAdministrator = isAdministrator; PasswordExpired = passwordExpired; DaysTillPasswordExpiry = daysTillPasswordExpiry; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "isAdministrator")] public bool? IsAdministrator { get; set; } /// /// [JsonProperty(PropertyName = "passwordExpired")] public bool? PasswordExpired { get; set; } /// /// [JsonProperty(PropertyName = "daysTillPasswordExpiry")] public int? DaysTillPasswordExpiry { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class UserLockedResult { /// /// Initializes a new instance of the UserLockedResult class. /// public UserLockedResult() { CustomInit(); } /// /// Initializes a new instance of the UserLockedResult class. /// public UserLockedResult(bool? locked = default(bool?)) { Locked = locked; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "locked")] public bool? Locked { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class UserSearchCriteria { /// /// Initializes a new instance of the UserSearchCriteria class. /// public UserSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the UserSearchCriteria class. /// /// Search object type /// Search phrase /// Property is left for backward /// compatibility /// Search phrase language public UserSearchCriteria(string memberId = default(string), IList memberIds = default(IList), System.DateTime? modifiedSinceDate = default(System.DateTime?), IList roles = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { MemberId = memberId; MemberIds = memberIds; ModifiedSinceDate = modifiedSinceDate; Roles = roles; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "memberId")] public string MemberId { get; set; } /// /// [JsonProperty(PropertyName = "memberIds")] public IList MemberIds { get; set; } /// /// [JsonProperty(PropertyName = "modifiedSinceDate")] public System.DateTime? ModifiedSinceDate { get; set; } /// /// [JsonProperty(PropertyName = "roles")] public IList Roles { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class UserSearchResult { /// /// Initializes a new instance of the UserSearchResult class. /// public UserSearchResult() { CustomInit(); } /// /// Initializes a new instance of the UserSearchResult class. /// public UserSearchResult(IList users = default(IList), int? totalCount = default(int?), IList results = default(IList)) { Users = users; TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "users")] public IList Users { get; private set; } /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ValidatePasswordResetTokenRequest { /// /// Initializes a new instance of the ValidatePasswordResetTokenRequest /// class. /// public ValidatePasswordResetTokenRequest() { CustomInit(); } /// /// Initializes a new instance of the ValidatePasswordResetTokenRequest /// class. /// public ValidatePasswordResetTokenRequest(string token = default(string)) { Token = token; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "token")] public string Token { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class VerifyTokenRequest { /// /// Initializes a new instance of the VerifyTokenRequest class. /// public VerifyTokenRequest() { CustomInit(); } /// /// Initializes a new instance of the VerifyTokenRequest class. /// public VerifyTokenRequest(string tokenProvider = default(string), string purpose = default(string), string token = default(string)) { TokenProvider = tokenProvider; Purpose = purpose; Token = token; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "tokenProvider")] public string TokenProvider { get; set; } /// /// [JsonProperty(PropertyName = "purpose")] public string Purpose { get; set; } /// /// [JsonProperty(PropertyName = "token")] public string Token { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/SitemapsModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapsModuleClient : ServiceClient, ISitemapsModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the ISitemapsModuleApiOperations. /// public virtual ISitemapsModuleApiOperations SitemapsModuleApi { get; private set; } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling SitemapsModuleClient.Dispose(). False: will not dispose provided httpClient protected SitemapsModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected SitemapsModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected SitemapsModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected SitemapsModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected SitemapsModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public SitemapsModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling SitemapsModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public SitemapsModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public SitemapsModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public SitemapsModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the SitemapsModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public SitemapsModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { SitemapsModuleApi = new SitemapsModuleApiOperations(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface ISitemapsModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the ISitemapsModuleApiOperations. /// ISitemapsModuleApiOperations SitemapsModuleApi { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// SitemapsModuleApiOperations operations. /// public partial class SitemapsModuleApiOperations : IServiceOperations, ISitemapsModuleApiOperations { /// /// Initializes a new instance of the SitemapsModuleApiOperations class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public SitemapsModuleApiOperations(SitemapsModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the SitemapsModuleClient /// public SitemapsModuleClient Client { get; private set; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchSitemapsWithHttpMessagesAsync(SitemapSearchCriteria body = default(SitemapSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchSitemaps", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetSitemapByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSitemapById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task AddSitemapWithHttpMessagesAsync(Sitemap body = default(Sitemap), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AddSitemap", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateSitemapWithHttpMessagesAsync(Sitemap body = default(Sitemap), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateSitemap", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteSitemapWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteSitemap", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchSitemapItemsWithHttpMessagesAsync(SitemapItemSearchCriteria body = default(SitemapItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchSitemapItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/items/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task AddSitemapItemsWithHttpMessagesAsync(string sitemapId, IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (sitemapId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "sitemapId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("sitemapId", sitemapId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AddSitemapItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/{sitemapId}/items").ToString(); _url = _url.Replace("{sitemapId}", System.Uri.EscapeDataString(sitemapId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task RemoveSitemapItemsWithHttpMessagesAsync(IList itemIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("itemIds", itemIds); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RemoveSitemapItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/items").ToString(); List _queryParameters = new List(); if (itemIds != null) { _queryParameters.Add(string.Format("itemIds={0}", System.Uri.EscapeDataString(string.Join(",", itemIds)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetSitemapsSchemaWithHttpMessagesAsync(string storeId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSitemapsSchema", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/schema").ToString(); List _queryParameters = new List(); if (storeId != null) { _queryParameters.Add(string.Format("storeId={0}", System.Uri.EscapeDataString(storeId))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> GenerateSitemapWithHttpMessagesAsync(string storeId = default(string), string baseUrl = default(string), string sitemapUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("baseUrl", baseUrl); tracingParameters.Add("sitemapUrl", sitemapUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateSitemap", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/generate").ToString(); List _queryParameters = new List(); if (storeId != null) { _queryParameters.Add(string.Format("storeId={0}", System.Uri.EscapeDataString(storeId))); } if (baseUrl != null) { _queryParameters.Add(string.Format("baseUrl={0}", System.Uri.EscapeDataString(baseUrl))); } if (sitemapUrl != null) { _queryParameters.Add(string.Format("sitemapUrl={0}", System.Uri.EscapeDataString(sitemapUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> DownloadSitemapWithHttpMessagesAsync(string storeId = default(string), string baseUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("baseUrl", baseUrl); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DownloadSitemap", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/sitemaps/download").ToString(); List _queryParameters = new List(); if (storeId != null) { _queryParameters.Add(string.Format("storeId={0}", System.Uri.EscapeDataString(storeId))); } if (baseUrl != null) { _queryParameters.Add(string.Format("baseUrl={0}", System.Uri.EscapeDataString(baseUrl))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// SitemapsModuleApiOperations operations. /// public partial interface ISitemapsModuleApiOperations { /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchSitemapsWithHttpMessagesAsync(SitemapSearchCriteria body = default(SitemapSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetSitemapByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task AddSitemapWithHttpMessagesAsync(Sitemap body = default(Sitemap), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateSitemapWithHttpMessagesAsync(Sitemap body = default(Sitemap), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteSitemapWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchSitemapItemsWithHttpMessagesAsync(SitemapItemSearchCriteria body = default(SitemapItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// Task AddSitemapItemsWithHttpMessagesAsync(string sitemapId, IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task RemoveSitemapItemsWithHttpMessagesAsync(IList itemIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetSitemapsSchemaWithHttpMessagesAsync(string storeId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> GenerateSitemapWithHttpMessagesAsync(string storeId = default(string), string baseUrl = default(string), string sitemapUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> DownloadSitemapWithHttpMessagesAsync(string storeId = default(string), string baseUrl = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for SitemapsModuleApiOperations. /// public static partial class SitemapsModuleApiOperationsExtensions { /// /// The operations group for this extension method. /// /// /// public static SitemapSearchResult SearchSitemaps(this ISitemapsModuleApiOperations operations, SitemapSearchCriteria body = default(SitemapSearchCriteria)) { return operations.SearchSitemapsAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchSitemapsAsync(this ISitemapsModuleApiOperations operations, SitemapSearchCriteria body = default(SitemapSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchSitemapsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static Sitemap GetSitemapById(this ISitemapsModuleApiOperations operations, string id) { return operations.GetSitemapByIdAsync(id).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task GetSitemapByIdAsync(this ISitemapsModuleApiOperations operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSitemapByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// public static void AddSitemap(this ISitemapsModuleApiOperations operations, Sitemap body = default(Sitemap)) { operations.AddSitemapAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task AddSitemapAsync(this ISitemapsModuleApiOperations operations, Sitemap body = default(Sitemap), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.AddSitemapWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void UpdateSitemap(this ISitemapsModuleApiOperations operations, Sitemap body = default(Sitemap)) { operations.UpdateSitemapAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task UpdateSitemapAsync(this ISitemapsModuleApiOperations operations, Sitemap body = default(Sitemap), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateSitemapWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void DeleteSitemap(this ISitemapsModuleApiOperations operations, IList ids = default(IList)) { operations.DeleteSitemapAsync(ids).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task DeleteSitemapAsync(this ISitemapsModuleApiOperations operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteSitemapWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static SitemapItemsSearchResult SearchSitemapItems(this ISitemapsModuleApiOperations operations, SitemapItemSearchCriteria body = default(SitemapItemSearchCriteria)) { return operations.SearchSitemapItemsAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchSitemapItemsAsync(this ISitemapsModuleApiOperations operations, SitemapItemSearchCriteria body = default(SitemapItemSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchSitemapItemsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// public static void AddSitemapItems(this ISitemapsModuleApiOperations operations, string sitemapId, IList body = default(IList)) { operations.AddSitemapItemsAsync(sitemapId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task AddSitemapItemsAsync(this ISitemapsModuleApiOperations operations, string sitemapId, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.AddSitemapItemsWithHttpMessagesAsync(sitemapId, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static void RemoveSitemapItems(this ISitemapsModuleApiOperations operations, IList itemIds = default(IList)) { operations.RemoveSitemapItemsAsync(itemIds).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task RemoveSitemapItemsAsync(this ISitemapsModuleApiOperations operations, IList itemIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.RemoveSitemapItemsWithHttpMessagesAsync(itemIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// The operations group for this extension method. /// /// /// public static IList GetSitemapsSchema(this ISitemapsModuleApiOperations operations, string storeId = default(string)) { return operations.GetSitemapsSchemaAsync(storeId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> GetSitemapsSchemaAsync(this ISitemapsModuleApiOperations operations, string storeId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSitemapsSchemaWithHttpMessagesAsync(storeId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// The operations group for this extension method. /// /// /// /// /// /// /// public static Stream GenerateSitemap(this ISitemapsModuleApiOperations operations, string storeId = default(string), string baseUrl = default(string), string sitemapUrl = default(string)) { return operations.GenerateSitemapAsync(storeId, baseUrl, sitemapUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// /// /// The cancellation token. /// public static async Task GenerateSitemapAsync(this ISitemapsModuleApiOperations operations, string storeId = default(string), string baseUrl = default(string), string sitemapUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.GenerateSitemapWithHttpMessagesAsync(storeId, baseUrl, sitemapUrl, null, cancellationToken).ConfigureAwait(false); _result.Request.Dispose(); return _result.Body; } /// /// The operations group for this extension method. /// /// /// /// /// public static SitemapDownloadNotification DownloadSitemap(this ISitemapsModuleApiOperations operations, string storeId = default(string), string baseUrl = default(string)) { return operations.DownloadSitemapAsync(storeId, baseUrl).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// /// /// /// /// /// /// The cancellation token. /// public static async Task DownloadSitemapAsync(this ISitemapsModuleApiOperations operations, string storeId = default(string), string baseUrl = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DownloadSitemapWithHttpMessagesAsync(storeId, baseUrl, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapItemAlternateLinkRecord { /// /// Initializes a new instance of the SitemapItemAlternateLinkRecord /// class. /// public SitemapItemAlternateLinkRecord() { CustomInit(); } /// /// Initializes a new instance of the SitemapItemAlternateLinkRecord /// class. /// public SitemapItemAlternateLinkRecord(string url = default(string), string language = default(string), string type = default(string)) { Url = url; Language = language; Type = type; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapItemRecord { /// /// Initializes a new instance of the SitemapItemRecord class. /// public SitemapItemRecord() { CustomInit(); } /// /// Initializes a new instance of the SitemapItemRecord class. /// public SitemapItemRecord(string url = default(string), System.DateTime? modifiedDate = default(System.DateTime?), string updateFrequency = default(string), double? priority = default(double?), IList alternates = default(IList)) { Url = url; ModifiedDate = modifiedDate; UpdateFrequency = updateFrequency; Priority = priority; Alternates = alternates; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "updateFrequency")] public string UpdateFrequency { get; set; } /// /// [JsonProperty(PropertyName = "priority")] public double? Priority { get; set; } /// /// [JsonProperty(PropertyName = "alternates")] public IList Alternates { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapItem { /// /// Initializes a new instance of the SitemapItem class. /// public SitemapItem() { CustomInit(); } /// /// Initializes a new instance of the SitemapItem class. /// public SitemapItem(string sitemapId = default(string), string title = default(string), string imageUrl = default(string), string objectId = default(string), string objectType = default(string), string urlTemplate = default(string), IList itemsRecords = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { SitemapId = sitemapId; Title = title; ImageUrl = imageUrl; ObjectId = objectId; ObjectType = objectType; UrlTemplate = urlTemplate; ItemsRecords = itemsRecords; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sitemapId")] public string SitemapId { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "imageUrl")] public string ImageUrl { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "urlTemplate")] public string UrlTemplate { get; set; } /// /// [JsonProperty(PropertyName = "itemsRecords")] public IList ItemsRecords { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapSearchCriteria { /// /// Initializes a new instance of the SitemapSearchCriteria class. /// public SitemapSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the SitemapSearchCriteria class. /// public SitemapSearchCriteria(string storeId = default(string), string location = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { StoreId = storeId; Location = location; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Sitemap { /// /// Initializes a new instance of the Sitemap class. /// public Sitemap() { CustomInit(); } /// /// Initializes a new instance of the Sitemap class. /// public Sitemap(string location = default(string), string storeId = default(string), IList items = default(IList), string urlTemplate = default(string), int? totalItemsCount = default(int?), IList pagedLocations = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Location = location; StoreId = storeId; Items = items; UrlTemplate = urlTemplate; TotalItemsCount = totalItemsCount; PagedLocations = pagedLocations; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "items")] public IList Items { get; set; } /// /// [JsonProperty(PropertyName = "urlTemplate")] public string UrlTemplate { get; set; } /// /// [JsonProperty(PropertyName = "totalItemsCount")] public int? TotalItemsCount { get; set; } /// /// [JsonProperty(PropertyName = "pagedLocations")] public IList PagedLocations { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapSearchResult { /// /// Initializes a new instance of the SitemapSearchResult class. /// public SitemapSearchResult() { CustomInit(); } /// /// Initializes a new instance of the SitemapSearchResult class. /// public SitemapSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapItemSearchCriteria { /// /// Initializes a new instance of the SitemapItemSearchCriteria class. /// public SitemapItemSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the SitemapItemSearchCriteria class. /// public SitemapItemSearchCriteria(string sitemapId = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { SitemapId = sitemapId; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sitemapId")] public string SitemapId { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapItemsSearchResult { /// /// Initializes a new instance of the SitemapItemsSearchResult class. /// public SitemapItemsSearchResult() { CustomInit(); } /// /// Initializes a new instance of the SitemapItemsSearchResult class. /// public SitemapItemsSearchResult(int? totalCount = default(int?), IList results = default(IList)) { TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SitemapDownloadNotification { /// /// Initializes a new instance of the SitemapDownloadNotification /// class. /// public SitemapDownloadNotification() { CustomInit(); } /// /// Initializes a new instance of the SitemapDownloadNotification /// class. /// public SitemapDownloadNotification(System.DateTime? finished = default(System.DateTime?), long? totalCount = default(long?), long? processedCount = default(long?), long? errorCount = default(long?), IList errors = default(IList), string downloadUrl = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { Finished = finished; TotalCount = totalCount; ProcessedCount = processedCount; ErrorCount = errorCount; Errors = errors; DownloadUrl = downloadUrl; Creator = creator; Created = created; IsNew = isNew; NotifyType = notifyType; Description = description; Title = title; RepeatCount = repeatCount; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "finished")] public System.DateTime? Finished { get; set; } /// /// [JsonProperty(PropertyName = "totalCount")] public long? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "processedCount")] public long? ProcessedCount { get; set; } /// /// [JsonProperty(PropertyName = "errorCount")] public long? ErrorCount { get; private set; } /// /// [JsonProperty(PropertyName = "errors")] public IList Errors { get; set; } /// /// [JsonProperty(PropertyName = "downloadUrl")] public string DownloadUrl { get; set; } /// /// [JsonProperty(PropertyName = "creator")] public string Creator { get; set; } /// /// [JsonProperty(PropertyName = "created")] public System.DateTime? Created { get; set; } /// /// [JsonProperty(PropertyName = "isNew")] public bool? IsNew { get; set; } /// /// [JsonProperty(PropertyName = "notifyType")] public string NotifyType { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// /// [JsonProperty(PropertyName = "repeatCount")] public int? RepeatCount { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/StoreModuleApi.cs ================================================ // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class StoreModuleClient : ServiceClient, IStoreModuleClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// public JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// public JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Subscription credentials which uniquely identify client subscription. /// public ServiceClientCredentials Credentials { get; private set; } /// /// Gets the IStoreModule. /// public virtual IStoreModule StoreModule { get; private set; } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling StoreModuleClient.Dispose(). False: will not dispose provided httpClient protected StoreModuleClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected StoreModuleClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// protected StoreModuleClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected StoreModuleClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// protected StoreModuleClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } BaseUri = baseUri; } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public StoreModuleClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling StoreModuleClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// public StoreModuleClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public StoreModuleClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public StoreModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// Initializes a new instance of the StoreModuleClient class. /// /// /// Optional. The base URI of the service. /// /// /// Required. Subscription credentials which uniquely identify client subscription. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// /// /// Thrown when a required parameter is null /// public StoreModuleClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } if (credentials == null) { throw new System.ArgumentNullException("credentials"); } BaseUri = baseUri; Credentials = credentials; if (Credentials != null) { Credentials.InitializeServiceClient(this); } } /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { StoreModule = new StoreModule(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List { new Iso8601TimeSpanConverter() } }; CustomInitialize(); } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// public partial interface IStoreModuleClient : System.IDisposable { /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. /// JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// JsonSerializerSettings DeserializationSettings { get; } /// /// Subscription credentials which uniquely identify client /// subscription. /// ServiceClientCredentials Credentials { get; } /// /// Gets the IStoreModule. /// IStoreModule StoreModule { get; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// StoreModule operations. /// public partial class StoreModule : IServiceOperations, IStoreModule { /// /// Initializes a new instance of the StoreModule class. /// /// /// Reference to the service client. /// /// /// Thrown when a required parameter is null /// public StoreModule(StoreModuleClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// /// Gets a reference to the StoreModuleClient /// public StoreModuleClient Client { get; private set; } /// /// Search stores /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> SearchStoresWithHttpMessagesAsync(StoreSearchCriteria body = default(StoreSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SearchStores", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get all stores /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task>> GetStoresWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetStores", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Create store /// /// /// Store /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// public async Task> CreateStoreWithHttpMessagesAsync(Store body = default(Store), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateStore", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Update store /// /// /// Store /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task UpdateStoreWithHttpMessagesAsync(Store body = default(Store), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateStore", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Delete stores /// /// /// Ids of store that needed to delete /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task DeleteStoreWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteStore", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores").ToString(); List _queryParameters = new List(); if (ids != null) { _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Get store by id /// /// /// Store id /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetStoreByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetStoreById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores/{id}").ToString(); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Send dynamic notification (contains custom list of properties) to store or /// administrator email /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// A response object containing the response body and response headers. /// public async Task SendDynamicNotificationAnStoreEmailWithHttpMessagesAsync(SendDynamicNotificationRequest body = default(SendDynamicNotificationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "SendDynamicNotificationAnStoreEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores/send/dynamicnotification").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Check if given contact has login on behalf permission /// /// /// Store ID /// /// /// Contact ID /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task> GetLoginOnBehalfInfoWithHttpMessagesAsync(string storeId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (storeId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "storeId"); } if (id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("storeId", storeId); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetLoginOnBehalfInfo", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores/{storeId}/accounts/{id}/loginonbehalf").ToString(); _url = _url.Replace("{storeId}", System.Uri.EscapeDataString(storeId)); _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// /// Returns list of stores which user can sign in /// /// /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// /// /// Thrown when a required parameter is null /// /// /// A response object containing the response body and response headers. /// public async Task>> GetUserAllowedStoresWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetUserAllowedStores", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/stores/allowed/{userId}").ToString(); _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// StoreModule operations. /// public partial interface IStoreModule { /// /// Search stores /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> SearchStoresWithHttpMessagesAsync(StoreSearchCriteria body = default(StoreSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all stores /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task>> GetStoresWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create store /// /// /// Store /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// Task> CreateStoreWithHttpMessagesAsync(Store body = default(Store), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update store /// /// /// Store /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task UpdateStoreWithHttpMessagesAsync(Store body = default(Store), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete stores /// /// /// Ids of store that needed to delete /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task DeleteStoreWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get store by id /// /// /// Store id /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetStoreByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send dynamic notification (contains custom list of properties) to /// store or administrator email /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// Task SendDynamicNotificationAnStoreEmailWithHttpMessagesAsync(SendDynamicNotificationRequest body = default(SendDynamicNotificationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Check if given contact has login on behalf permission /// /// /// Store ID /// /// /// Contact ID /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task> GetLoginOnBehalfInfoWithHttpMessagesAsync(string storeId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns list of stores which user can sign in /// /// /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// Task>> GetUserAllowedStoresWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Extension methods for StoreModule. /// public static partial class StoreModuleExtensions { /// /// Search stores /// /// /// The operations group for this extension method. /// /// /// public static StoreSearchResult SearchStores(this IStoreModule operations, StoreSearchCriteria body = default(StoreSearchCriteria)) { return operations.SearchStoresAsync(body).GetAwaiter().GetResult(); } /// /// Search stores /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SearchStoresAsync(this IStoreModule operations, StoreSearchCriteria body = default(StoreSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SearchStoresWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Get all stores /// /// /// The operations group for this extension method. /// public static IList GetStores(this IStoreModule operations) { return operations.GetStoresAsync().GetAwaiter().GetResult(); } /// /// Get all stores /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// public static async Task> GetStoresAsync(this IStoreModule operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetStoresWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Create store /// /// /// The operations group for this extension method. /// /// /// Store /// public static Store CreateStore(this IStoreModule operations, Store body = default(Store)) { return operations.CreateStoreAsync(body).GetAwaiter().GetResult(); } /// /// Create store /// /// /// The operations group for this extension method. /// /// /// Store /// /// /// The cancellation token. /// public static async Task CreateStoreAsync(this IStoreModule operations, Store body = default(Store), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateStoreWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Update store /// /// /// The operations group for this extension method. /// /// /// Store /// public static void UpdateStore(this IStoreModule operations, Store body = default(Store)) { operations.UpdateStoreAsync(body).GetAwaiter().GetResult(); } /// /// Update store /// /// /// The operations group for this extension method. /// /// /// Store /// /// /// The cancellation token. /// public static async Task UpdateStoreAsync(this IStoreModule operations, Store body = default(Store), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateStoreWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Delete stores /// /// /// The operations group for this extension method. /// /// /// Ids of store that needed to delete /// public static void DeleteStore(this IStoreModule operations, IList ids = default(IList)) { operations.DeleteStoreAsync(ids).GetAwaiter().GetResult(); } /// /// Delete stores /// /// /// The operations group for this extension method. /// /// /// Ids of store that needed to delete /// /// /// The cancellation token. /// public static async Task DeleteStoreAsync(this IStoreModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteStoreWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Get store by id /// /// /// The operations group for this extension method. /// /// /// Store id /// public static Store GetStoreById(this IStoreModule operations, string id) { return operations.GetStoreByIdAsync(id).GetAwaiter().GetResult(); } /// /// Get store by id /// /// /// The operations group for this extension method. /// /// /// Store id /// /// /// The cancellation token. /// public static async Task GetStoreByIdAsync(this IStoreModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetStoreByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Send dynamic notification (contains custom list of properties) to store or /// administrator email /// /// /// The operations group for this extension method. /// /// /// public static void SendDynamicNotificationAnStoreEmail(this IStoreModule operations, SendDynamicNotificationRequest body = default(SendDynamicNotificationRequest)) { operations.SendDynamicNotificationAnStoreEmailAsync(body).GetAwaiter().GetResult(); } /// /// Send dynamic notification (contains custom list of properties) to store or /// administrator email /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task SendDynamicNotificationAnStoreEmailAsync(this IStoreModule operations, SendDynamicNotificationRequest body = default(SendDynamicNotificationRequest), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.SendDynamicNotificationAnStoreEmailWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Check if given contact has login on behalf permission /// /// /// The operations group for this extension method. /// /// /// Store ID /// /// /// Contact ID /// public static LoginOnBehalfInfo GetLoginOnBehalfInfo(this IStoreModule operations, string storeId, string id) { return operations.GetLoginOnBehalfInfoAsync(storeId, id).GetAwaiter().GetResult(); } /// /// Check if given contact has login on behalf permission /// /// /// The operations group for this extension method. /// /// /// Store ID /// /// /// Contact ID /// /// /// The cancellation token. /// public static async Task GetLoginOnBehalfInfoAsync(this IStoreModule operations, string storeId, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetLoginOnBehalfInfoWithHttpMessagesAsync(storeId, id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// /// Returns list of stores which user can sign in /// /// /// The operations group for this extension method. /// /// /// public static IList GetUserAllowedStores(this IStoreModule operations, string userId) { return operations.GetUserAllowedStoresAsync(userId).GetAwaiter().GetResult(); } /// /// Returns list of stores which user can sign in /// /// /// The operations group for this extension method. /// /// /// /// /// The cancellation token. /// public static async Task> GetUserAllowedStoresAsync(this IStoreModule operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetUserAllowedStoresWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyName { /// /// Initializes a new instance of the DynamicPropertyName class. /// public DynamicPropertyName() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyName class. /// public DynamicPropertyName(string locale = default(string), string name = default(string)) { Locale = locale; Name = name; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SeoInfo { /// /// Initializes a new instance of the SeoInfo class. /// public SeoInfo() { CustomInit(); } /// /// Initializes a new instance of the SeoInfo class. /// /// Slug /// head title tag content /// <meta name="description" /// /> /// <meta name="keywords" /> /// Tenant StoreId which SEO defined /// SEO related object id /// SEO related object type name /// Active/Inactive public SeoInfo(string name = default(string), string semanticUrl = default(string), string pageTitle = default(string), string metaDescription = default(string), string imageAltDescription = default(string), string metaKeywords = default(string), string storeId = default(string), string objectId = default(string), string objectType = default(string), bool? isActive = default(bool?), string languageCode = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; SemanticUrl = semanticUrl; PageTitle = pageTitle; MetaDescription = metaDescription; ImageAltDescription = imageAltDescription; MetaKeywords = metaKeywords; StoreId = storeId; ObjectId = objectId; ObjectType = objectType; IsActive = isActive; LanguageCode = languageCode; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets slug /// [JsonProperty(PropertyName = "semanticUrl")] public string SemanticUrl { get; set; } /// /// Gets or sets head title tag content /// [JsonProperty(PropertyName = "pageTitle")] public string PageTitle { get; set; } /// /// Gets or sets &lt;meta name="description" /&gt; /// [JsonProperty(PropertyName = "metaDescription")] public string MetaDescription { get; set; } /// /// [JsonProperty(PropertyName = "imageAltDescription")] public string ImageAltDescription { get; set; } /// /// Gets or sets &lt;meta name="keywords" /&gt; /// [JsonProperty(PropertyName = "metaKeywords")] public string MetaKeywords { get; set; } /// /// Gets or sets tenant StoreId which SEO defined /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// Gets or sets SEO related object id /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// Gets or sets SEO related object type name /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// Gets or sets active/Inactive /// [JsonProperty(PropertyName = "isActive")] public bool? IsActive { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicPropertyObjectValue { /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// public DynamicPropertyObjectValue() { CustomInit(); } /// /// Initializes a new instance of the DynamicPropertyObjectValue class. /// /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' public DynamicPropertyObjectValue(string objectType = default(string), string objectId = default(string), string locale = default(string), object value = default(object), string valueId = default(string), string valueType = default(string), string propertyId = default(string), string propertyName = default(string)) { ObjectType = objectType; ObjectId = objectId; Locale = locale; Value = value; ValueId = valueId; ValueType = valueType; PropertyId = propertyId; PropertyName = propertyName; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "valueId")] public string ValueId { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "propertyId")] public string PropertyId { get; set; } /// /// [JsonProperty(PropertyName = "propertyName")] public string PropertyName { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class DynamicObjectProperty { /// /// Initializes a new instance of the DynamicObjectProperty class. /// public DynamicObjectProperty() { CustomInit(); } /// /// Initializes a new instance of the DynamicObjectProperty class. /// /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' public DynamicObjectProperty(string objectId = default(string), IList values = default(IList), string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ObjectId = objectId; Values = values; Name = name; Description = description; ObjectType = objectType; IsArray = isArray; IsDictionary = isDictionary; IsMultilingual = isMultilingual; IsRequired = isRequired; DisplayOrder = displayOrder; ValueType = valueType; DisplayNames = displayNames; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "values")] public IList Values { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } /// /// [JsonProperty(PropertyName = "isRequired")] public bool? IsRequired { get; set; } /// /// [JsonProperty(PropertyName = "displayOrder")] public int? DisplayOrder { get; set; } /// /// Gets or sets possible values include: 'Undefined', 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', 'Html', /// 'Image' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class ObjectSettingEntry { /// /// Initializes a new instance of the ObjectSettingEntry class. /// public ObjectSettingEntry() { CustomInit(); } /// /// Initializes a new instance of the ObjectSettingEntry class. /// /// Possible values include: 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', /// 'SecureString', 'Json' public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), object value = default(object), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) { ItHasValues = itHasValues; ObjectId = objectId; ObjectType = objectType; Value = value; RestartRequired = restartRequired; ModuleId = moduleId; GroupName = groupName; Name = name; ValueType = valueType; AllowedValues = allowedValues; DefaultValue = defaultValue; IsDictionary = isDictionary; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "itHasValues")] public bool? ItHasValues { get; private set; } /// /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "value")] public object Value { get; set; } /// /// [JsonProperty(PropertyName = "restartRequired")] public bool? RestartRequired { get; set; } /// /// [JsonProperty(PropertyName = "moduleId")] public string ModuleId { get; set; } /// /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets possible values include: 'ShortText', 'LongText', /// 'Integer', 'Decimal', 'DateTime', 'Boolean', 'SecureString', 'Json' /// [JsonProperty(PropertyName = "valueType")] public string ValueType { get; set; } /// /// [JsonProperty(PropertyName = "allowedValues")] public IList AllowedValues { get; set; } /// /// [JsonProperty(PropertyName = "defaultValue")] public object DefaultValue { get; set; } /// /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class Store { /// /// Initializes a new instance of the Store class. /// public Store() { CustomInit(); } /// /// Initializes a new instance of the Store class. /// /// Possible values include: 'Open', 'Closed', /// 'RestrictedAccess' /// Catalog id used as primary store /// catalog /// Store storefront url /// Store storefront https url /// Primary store contact email can be used for /// store event notifications and for feed back /// Primary (default) fulfillment /// center id /// Alternate fulfillment /// centers ids /// Primary (default) /// fulfillment center for order return /// Alternate fulfillment /// centers for order return /// All store supported languages /// All store supported currencies /// All store trusted groups (group of /// stores that shared the user logins) public Store(string name = default(string), string description = default(string), string storeState = default(string), string timeZone = default(string), string country = default(string), string region = default(string), string defaultLanguage = default(string), string defaultCurrency = default(string), string catalog = default(string), bool? creditCardSavePolicy = default(bool?), string url = default(string), string secureUrl = default(string), string email = default(string), string adminEmail = default(string), bool? displayOutOfStock = default(bool?), string outerId = default(string), string mainFulfillmentCenterId = default(string), IList additionalFulfillmentCenterIds = default(IList), string mainReturnsFulfillmentCenterId = default(string), IList returnsFulfillmentCenterIds = default(IList), IList languages = default(IList), IList currencies = default(IList), IList trustedGroups = default(IList), string seoObjectType = default(string), IList seoInfos = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), IList settings = default(IList), string typeName = default(string), IList scopes = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; Description = description; StoreState = storeState; TimeZone = timeZone; Country = country; Region = region; DefaultLanguage = defaultLanguage; DefaultCurrency = defaultCurrency; Catalog = catalog; CreditCardSavePolicy = creditCardSavePolicy; Url = url; SecureUrl = secureUrl; Email = email; AdminEmail = adminEmail; DisplayOutOfStock = displayOutOfStock; OuterId = outerId; MainFulfillmentCenterId = mainFulfillmentCenterId; AdditionalFulfillmentCenterIds = additionalFulfillmentCenterIds; MainReturnsFulfillmentCenterId = mainReturnsFulfillmentCenterId; ReturnsFulfillmentCenterIds = returnsFulfillmentCenterIds; Languages = languages; Currencies = currencies; TrustedGroups = trustedGroups; SeoObjectType = seoObjectType; SeoInfos = seoInfos; ObjectType = objectType; DynamicProperties = dynamicProperties; Settings = settings; TypeName = typeName; Scopes = scopes; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; ModifiedBy = modifiedBy; Id = id; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } /// /// Gets or sets possible values include: 'Open', 'Closed', /// 'RestrictedAccess' /// [JsonProperty(PropertyName = "storeState")] public string StoreState { get; set; } /// /// [JsonProperty(PropertyName = "timeZone")] public string TimeZone { get; set; } /// /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } /// /// [JsonProperty(PropertyName = "region")] public string Region { get; set; } /// /// [JsonProperty(PropertyName = "defaultLanguage")] public string DefaultLanguage { get; set; } /// /// [JsonProperty(PropertyName = "defaultCurrency")] public string DefaultCurrency { get; set; } /// /// Gets or sets catalog id used as primary store catalog /// [JsonProperty(PropertyName = "catalog")] public string Catalog { get; set; } /// /// [JsonProperty(PropertyName = "creditCardSavePolicy")] public bool? CreditCardSavePolicy { get; set; } /// /// Gets or sets store storefront url /// [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// /// Gets or sets store storefront https url /// [JsonProperty(PropertyName = "secureUrl")] public string SecureUrl { get; set; } /// /// Gets or sets primary store contact email can be used for store /// event notifications and for feed back /// [JsonProperty(PropertyName = "email")] public string Email { get; set; } /// /// [JsonProperty(PropertyName = "adminEmail")] public string AdminEmail { get; set; } /// /// [JsonProperty(PropertyName = "displayOutOfStock")] public bool? DisplayOutOfStock { get; set; } /// /// [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } /// /// Gets or sets primary (default) fulfillment center id /// [JsonProperty(PropertyName = "mainFulfillmentCenterId")] public string MainFulfillmentCenterId { get; set; } /// /// Gets or sets alternate fulfillment centers ids /// [JsonProperty(PropertyName = "additionalFulfillmentCenterIds")] public IList AdditionalFulfillmentCenterIds { get; set; } /// /// Gets or sets primary (default) fulfillment center for order return /// [JsonProperty(PropertyName = "mainReturnsFulfillmentCenterId")] public string MainReturnsFulfillmentCenterId { get; set; } /// /// Gets or sets alternate fulfillment centers for order return /// [JsonProperty(PropertyName = "returnsFulfillmentCenterIds")] public IList ReturnsFulfillmentCenterIds { get; set; } /// /// Gets or sets all store supported languages /// [JsonProperty(PropertyName = "languages")] public IList Languages { get; set; } /// /// Gets or sets all store supported currencies /// [JsonProperty(PropertyName = "currencies")] public IList Currencies { get; set; } /// /// Gets or sets all store trusted groups (group of stores that shared /// the user logins) /// [JsonProperty(PropertyName = "trustedGroups")] public IList TrustedGroups { get; set; } /// /// [JsonProperty(PropertyName = "seoObjectType")] public string SeoObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "seoInfos")] public IList SeoInfos { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; private set; } /// /// [JsonProperty(PropertyName = "dynamicProperties")] public IList DynamicProperties { get; set; } /// /// [JsonProperty(PropertyName = "settings")] public IList Settings { get; set; } /// /// [JsonProperty(PropertyName = "typeName")] public string TypeName { get; private set; } /// /// [JsonProperty(PropertyName = "scopes")] public IList Scopes { get; set; } /// /// [JsonProperty(PropertyName = "createdDate")] public System.DateTime? CreatedDate { get; set; } /// /// [JsonProperty(PropertyName = "modifiedDate")] public System.DateTime? ModifiedDate { get; set; } /// /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// /// [JsonProperty(PropertyName = "modifiedBy")] public string ModifiedBy { get; set; } /// /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SortInfo { /// /// Initializes a new instance of the SortInfo class. /// public SortInfo() { CustomInit(); } /// /// Initializes a new instance of the SortInfo class. /// /// Possible values include: 'Ascending', /// 'Descending' public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) { SortColumn = sortColumn; SortDirection = sortDirection; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "sortColumn")] public string SortColumn { get; set; } /// /// Gets or sets possible values include: 'Ascending', 'Descending' /// [JsonProperty(PropertyName = "sortDirection")] public string SortDirection { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class StoreSearchCriteria { /// /// Initializes a new instance of the StoreSearchCriteria class. /// public StoreSearchCriteria() { CustomInit(); } /// /// Initializes a new instance of the StoreSearchCriteria class. /// public StoreSearchCriteria(IList storeIds = default(IList), IList storeStates = default(IList), IList fulfillmentCenterIds = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { StoreIds = storeIds; StoreStates = storeStates; FulfillmentCenterIds = fulfillmentCenterIds; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; ObjectIds = objectIds; Keyword = keyword; SearchPhrase = searchPhrase; LanguageCode = languageCode; Sort = sort; SortInfos = sortInfos; Skip = skip; Take = take; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "storeIds")] public IList StoreIds { get; set; } /// /// [JsonProperty(PropertyName = "storeStates")] public IList StoreStates { get; set; } /// /// [JsonProperty(PropertyName = "fulfillmentCenterIds")] public IList FulfillmentCenterIds { get; set; } /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } /// /// [JsonProperty(PropertyName = "objectTypes")] public IList ObjectTypes { get; set; } /// /// [JsonProperty(PropertyName = "objectIds")] public IList ObjectIds { get; set; } /// /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } /// /// [JsonProperty(PropertyName = "sort")] public string Sort { get; set; } /// /// [JsonProperty(PropertyName = "sortInfos")] public IList SortInfos { get; private set; } /// /// [JsonProperty(PropertyName = "skip")] public int? Skip { get; set; } /// /// [JsonProperty(PropertyName = "take")] public int? Take { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class StoreSearchResult { /// /// Initializes a new instance of the StoreSearchResult class. /// public StoreSearchResult() { CustomInit(); } /// /// Initializes a new instance of the StoreSearchResult class. /// public StoreSearchResult(IList stores = default(IList), int? totalCount = default(int?), IList results = default(IList)) { Stores = stores; TotalCount = totalCount; Results = results; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "stores")] public IList Stores { get; private set; } /// /// [JsonProperty(PropertyName = "totalCount")] public int? TotalCount { get; set; } /// /// [JsonProperty(PropertyName = "results")] public IList Results { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; public partial class SendDynamicNotificationRequest { /// /// Initializes a new instance of the SendDynamicNotificationRequest /// class. /// public SendDynamicNotificationRequest() { CustomInit(); } /// /// Initializes a new instance of the SendDynamicNotificationRequest /// class. /// public SendDynamicNotificationRequest(string storeId = default(string), string type = default(string), IDictionary fields = default(IDictionary), string language = default(string)) { StoreId = storeId; Type = type; Fields = fields; Language = language; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } /// /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// [JsonProperty(PropertyName = "fields")] public IDictionary Fields { get; set; } /// /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } } } // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// /// Represent result for checking of possibility login on behalf request /// public partial class LoginOnBehalfInfo { /// /// Initializes a new instance of the LoginOnBehalfInfo class. /// public LoginOnBehalfInfo() { CustomInit(); } /// /// Initializes a new instance of the LoginOnBehalfInfo class. /// public LoginOnBehalfInfo(string userName = default(string), bool? canLoginOnBehalf = default(bool?)) { UserName = userName; CanLoginOnBehalf = canLoginOnBehalf; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// [JsonProperty(PropertyName = "userName")] public string UserName { get; set; } /// /// [JsonProperty(PropertyName = "canLoginOnBehalf")] public bool? CanLoginOnBehalf { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/AutoRestClients/array-in-query-fix.yml ================================================ directive: - from: swagger-document where: $.paths.*.get.parameters[?(@.schema.type === "array")] transform: | if ($.in === "query") { $.style = "form"; $.explode = true; } reason: polyfill ================================================ FILE: VirtoCommerce.Storefront/Caching/Redis/RedisCachingMessage.cs ================================================ using System; using System.Linq; namespace VirtoCommerce.Storefront.Caching.Redis { internal class RedisCachingMessage { public RedisCachingMessage() { Id = $"{Guid.NewGuid():N}"; CreationDate = DateTime.UtcNow; } public DateTime? CreationDate { get; set; } public string InstanceId { get; set; } public string Id { get; set; } public object[] CacheKeys { get; set; } public bool IsPrefix { get; set; } public bool IsToken { get; set; } public override string ToString() { return $"{InstanceId}:{(IsToken ? "token" : "key")}:{string.Join(", ", CacheKeys?.Select(x => x) ?? Array.Empty())}"; } } } ================================================ FILE: VirtoCommerce.Storefront/Caching/Redis/RedisCachingOptions.cs ================================================ using System; using StackExchange.Redis; namespace VirtoCommerce.Storefront.Caching.Redis { public class RedisCachingOptions { /// /// Gets or sets configuration options exposed by StackExchange.Redis. /// public ConfigurationOptions Configuration { get; set; } = new ConfigurationOptions { // Enable reconnecting by default AbortOnConnectFail = false }; public string ChannelName { get; set; } [Obsolete("Use Redis connection string parameters for retry policy configration")] public int BusRetryCount { get; set; } = 3; } } ================================================ FILE: VirtoCommerce.Storefront/Caching/Redis/RedisStorefrontMemoryCache.cs ================================================ using System; using System.Linq; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; using StackExchange.Redis; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Caching.Redis { internal class RedisStorefrontMemoryCache : StorefrontMemoryCache { private static string _instanceId { get; } = $"{Environment.MachineName}_{Guid.NewGuid():N}"; private readonly ISubscriber _bus; private readonly RedisCachingOptions _redisCachingOptions; private readonly StorefrontOptions _storefrontOptions; private readonly ConnectionMultiplexer _connection; private readonly ILogger _log; private bool _isSubscribed; private bool _disposed; private readonly object _lock = new object(); public RedisStorefrontMemoryCache(IMemoryCache memoryCache , IOptions cachingOptions , IOptions redisCachingOptions , IWorkContextAccessor workContextAccessor , ILoggerFactory loggerFactory ) : base(memoryCache, cachingOptions, loggerFactory, workContextAccessor) { _connection = ConnectionMultiplexer.Connect(redisCachingOptions.Value.Configuration); _log = loggerFactory?.CreateLogger(); _bus = _connection.GetSubscriber(); _redisCachingOptions = redisCachingOptions.Value; _storefrontOptions = cachingOptions.Value; CacheCancellableTokensRegistry.OnTokenCancelled = CacheCancellableTokensRegistry_OnTokenCancelled; } private void CacheCancellableTokensRegistry_OnTokenCancelled(TokenCancelledEventArgs e) { var message = new RedisCachingMessage { InstanceId = _instanceId, IsToken = true, CacheKeys = new[] { e.TokenKey } }; Publish(message); _log.LogTrace($"Published token cancellation message {message}"); } protected virtual void OnConnectionFailed(object sender, ConnectionFailedEventArgs e) { _log.LogError($"Redis disconnected from instance {_instanceId}. Endpoint is {e.EndPoint}, failure type is {e.FailureType}"); // If we have no connection to Redis, we can't invalidate cache on another platform instances, // so the better idea is to disable cache at all for data consistence CacheEnabled = false; // We should fully clear cache because we don't know // what's changed until platform found Redis is unavailable GlobalCacheRegion.ExpireRegion(); } protected virtual void OnConnectionRestored(object sender, ConnectionFailedEventArgs e) { _log.LogTrace($"Redis backplane connection restored for instance {_instanceId}"); // Return cache to the same state as it was initially. // Don't set directly true because it may be disabled in app settings CacheEnabled = _storefrontOptions.CacheEnabled; // We should fully clear cache because we don't know // what's changed in another instances since Redis became unavailable GlobalCacheRegion.ExpireRegion(); } protected virtual void OnMessage(RedisChannel channel, RedisValue redisValue) { var message = JsonConvert.DeserializeObject(redisValue); if (!string.IsNullOrEmpty(message.InstanceId) && !message.InstanceId.EqualsInvariant(_instanceId)) { _log.LogTrace($"Received message {message}"); foreach (var key in message.CacheKeys?.OfType() ?? Array.Empty()) { if (message.IsToken) { _log.LogTrace($"Trying to cancel token with key: {key}"); CacheCancellableTokensRegistry.TryCancelToken(key, raiseEvent: false); } else { _log.LogTrace($"Trying to remove cache entry with key: {key} from in-memory cache"); base.Remove(key); } } } } public override bool TryGetValue(object key, out object value) { //We can't do subscription in the ctor due to the fact that it can be called multiple times despite the fact that it registered as a singleton. //So we have delayed the connection and subscription to the Redis server until the first cache call. EnsureRedisServerConnection(); return base.TryGetValue(key, out value); } protected override void EvictionCallback(object key, object value, EvictionReason reason, object state) { var message = new RedisCachingMessage { InstanceId = _instanceId, CacheKeys = new[] { key } }; Publish(message); _log.LogTrace($"Published message {message} to the Redis backplane"); base.EvictionCallback(key, value, reason, state); } protected virtual RedisChannel GetRedisChannel() { return RedisChannel.Literal(_redisCachingOptions.ChannelName); } private void Publish(RedisCachingMessage message) { EnsureRedisServerConnection(); _bus.Publish(GetRedisChannel(), JsonConvert.SerializeObject(message), CommandFlags.FireAndForget); } private void EnsureRedisServerConnection() { if (!_isSubscribed) { lock (_lock) { if (!_isSubscribed) { _connection.ConnectionFailed += OnConnectionFailed; _connection.ConnectionRestored += OnConnectionRestored; _bus.Subscribe(GetRedisChannel(), OnMessage, CommandFlags.FireAndForget); _log.LogTrace($"Successfully subscribed to Redis backplane channel {_redisCachingOptions.ChannelName} with instance id:{_instanceId}"); _isSubscribed = true; } } } } protected override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { _bus.Unsubscribe(GetRedisChannel(), null, CommandFlags.FireAndForget); _connection.ConnectionFailed -= OnConnectionFailed; _connection.ConnectionRestored -= OnConnectionRestored; } _disposed = true; } base.Dispose(disposing); } } } ================================================ FILE: VirtoCommerce.Storefront/Caching/ServiceCollectionExtensions.cs ================================================ using System; using Microsoft.Extensions.DependencyInjection; using StackExchange.Redis; using VirtoCommerce.Storefront.Caching.Redis; using VirtoCommerce.Storefront.Model.Caching; namespace VirtoCommerce.Storefront.Caching { public static class ServiceCollectionExtensions { public static IServiceCollection AddStorefrontCache(this IServiceCollection services, string redisConnectionString, Action configure) { if (!string.IsNullOrEmpty(redisConnectionString)) { services.Configure(o => { o.Configuration = ConfigurationOptions.Parse(redisConnectionString); configure(o); }); services.AddSingleton(); } else { services.AddSingleton(); } return services; } } } ================================================ FILE: VirtoCommerce.Storefront/Caching/StorefrontMemoryCache.cs ================================================ using System; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Caching { public class StorefrontMemoryCache : IStorefrontMemoryCache { private readonly StorefrontOptions _storefrontOptions; private readonly IMemoryCache _memoryCache; private bool _disposed; private readonly ILogger _log; private readonly IWorkContextAccessor _workContextAccessor; public StorefrontMemoryCache(IMemoryCache memoryCache, IOptions storefrontOptions, ILoggerFactory loggerFactory, IWorkContextAccessor workContextAccessor) { _workContextAccessor = workContextAccessor; _memoryCache = memoryCache; _storefrontOptions = storefrontOptions.Value; CacheEnabled = _storefrontOptions.CacheEnabled; _log = loggerFactory?.CreateLogger(); } public MemoryCacheEntryOptions GetDefaultCacheEntryOptions() { var result = new MemoryCacheEntryOptions(); if (!CacheEnabled) { result.AbsoluteExpirationRelativeToNow = TimeSpan.FromTicks(1); } else { if (AbsoluteExpiration != null) { result.AbsoluteExpirationRelativeToNow = AbsoluteExpiration; } else if (SlidingExpiration != null) { result.SlidingExpiration = SlidingExpiration; } result.AddExpirationToken(GlobalCacheRegion.CreateChangeToken()); } return result; } public virtual ICacheEntry CreateEntry(object key) { var result = _memoryCache.CreateEntry(key); if (result != null) { result.RegisterPostEvictionCallback(callback: EvictionCallback); var options = GetDefaultCacheEntryOptions(); result.SetOptions(options); } return result; } public virtual void Remove(object key) { _memoryCache.Remove(key); } public virtual bool TryGetValue(object key, out object value) { var result = _memoryCache.TryGetValue(key, out value); //Do not use value from cache for preview mode if (_workContextAccessor.WorkContext != null && _workContextAccessor.WorkContext.IsPreviewMode) { result = false; } return result; } protected TimeSpan? AbsoluteExpiration => _storefrontOptions.CacheAbsoluteExpiration; protected TimeSpan? SlidingExpiration => _storefrontOptions.CacheSlidingExpiration; protected bool CacheEnabled { get; set; } ~StorefrontMemoryCache() { Dispose(false); } public void Dispose() { Dispose(true); // This object will be cleaned up by the Dispose method. // Therefore, you should call GC.SupressFinalize to // take this object off the finalization queue // and prevent finalization code for this object // from executing a second time. GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { _memoryCache.Dispose(); } _disposed = true; } } protected virtual void EvictionCallback(object key, object value, EvictionReason reason, object state) { _log.LogInformation($"EvictionCallback: Cache with key {key} has expired."); } } } ================================================ FILE: VirtoCommerce.Storefront/Connected Services/Application Insights/ConnectedService.json ================================================ { "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", "Version": "8.8.712.1", "GettingStartedDocument": { "Uri": "https://go.microsoft.com/fwlink/?LinkID=798432" } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/AccountController.cs ================================================ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Domain.Security; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute("account")] public class AccountController : StorefrontControllerBase { private readonly SignInManager _signInManager; private readonly IAuthorizationService _authorizationService; public AccountController( IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, SignInManager signInManager, IAuthorizationService authorizationService) : base(workContextAccessor, urlBuilder) { _signInManager = signInManager; _authorizationService = authorizationService; } // GET: /account/impersonate/{userId} /// /// Handles the impersonation functionality. It allows an authenticated user to impersonate another user by specifying the userId. /// /// /// [HttpGet("impersonate/{userId}")] public async Task ImpersonateUser(string userId) { // If the user is not authenticated, redirect to the sign-in page if (User.Identity.Name == SecurityConstants.AnonymousUsername) { return StoreFrontRedirect($"~/sign-in?returnUrl={System.Uri.EscapeDataString(Request.Path)}"); } // If the user is not impersonating any user, check permission if (string.IsNullOrEmpty(WorkContext.CurrentUser.OperatorUserId)) { var authorizationResult = await _authorizationService.AuthorizeAsync(User, null, CanImpersonateAuthorizationRequirement.PolicyName); if (!authorizationResult.Succeeded) { return Forbid(); } } // find the user to impersonate var impersonateUser = await _signInManager.UserManager.FindByIdAsync(userId); // if the user is found, update the impersonated user and sign in if (impersonateUser == null) { return NotFound(); } UpdateImpersonatedUser(impersonateUser); await SignOutAndSignInAsync(impersonateUser); // redirect to the home page return StoreFrontRedirect("~/"); } // GET: /account/impersonate/reset /// /// Resets the impersonation state and restore the original user's identity after being impersonated. /// /// [HttpGet("impersonate/reset")] public async Task ResetImpersonatation() { var operatorUserId = WorkContext.CurrentUser.OperatorUserId; if (string.IsNullOrEmpty(operatorUserId)) { return StoreFrontRedirect("~/"); } var operatorUser = await _signInManager.UserManager.FindByIdAsync(operatorUserId); if (operatorUser == null) { return NotFound(); } await SignOutAndSignInAsync(operatorUser); return StoreFrontRedirect("~/"); } /// /// Update operator to the impersonated user or keep current the operator if already impersonating /// /// private void UpdateImpersonatedUser(User impersonateUser) { impersonateUser.OperatorUserId = WorkContext.CurrentUser.OperatorUserId ?? WorkContext.CurrentUser.Id; impersonateUser.OperatorUserName = WorkContext.CurrentUser.OperatorUserName ?? WorkContext.CurrentUser.UserName; impersonateUser.OperatorFullName = WorkContext.CurrentUser.OperatorFullName ?? WorkContext.CurrentUser.Name; } /// /// Sign out the current user and sign in the impersonated user /// /// /// private async Task SignOutAndSignInAsync(User user) { await _signInManager.SignOutAsync(); await _signInManager.SignInAsync(user, isPersistent: false); await SetLastLoginDate(user); } private Task SetLastLoginDate(User user) { user.LastLoginDate = DateTime.UtcNow; user.AccessFailedCount = 0; return _signInManager.UserManager.UpdateAsync(user); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/Api/ApiAccountController.cs ================================================ using System; using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi; using VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Domain.Common; using VirtoCommerce.Storefront.Domain.Security; using VirtoCommerce.Storefront.Domain.Security.Notifications; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Events; using VirtoCommerce.Storefront.Model.Common.Notifications; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Model.Security.Events; using VirtoCommerce.Storefront.Model.Security.Specifications; namespace VirtoCommerce.Storefront.Controllers.Api { [StorefrontApiRoute("account")] [ResponseCache(CacheProfileName = "None")] public class ApiAccountController : StorefrontControllerBase { private readonly SignInManager _signInManager; private readonly IEventPublisher _publisher; private readonly StorefrontOptions _options; private readonly INotifications _platformNotificationApi; private readonly IdentityOptions _identityOptions; public ApiAccountController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, SignInManager signInManager, IEventPublisher publisher, INotifications platformNotificationApi, IOptions options, IOptions identityOptions) : base(workContextAccessor, urlBuilder) { _signInManager = signInManager; _publisher = publisher; _options = options.Value; _platformNotificationApi = platformNotificationApi; _identityOptions = identityOptions.Value; } // GET: storefrontapi/account [Obsolete("Use me query from GraphQL")] [HttpGet] [AllowAnonymous] public ActionResult GetCurrentUser() { return WorkContext.CurrentUser; } [HttpPost("login")] [AllowAnonymous] public async Task> Login([FromBody] Login login, [FromQuery] string returnUrl) { TryValidateModel(login); if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } login.Email = login.Email?.Trim(); login.UserName = login.UserName?.Trim(); User user = null; if (!string.IsNullOrEmpty(login.UserName)) { user = await _signInManager.UserManager.FindByNameAsync(login.UserName); } else if (!string.IsNullOrEmpty(login.Email)) { user = await _signInManager.UserManager.FindByEmailAsync(login.Email); } else { return UserActionIdentityResult.Failed(SecurityErrorDescriber.UsernameOrEmailIsRequired()); } if (user == null) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.LoginFailed()); } var loginResult = await _signInManager.PasswordSignInAsync(user.UserName, login.Password, login.RememberMe, lockoutOnFailure: true); if (!loginResult.Succeeded) { if (loginResult.IsLockedOut) { if (new IsUserLockedByRequiredEmailVerificationSpecification(user).IsSatisfiedBy(WorkContext.CurrentStore)) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.EmailVerificationIsRequired()); } if (new IsUserTemporaryLockedOutSpecification().IsSatisfiedBy(user)) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.UserIsTemporaryLockedOut()); } return UserActionIdentityResult.Failed(SecurityErrorDescriber.UserIsLockedOut()); } return UserActionIdentityResult.Failed(SecurityErrorDescriber.LoginFailed()); } else { if (user.Contact == null) { ResetIdentityCookies(); return UserActionIdentityResult.Failed(SecurityErrorDescriber.UserNotFound()); } if (new IsUserPasswordExpiredSpecification().IsSatisfiedBy(user)) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.PasswordExpired(user.Id)); } if (!new CanUserLoginToStoreSpecification(user).IsSatisfiedBy(WorkContext.CurrentStore)) { ResetIdentityCookies(); return UserActionIdentityResult.Failed(SecurityErrorDescriber.UserCannotLoginInStore()); } } await SetLastLoginDate(user); await _publisher.Publish(new UserLoginEvent(WorkContext, user)); var result = UserActionIdentityResult.Success; if (!string.IsNullOrEmpty(returnUrl)) { var newUrl = Url.IsLocalUrl(returnUrl) ? returnUrl : "~/"; result.ReturnUrl = UrlBuilder.ToAppRelative(newUrl, WorkContext.CurrentStore, WorkContext.CurrentLanguage); } return result; } private void ResetIdentityCookies() { Response.Cookies.Delete(".AspNetCore.Identity.Application"); } // POST: storefrontapi/account/user [Obsolete("Use requestRegistration mutations from GraphQL")] [HttpPost("user")] public async Task> RegisterUser([FromBody] UserRegistration registration) { var result = UserActionIdentityResult.Success; TryValidateModel(registration); if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } // Register user var user = registration.ToUser(); user.Contact = registration.ToContact(); user.StoreId = WorkContext.CurrentStore.Id; var identityResult = await _signInManager.UserManager.CreateAsync(user, registration.Password); if (identityResult.Succeeded) { user = await _signInManager.UserManager.FindByNameAsync(user.UserName); await _publisher.Publish(new UserRegisteredEvent(WorkContext, user, registration)); if (!_identityOptions.SignIn.RequireConfirmedEmail) { await _signInManager.SignInAsync(user, isPersistent: true); await SetLastLoginDate(user); await _publisher.Publish(new UserLoginEvent(WorkContext, user)); } // Send new user registration notification var registrationEmailNotification = new RegistrationEmailNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { FirstName = registration.FirstName, LastName = registration.LastName, Login = registration.UserName, Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; await SendNotificationAsync(registrationEmailNotification); if (_options.SendAccountConfirmation) { var token = await _signInManager.UserManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { UserId = user.Id, Token = token }, protocol: Request.Scheme, host: WorkContext.CurrentStore.Host); var emailConfirmationNotification = new EmailConfirmationNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Url = callbackUrl, Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; var sendNotifcationResult = await SendNotificationAsync(emailConfirmationNotification); if (sendNotifcationResult.IsSuccess == false) { var error = SecurityErrorDescriber.ErrorSendNotification(sendNotifcationResult.ErrorMessage); result = UserActionIdentityResult.Failed(new IdentityError { Code = error.Code, Description = error.Description }); } } } else { result = UserActionIdentityResult.Failed(identityResult.Errors.ToArray()); } return result; } // POST: storefrontapi/account/password [Obsolete("Use changePassword mutation from GraphQL")] [HttpPost("password")] public async Task> ChangePassword([FromBody] ChangePassword formModel) { var result = await _signInManager.UserManager.ChangePasswordAsync(WorkContext.CurrentUser, formModel.OldPassword, formModel.NewPassword); return new PasswordChangeResult { Succeeded = result.Succeeded, Errors = result.Errors.Select(x => new FormError { Code = x.Code.PascalToKebabCase(), Description = x.Description }).ToList() }; } // DELETE: storefrontapi/account/phonenumber [HttpDelete("phonenumber")] public async Task> RemovePhoneNumber() { var twoFactorAuthEnabled = await _signInManager.UserManager.GetTwoFactorEnabledAsync(WorkContext.CurrentUser); if (twoFactorAuthEnabled) { return Forbid(); } var result = await _signInManager.UserManager.SetPhoneNumberAsync(WorkContext.CurrentUser, null); await _signInManager.SignInAsync(WorkContext.CurrentUser, isPersistent: false); return new RemovePhoneNumberResult { Succeeded = result.Succeeded, Errors = result.Errors.Select(x => x.Description) }; } // POST: storefrontapi/account/twofactorauthentification [HttpPost("twofactorauthentification")] public async Task> ChangeTwoFactorAuthentication([FromBody] ChangeTwoFactorAuthenticationModel model) { if (model.Enabled) { var phoneConfirmed = await _signInManager.UserManager.IsPhoneNumberConfirmedAsync(WorkContext.CurrentUser); if (!phoneConfirmed) { var url = "/account/phonenumber"; return new ChangeTwoFactorAuthenticationResult { Succeeded = false, VerificationUrl = url }; } } var result = await _signInManager.UserManager.SetTwoFactorEnabledAsync(WorkContext.CurrentUser, model.Enabled); await _signInManager.SignInAsync(WorkContext.CurrentUser, isPersistent: false); return new ChangeTwoFactorAuthenticationResult { Succeeded = result.Succeeded, Errors = result.Errors.Select(x => x.Description) }; } // POST: storefrontapi/account/phonenumber [HttpPost("phonenumber")] public async Task> UpdatePhoneNumber([FromBody] UpdatePhoneNumberModel model) { var twoFactorAuthEnabled = await _signInManager.UserManager.GetTwoFactorEnabledAsync(WorkContext.CurrentUser); if (twoFactorAuthEnabled) { return Forbid(); } TryValidateModel(model); if (!ModelState.IsValid) { return new UpdatePhoneNumberResult { Succeeded = false, Error = "Phone number is not valid" }; } var result = await _signInManager.UserManager.SetPhoneNumberAsync(WorkContext.CurrentUser, model.PhoneNumber); await _signInManager.SignInAsync(WorkContext.CurrentUser, isPersistent: false); return new UpdatePhoneNumberResult { Succeeded = result.Succeeded }; } // POST: storefrontapi/account/logout [HttpGet("logout")] [AllowAnonymous] public async Task Logout() { await _signInManager.SignOutAsync(); return NoContent(); } // POST: storefrontapi/account/forgotpassword [Obsolete("Use requestPasswordReset mutation from GraphQL")] [HttpPost("forgotPassword")] [AllowAnonymous] public async Task> ForgotPassword([FromBody] ForgotPasswordModel forgotPassword) { var result = UserActionIdentityResult.Success; TryValidateModel(forgotPassword); if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } var user = await _signInManager.UserManager.FindByEmailAsync(forgotPassword.Email); if (user == null) { user = await _signInManager.UserManager.FindByNameAsync(forgotPassword.Email); } if (user == null) { // Don't reveal that the user does not exist return result; } NotificationBase resetPasswordNotification; if (_options.ResetPasswordNotificationGateway.EqualsInvariant("Phone")) { var phoneNumber = await _signInManager.UserManager.GetPhoneNumberAsync(user); if (string.IsNullOrEmpty(phoneNumber)) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.PhoneNumberNotFound()); } var token = await _signInManager.UserManager.GenerateUserTokenAsync(user, TokenOptions.DefaultPhoneProvider, "ResetPassword"); resetPasswordNotification = new ResetPasswordSmsNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = token, Recipient = phoneNumber, }; } else // "Email" { var token = await _signInManager.UserManager.GeneratePasswordResetTokenAsync(user); token = WebUtility.UrlEncode(token); var resetPasswordUri = new UriBuilder(forgotPassword.ResetPasswordUrl) { Query = $"userId={user.Id}&token={token}" }; resetPasswordNotification = new ResetPasswordEmailNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Url = resetPasswordUri.ToString(), Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; } var sendingResult = await SendNotificationAsync(resetPasswordNotification); if (sendingResult.IsSuccess == false) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.ErrorSendNotification(sendingResult.ErrorMessage)); } return result; } // POST: storefrontapi/account/validateToken [Obsolete("This API no longer used. See XAPI documentation")] [HttpPost("validateToken")] [AllowAnonymous] public async Task> ValidateResetPasswordToken([FromBody] ValidateTokenModel model) { var result = UserActionIdentityResult.Success; TryValidateModel(model); if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } var user = await _signInManager.UserManager.FindByIdAsync(model.UserId); if (user == null) { // Don't reveal that the user does not exist return UserActionIdentityResult.Failed(SecurityErrorDescriber.InvalidToken()); } var isValidToken = await _signInManager.UserManager.VerifyUserTokenAsync(user, _signInManager.UserManager.Options.Tokens.PasswordResetTokenProvider, UserManager.ResetPasswordTokenPurpose, model.Token); if (!isValidToken) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.InvalidToken()); } return result; } // POST: storefrontapi/account/resetPassword [Obsolete("Use resetPasswordByToken mutation from GraphQL")] [HttpPost("resetPassword")] [AllowAnonymous] public async Task> ResetPassword([FromBody] ResetPasswordModel model) { var result = UserActionIdentityResult.Success; TryValidateModel(model); if (string.IsNullOrEmpty(model.UserId)) { return UserActionIdentityResult.Failed(SecurityErrorDescriber.ResetPasswordInvalidData()); } if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } var user = await _signInManager.UserManager.FindByIdAsync(model.UserId); if (user == null) { // Don't reveal that the user does not exist return result; } var resetPasswordResult = await _signInManager.UserManager.ResetPasswordAsync(user, model.Token, model.Password); if (!resetPasswordResult.Succeeded) { result = UserActionIdentityResult.Failed(resetPasswordResult.Errors.ToArray()); } return result; } // POST: storefrontapi/account/confirmemail [Obsolete("Use confirmEmail mutation from GraphQL")] [HttpPost("confirmemail")] [AllowAnonymous] public async Task> ConfirmEmail([FromBody] ConfirmEmailModel model) { TryValidateModel(model); if (!ModelState.IsValid) { return UserActionIdentityResult.Failed(ModelState.Values.SelectMany(x => x.Errors) .Select(x => new IdentityError { Description = x.ErrorMessage }) .ToArray()); } var user = await _signInManager.UserManager.FindByIdAsync(model.UserId); if (user == null) { // Don't reveal that the user does not exist return UserActionIdentityResult.Failed(SecurityErrorDescriber.InvalidToken()); } var confirmEmailResult = await _signInManager.UserManager.ConfirmEmailAsync(user, model.Token); if (!confirmEmailResult.Succeeded) { return UserActionIdentityResult.Failed(confirmEmailResult.Errors.ToArray()); } return UserActionIdentityResult.Success; } private static string GetUserEmail(User user) { string email = null; if (user != null) { email = user.Email ?? user.UserName; if (user.Contact != null) { email = user.Contact?.Email ?? email; } } return email; } private async Task SendNotificationAsync(NotificationBase notification) { NotificationSendResult result; try { result = await _platformNotificationApi.SendNotificationByRequestAsync(notification.ToNotificationDto()); } catch (Exception exception) { result = new NotificationSendResult { IsSuccess = false, ErrorMessage = $"Error occurred while sending notification: {exception.Message}" }; } return result; } private Task SetLastLoginDate(User user) { user.LastLoginDate = DateTime.UtcNow; user.AccessFailedCount = 0; return _signInManager.UserManager.UpdateAsync(user); } // GET: storefrontapi/account/passwordrequirements [HttpGet("passwordrequirements")] [AllowAnonymous] public ActionResult GetPasswordRequirements() { return _identityOptions.Password; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/Api/ApiBlogController.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Controllers.Api { [StorefrontApiRoute("blog")] [ResponseCache(CacheProfileName = "None")] public class ApiBlogController : StorefrontControllerBase { public ApiBlogController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder) : base(workContextAccessor, urlBuilder) { } // POST: storefrontapi/blog/{blogName}/search [HttpPost("{blogName}/search")] [ValidateAntiForgeryToken] public ActionResult> Search([FromRoute] string blogName, [FromBody] BlogSearchCriteria criteria) { var articles = new List(); var blog = WorkContext.Blogs.FirstOrDefault(b => b.Name.Equals(blogName, StringComparison.OrdinalIgnoreCase)); if (blog != null) { var query = blog.Articles.AsQueryable().Where(x => x.IsPublished); if (!string.IsNullOrEmpty(criteria.Category)) { query = query.Where(a => !string.IsNullOrEmpty(a.Category) && a.Category.Handelize().EqualsInvariant(criteria.Category)); } if (!string.IsNullOrEmpty(criteria.Tag)) { query = query.Where(a => a.Tags != null && a.Tags.Select(t => t.Handelize()).Contains(criteria.Tag, StringComparer.OrdinalIgnoreCase)); } if (criteria.ExcludedArticleHandles != null && criteria.ExcludedArticleHandles.Any()) { query = query.Where(a => !criteria.ExcludedArticleHandles.Contains(a.Url)); } articles = query.OrderByDescending(a => a.CreatedDate).Skip((criteria.PageNumber - 1) * criteria.PageSize).Take(criteria.PageSize).ToList(); } return articles; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/Api/ApiCommonController.cs ================================================ using System; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Controllers.Api { [StorefrontApiRoute("")] [ResponseCache(CacheProfileName = "None")] public class ApiCommonController : StorefrontControllerBase { private readonly IStoreModule _storeApi; private readonly ISeoInfoService _seoInfoService; private readonly Country[] _countriesWithoutRegions; public ApiCommonController( IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, IStoreModule storeApi, ISeoInfoService seoInfoService) : base(workContextAccessor, urlBuilder) { _storeApi = storeApi; _seoInfoService = seoInfoService; _countriesWithoutRegions = WorkContext.AllCountries .Select(c => new Country { Name = c.Name, Code2 = c.Code2, Code3 = c.Code3, RegionType = c.RegionType }) .ToArray(); } // GET: storefrontapi/countries [Obsolete("Use countries query from GraphQL")] [HttpGet("countries")] public ActionResult GetCountries() { return _countriesWithoutRegions; } // GET: storefrontapi/countries/{countryCode}/regions [Obsolete("Use countries or regions query from GraphQL")] [HttpGet("countries/{countryCode}/regions")] public ActionResult GetCountryRegions(string countryCode) { var country = WorkContext.AllCountries.FirstOrDefault(c => c.Code2.Equals(countryCode, StringComparison.InvariantCultureIgnoreCase) || c.Code3.Equals(countryCode, StringComparison.InvariantCultureIgnoreCase)); if (country != null) { return country.Regions; } return Ok(); } // POST: storefrontapi/feedback [HttpPost("feedback")] [ValidateAntiForgeryToken] public async Task Feedback([FromBody] ContactForm model) { await _storeApi.SendDynamicNotificationAnStoreEmailAsync(model.ToServiceModel(WorkContext)); return Ok(); } [HttpPost("slug")] public async Task GetSlugInfoBySlugAsync([FromBody] SlugInfoRequest slugInfoRequest) { return await GetSlugInfoAsync(slugInfoRequest.Slug, slugInfoRequest.CultureName); } // Wildcard parameters are not supported by OpenAPI (including latest 3.1) // https://stackoverflow.com/a/42880107/507434 [Obsolete("Use GetSlugInfoBySlug (POST /slug) instead")] [HttpGet("slug/{*slug}")] public async Task GetInfoBySlugAsync(string slug, [FromQuery] string culture) { return await GetSlugInfoAsync(slug, culture); } // GET: storefrontapi/version [HttpGet("version")] [AllowAnonymous] public ActionResult Version() { return Ok(System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).FileVersion); } private async Task GetSlugInfoAsync(string slug, string culture) { var result = new SlugInfoResult(); if (string.IsNullOrEmpty(slug)) { return result; } var segments = slug.Split("/", StringSplitOptions.RemoveEmptyEntries); var lastSegment = segments.Last(); var seoInfos = await _seoInfoService.GetBestMatchingSeoInfos(lastSegment, WorkContext.CurrentStore, culture); var bestSeoInfo = seoInfos.FirstOrDefault(); result.EntityInfo = bestSeoInfo; if (result.EntityInfo == null || result.EntityInfo.ObjectType == "ContentFile") { var pageUrl = slug == "__index__home__page__" ? "/" : $"/{slug}"; try { var pages = WorkContext.Pages.Where(p => string.Equals(p.Url, pageUrl, StringComparison.OrdinalIgnoreCase) || string.Equals(p.Url, slug, StringComparison.OrdinalIgnoreCase) ).ToList(); var page = pages.FirstOrDefault(x => x.Language.CultureName.EqualsInvariant(culture)) ?? pages.FirstOrDefault(x => x.Language.IsInvariant) ?? pages.FirstOrDefault(x => x.AliasesUrls.Contains(pageUrl, StringComparer.OrdinalIgnoreCase)); result.ContentItem = page; } catch { //do nothing } } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/Api/ApiStaticContentController.cs ================================================ using System.Linq; using System.Net.Mime; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Models; namespace VirtoCommerce.Storefront.Controllers.Api { [StorefrontApiRoute("content")] [ResponseCache(CacheProfileName = "None")] public class ApiStaticContentController : StorefrontControllerBase { public ApiStaticContentController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder) : base(workContextAccessor, urlBuilder) { } // POST: storefrontapi/content/reset-cache [HttpPost("reset-cache")] public ActionResult ResetCache([FromBody] ResetCacheEventModel webHookEvent) { if (TryResetCacheInternal(webHookEvent?.EventBody?.FirstOrDefault()?.Type)) { return Ok("OK"); } // we can't return 400, because webhook module use it to repeat request return Ok("Failed"); } // POST: storefrontapi/content/reset-cache/theme [HttpPost("reset-cache/{region}")] public ActionResult ResetCacheRegion([FromRoute] string region) { if (TryResetCacheInternal(region)) { return Ok("OK"); } // we can't return 400, because webhook module use it to repeat request return Ok("Failed"); } private static bool TryResetCacheInternal(string region) { switch (region) { case "theme": case "themes": ThemeEngineCacheRegion.ExpireRegion(); return true; case "pages": case "blogs": StaticContentCacheRegion.ExpireRegion(); return true; } return false; } // POST: storefrontapi/content/pages [HttpPost("pages")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult FindPage([FromBody] ContentInThemeSearchCriteria value) { var permalink = value.Permalink; var result = WorkContext.Pages.FirstOrDefault(x => x.Permalink != null && x.Permalink.EqualsInvariant(permalink)); if (result == null) { return NotFound(); } return JsonResult(result.Content); } [HttpPost("templates")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult LoadTemplate([FromBody] ContentInThemeSearchCriteria value) { var result = WorkContext.Templates.FirstOrDefault(x => x.Name == value.TemplateName); if (result == null) { return NotFound(); } return JsonResult(result.Content); } private ActionResult JsonResult(string content) { return Content(content, MediaTypeNames.Application.Json); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/Api/ApiThemeController.cs ================================================ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Controllers.Api { [Obsolete] [StorefrontApiRoute("theme")] [ResponseCache(CacheProfileName = "None")] public class ApiThemeController : StorefrontControllerBase { private readonly ILiquidThemeEngine _liquidThemeEngine; public ApiThemeController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ILiquidThemeEngine liquidThemeEngine) : base(workContextAccessor, urlBuilder) { _liquidThemeEngine = liquidThemeEngine; } // GET: storefrontapi/theme/context [Obsolete("Use store query from GraphQL")] [HttpGet("context")] [AllowAnonymous] public ActionResult GetSpaThemeContext() { var result = SpaThemeContext.Create(WorkContext, UrlBuilder); result.Settings = _liquidThemeEngine.GetSettings(); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/AssetController.cs ================================================ using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Extensions; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute] [AllowAnonymous] public class AssetController : StorefrontControllerBase { private readonly ILiquidThemeEngine _themeEngine; private readonly IContentBlobProvider _contentBlobProvider; private readonly IWebHostEnvironment _hostingEnvironment; public AssetController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ILiquidThemeEngine themeEngine, IContentBlobProvider staticContentBlobProvider, IWebHostEnvironment hostingEnvironment) : base(workContextAccessor, urlBuilder) { _themeEngine = themeEngine; _contentBlobProvider = staticContentBlobProvider; _hostingEnvironment = hostingEnvironment; } /// /// GET: /themes/localization.json /// Return localization resources for current theme /// /// [HttpGet("themes/localization.json")] [ResponseCache(CacheProfileName = "Default")] public ActionResult GetThemeLocalizationJson() { var retVal = _themeEngine.ReadLocalization(); return Json(retVal); } /// /// GET: /themes/settings.json /// Return settings for current theme /// /// [HttpGet("themes/settings.json")] [ResponseCache(CacheProfileName = "Default")] public ActionResult GetThemeSettingsJson() { var retVal = _themeEngine.GetSettings(); return Json(retVal); } /// /// GET: /themes/assets/{*path} /// Handle theme assets requests /// /// /// [HttpGet("themes/assets/{*path}")] [ResponseCache(CacheProfileName = "Default")] public async Task GetThemeAssets(string path) { var stream = await _themeEngine.GetAssetStreamAsync(path); return stream != null ? File(stream, MimeTypes.GetMimeType(path), true) : HandleStaticFiles(path); } /// /// GET: /assets/{*path} /// Handle all static content assets requests /// /// /// [HttpGet("assets/{*path}")] [ResponseCache(CacheProfileName = "Default")] public ActionResult GetStaticContentAssets(string path) { var blobPath = _contentBlobProvider.Search(Path.Combine("Pages", WorkContext.CurrentStore.Id, "assets"), path, true).FirstOrDefault(); if (!string.IsNullOrEmpty(blobPath)) { var stream = _contentBlobProvider.OpenRead(blobPath); if (stream != null) { return File(stream, MimeTypes.GetMimeType(blobPath)); } } return NotFound(); } /// /// Serve static files. This controller called from SeoRoute when it cannot find any other routes for request. /// /// /// public ActionResult HandleStaticFiles(string path) { path = _hostingEnvironment.MapPath("~/" + path); var mimeType = MimeTypes.GetMimeType(path); if (System.IO.File.Exists(path) && mimeType != "application/octet-stream") { return PhysicalFile(path, MimeTypes.GetMimeType(path)); } return NotFound(); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/CommonController.cs ================================================ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Middleware; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Models; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute] public class CommonController : StorefrontControllerBase { private readonly IStoreModule _storeApi; private readonly SignInManager _signInManager; public CommonController(IWorkContextAccessor workContextAccesor, IStorefrontUrlBuilder urlBuilder, IStoreModule storeApi, SignInManager signInManager) : base(workContextAccesor, urlBuilder) { _storeApi = storeApi; _signInManager = signInManager; } /// /// GET : /resetcache /// /// [HttpGet("common/resetcache")] [Authorize(SecurityConstants.Permissions.CanResetCache)] public ActionResult ResetCache() { GlobalCacheRegion.ExpireRegion(); return StoreFrontRedirect("~/"); } /// /// POST : /contact /// /// /// /// [HttpPost("contact/{viewName?}")] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task ContactForm([FromForm] ContactForm model, string viewName = "page.contact") { await _storeApi.SendDynamicNotificationAnStoreEmailAsync(model.ToServiceModel(WorkContext)); if (model.Contact.ContainsKey("RedirectUrl") && model.Contact["RedirectUrl"].Any()) { return StoreFrontRedirect(model.Contact["RedirectUrl"].First()); } return View(viewName, WorkContext); } /// /// GET: common/setcurrency/{currency} /// Set current currency for current user session /// /// /// /// //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] [HttpGet("common/setcurrency/{currency}")] public async Task SetCurrency(string currency, string returnUrl = "") { WorkContext.CurrentUser.SelectedCurrencyCode = currency; await _signInManager.RefreshSignInAsync(WorkContext.CurrentUser); //home page and prevent open redirection attack if (string.IsNullOrEmpty(returnUrl) || !Url.IsLocalUrl(returnUrl)) { returnUrl = "~/"; } return StoreFrontRedirect(returnUrl); } // GET: common/getcountries/json [Obsolete("Use countries query from GraphQL")] [HttpGet("common/getcountries/json")] public ActionResult GetCountries() { return Json(WorkContext.AllCountries.Select(c => new Country { Name = c.Name, Code2 = c.Code2, Code3 = c.Code3, RegionType = c.RegionType }) .ToArray()); } // GET: common/getregions/{countryCode}/json [Obsolete("Use countries or regions query from GraphQL")] [HttpGet("common/getregions/{countryCode}/json")] public ActionResult GetRegions(string countryCode) { Country country = null; if (countryCode != null) { if (countryCode.Length == 3) { country = WorkContext.AllCountries.FirstOrDefault(c => c.Code3.EqualsInvariant(countryCode)); } else if (countryCode.Length == 2) { country = WorkContext.AllCountries.FirstOrDefault(c => c.Code2.EqualsInvariant(countryCode)); } } if (country != null) { return Json(country.Regions); } return NotFound(); } // GET: common/maintenance [HttpGet("common/maintenance")] [Route("maintenance")] public ActionResult Maintenance() { return View("Maintenance"); } /// /// An internal special method for handling permanent redirection from routing rules /// /// URL to redirect /// Redirect to URL [HttpOptions] public ActionResult InternalRedirect([FromRoute] string url) { return StoreFrontRedirectPermanent(url); } // GET: common/notheme [HttpGet("common/notheme")] public ActionResult NoTheme() { if (!HttpContext.Items.TryGetValue(NoLiquidThemeMiddleware.NoThemeModelKey, out var viewModel)) { viewModel = new NoThemeViewModel(); } return View("NoTheme", viewModel); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/DesignerPreviewController.cs ================================================ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute] [AllowAnonymous] public class DesignerPreviewController : StorefrontControllerBase { public DesignerPreviewController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder) : base(workContextAccessor, urlBuilder) { } [HttpGet("designer-preview")] public IActionResult Index() { WorkContext.Layout = Request.Query["layout"].ToString(); return View("preview", WorkContext); } [HttpPost("designer-preview/block")] //We can't use AntiForgery check here due to IFrame limitations. Browsers don't send cookies from IFrames. //[ValidateAntiForgeryToken] public IActionResult Block([FromBody] dynamic data) { var page = new ContentPage { Content = $@"{{ ""settings"": {{}}, ""content"": [ {data} ] }}" }; WorkContext.CurrentPage = page; var viewName = "json-blocks"; return PartialView(viewName, WorkContext); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/ErrorController.cs ================================================ using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute("error")] public class ErrorController : StorefrontControllerBase { private readonly ISeoInfoService _seoInfoService; private readonly ISpaRouteService _spaRouteService; public ErrorController( IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ISeoInfoService seoInfoService, ISpaRouteService spaRouteService) : base(workContextAccessor, urlBuilder) { _seoInfoService = seoInfoService; _spaRouteService = spaRouteService; } [Route("{errCode}")] public async Task Error(int? errCode) { //Returns index page on 404 error when the store.IsSpa flag is activated if (errCode == StatusCodes.Status404NotFound && WorkContext.CurrentStore.IsSpa) { var path = TrimTwoLetterLangSegment(Request.HttpContext.Features.Get()?.OriginalPath); Response.StatusCode = StatusCodes.Status404NotFound; if (path == "/") { Response.StatusCode = StatusCodes.Status200OK; return View("index"); } if (string.IsNullOrEmpty(path)) { return View("index"); } var slug = path.Split('/').Last(); if (!string.IsNullOrEmpty(slug)) { var seoInfos = await _seoInfoService.GetBestMatchingSeoInfos(slug, WorkContext.CurrentStore, WorkContext.CurrentLanguage.CultureName); Response.StatusCode = seoInfos.Any() ? StatusCodes.Status200OK : StatusCodes.Status404NotFound; } if (Response.StatusCode == StatusCodes.Status404NotFound) { Response.StatusCode = _seoInfoService.GetContentItem($"/{slug}", WorkContext) != null ? StatusCodes.Status200OK : StatusCodes.Status404NotFound; } if (Response.StatusCode == StatusCodes.Status404NotFound) { Response.StatusCode = await _spaRouteService.IsSpaRoute(path) ? StatusCodes.Status200OK : StatusCodes.Status404NotFound; } return View("index"); } var exceptionFeature = base.HttpContext.Features.Get(); if (exceptionFeature != null && exceptionFeature.Error is StorefrontException storefrontException && storefrontException.View != null) { return View(storefrontException.View); } if (errCode == StatusCodes.Status404NotFound || errCode == StatusCodes.Status500InternalServerError) { return View(errCode.ToString()); } return View(); } [Route("AccessDenied")] public IActionResult AccessDenied() { Response.StatusCode = StatusCodes.Status403Forbidden; return View("AccessDenied"); } private string TrimTwoLetterLangSegment(string path) { var language = WorkContext.CurrentStore.Languages.FirstOrDefault(x => Regex.IsMatch(path, @"^/\b" + x.TwoLetterLanguageName + @"\b/", RegexOptions.IgnoreCase)); if (language != null) { path = Regex.Replace(path, @"/\b" + language.TwoLetterLanguageName + @"\b/", "/", RegexOptions.IgnoreCase); } return path; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/HomeController.cs ================================================ using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Infrastructure; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute] public class HomeController : Controller { [HttpGet] public IActionResult Index() { return View("index"); } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/SitemapController.cs ================================================ using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Controllers { [StorefrontRoute] public class SitemapController : StorefrontControllerBase { private readonly ISitemapsModuleApiOperations _siteMapApi; private readonly ILiquidThemeEngine _liquidThemeEngine; public SitemapController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, ISitemapsModuleApiOperations siteMapApi, ILiquidThemeEngine themeEngine) : base(workContextAccessor, urlBuilder) { _liquidThemeEngine = themeEngine; _siteMapApi = siteMapApi; } /// /// GET: /sitemap.xml /// Return generated sitemap index sitemap.xml /// /// [HttpGet("sitemap.xml")] public async Task GetSitemapIndex() { var stream = await TryGetSitemapStream("sitemap.xml"); if (stream != null) { return File(stream, "text/xml"); } return NotFound("sitemap.xml"); } /// /// GET: /sitemap/sitemap-1.xml /// Return generated sitemap by file /// /// [HttpGet("sitemap/{sitemapPath}")] public async Task GetSitemap(string sitemapPath) { var stream = await TryGetSitemapStream("sitemap/" + sitemapPath); if (stream != null) { return File(stream, "text/xml"); } return NotFound(sitemapPath); } private async Task TryGetSitemapStream(string filePath) { //If sitemap files have big size for generation on the fly you might place already generated xml files in the theme/assets folder or schedule // execution of GenerateSitemapJob.GenerateStoreSitemap method for pre-generation sitemaps var stream = await _liquidThemeEngine.GetAssetStreamAsync(filePath); if (stream == null) { var absUrl = UrlBuilder.ToAppAbsolute("~/", WorkContext.CurrentStore, WorkContext.CurrentLanguage); var storeUrl = new Uri(WorkContext.RequestUrl, absUrl).ToString(); //remove language from base url SitemapAPI will add it automatically storeUrl = storeUrl.Replace("/" + WorkContext.CurrentLanguage.CultureName + "/", "/"); stream = await _siteMapApi.GenerateSitemapAsync(WorkContext.CurrentStore.Id, storeUrl, filePath); } return stream; } } } ================================================ FILE: VirtoCommerce.Storefront/Controllers/StorefrontControllerBase.cs ================================================ using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Controllers { public class StorefrontControllerBase : Controller { protected IStorefrontUrlBuilder UrlBuilder { get; } protected WorkContext WorkContext { get; } public StorefrontControllerBase(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder) { WorkContext = workContextAccessor.WorkContext; UrlBuilder = urlBuilder; } protected RedirectResult StoreFrontRedirect(string url) { var newUrl = Url.IsLocalUrl(url) ? url : "~/"; var appRelativeUrl = UrlBuilder.ToAppRelative(newUrl, WorkContext.CurrentStore, WorkContext.CurrentLanguage); return base.Redirect(appRelativeUrl); } protected RedirectResult StoreFrontRedirectPermanent(string url) { var newUrl = Url.IsLocalUrl(url) ? url : "~/"; var appRelativeUrl = UrlBuilder.ToAppRelative(newUrl, WorkContext.CurrentStore, WorkContext.CurrentLanguage); return base.RedirectPermanent(appRelativeUrl); } } } ================================================ FILE: VirtoCommerce.Storefront/DependencyInjection/ServiceCollectionExtension.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Reflection; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.Rest; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi; using VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi; using VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi; using VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi; using VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.AutoRestClients.SitemapsModuleApi; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Infrastructure.Autorest; using VirtoCommerce.Storefront.Model.Common.Bus; using VirtoCommerce.Storefront.Model.Common.Events; using VirtoCommerce.Storefront.Model.Common.Messages; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.DependencyInjection { public static class PollyPolicyName { public const string HttpCircuitBreaker = nameof(HttpCircuitBreaker); public const string HttpRetry = nameof(HttpRetry); } public static class ServiceCollectionExtension { private const string PlatformEndpointHttpClientName = "PlatformEndpoint"; /// /// Add common http clients handlers and pollicy that will be used to communicate with platform /// /// /// private static IServiceCollection AddPlatformEnpointHttpClient(this IServiceCollection services) { services.AddHttpClient(PlatformEndpointHttpClientName) .ConfigureHttpClient((sp, httpClient) => { var platformEndpointOptions = sp.GetRequiredService>().Value; httpClient.BaseAddress = platformEndpointOptions.Url; httpClient.Timeout = platformEndpointOptions.RequestTimeout; }) .ConfigurePrimaryHttpMessageHandler(x => new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, UseCookies = false }) .AddHttpMessageHandler(sp => sp.GetService().CreateAuthHandler()); return services; } /// /// init autorest generated ServiceClient instance with platform enpoint HttpClient and add it into DI services as singlton /// /// /// /// /// private static IServiceCollection AddAutoRestClient(this IServiceCollection services, Func serviceClientFactory) where TServiceClient : ServiceClient { services.AddSingleton(sp => { var platformEndpointOptions = sp.GetRequiredService>().Value; var httpClientFactory = sp.GetRequiredService(); var httpClient = httpClientFactory.CreateClient(PlatformEndpointHttpClientName); var serviceClient = serviceClientFactory(new EmptyServiceClientCredentials(), httpClient, true, platformEndpointOptions.Url); return serviceClient; }); return services; } public static void AddPlatformEndpoint(this IServiceCollection services, Action setupAction = null) { ServicePointManager.UseNagleAlgorithm = false; services.AddSingleton(sp => new EmptyServiceClientCredentials()); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddSingleton(); services.AddHttpClient(); services.AddPlatformEnpointHttpClient(); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new StoreModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new StoreModule(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new CoreModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new Commerce(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new CatalogModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new CatalogModuleCategories(sp.GetRequiredService())); services.AddSingleton(sp => new CatalogModuleProducts(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new PlatformModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new Security(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new NotificationsModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new Notifications(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new CustomerModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new CustomerModule(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new ContentModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new Menu(sp.GetRequiredService())); services.AddSingleton(sp => new Content(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new SitemapsModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new SitemapsModuleApiOperations(sp.GetRequiredService())); services.AddAutoRestClient((credentials, httpClient, disposeHttpClient, baseUri) => new PlatformModuleClient(credentials, httpClient, disposeHttpClient) { BaseUri = baseUri }); services.AddSingleton(sp => new ChangeLog(sp.GetRequiredService())); if (setupAction != null) { services.Configure(setupAction); } } public static void AddFileSystemBlobContent(this IServiceCollection services, Action setupAction = null) { services.AddSingleton(); if (setupAction != null) { services.Configure(setupAction); } } public static void AddAzureBlobContent(this IServiceCollection services, Action setupAction = null) { services.AddSingleton(); if (setupAction != null) { services.Configure(setupAction); } } public static void AddLiquidViewEngine(this IServiceCollection services, Action setupAction = null) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); if (setupAction != null) { services.Configure(setupAction); } } //Register event handlers through reflection public static void RegisterAssembliesEventHandlers(this IServiceCollection services, params Type[] typesFromAssemblyContainingMessages) { //Scan for eventhandlers services.Scan(scan => scan .FromAssemblies(typesFromAssemblyContainingMessages.Select(x => x.Assembly)) .AddClasses(classes => classes.Where(x => { var allInterfaces = x.GetInterfaces(); return allInterfaces.Any(y => y.GetTypeInfo().IsGenericType && y.GetTypeInfo().GetGenericTypeDefinition() == typeof(IHandler<>)) || allInterfaces.Any(y => y.GetTypeInfo().IsGenericType && y.GetTypeInfo().GetGenericTypeDefinition() == typeof(ICancellableHandler<>)); })) .AsSelf() .WithTransientLifetime() ); var serviceProvider = services.BuildServiceProvider(); var handlerRegistrar = serviceProvider.GetService(); foreach (var typesFromAssemblyContainingMessage in typesFromAssemblyContainingMessages) { var executorsAssembly = typesFromAssemblyContainingMessage.GetTypeInfo().Assembly; var executorTypes = executorsAssembly .GetTypes() .Select(t => new { Type = t, Interfaces = ResolveMessageHandlerInterface(t) }) .Where(e => e.Interfaces != null && e.Interfaces.Any()); foreach (var executorType in executorTypes) { foreach (var @interface in executorType.Interfaces) { InvokeHandler(@interface, handlerRegistrar, executorType.Type, serviceProvider); } } } } private static void InvokeHandler(Type @interface, IHandlerRegistrar registrar, Type executorType, ServiceProvider serviceProvider) { var commandType = @interface.GetGenericArguments()[0]; var registerExecutorMethod = registrar .GetType() .GetMethods(BindingFlags.Instance | BindingFlags.Public) .Where(mi => mi.Name == "RegisterHandler") .Where(mi => mi.IsGenericMethod) .Where(mi => mi.GetGenericArguments().Length == 1) .Single(mi => mi.GetParameters().Length == 1) .MakeGenericMethod(commandType); Func del; if (IsCancellable(@interface)) { del = (x, token) => { dynamic handler = serviceProvider.GetService(executorType); return handler.Handle(x, token); }; } else { del = (x, token) => { dynamic handler = serviceProvider.GetService(executorType); return handler.Handle(x); }; } registerExecutorMethod.Invoke(registrar, new object[] { del }); } private static bool IsCancellable(Type @interface) { return @interface.GetGenericTypeDefinition() == typeof(ICancellableEventHandler<>); } private static IEnumerable ResolveMessageHandlerInterface(Type type) { return type .GetInterfaces() .Where(i => i.GetTypeInfo().IsGenericType && (i.GetGenericTypeDefinition() == typeof(IEventHandler<>) || i.GetGenericTypeDefinition() == typeof(ICancellableEventHandler<>))); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/AddressConverter.cs ================================================ using System; using System.Linq; using VirtoCommerce.Storefront.Model; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static class AddressConverter { public static Address ToAddress(this coreDto.Address addressDto) { var retVal = new Address { Key = addressDto.Key, City = addressDto.City, CountryCode = addressDto.CountryCode, CountryName = addressDto.CountryName, Email = addressDto.Email, FirstName = addressDto.FirstName, LastName = addressDto.LastName, Line1 = addressDto.Line1, Line2 = addressDto.Line2, MiddleName = addressDto.MiddleName, Name = addressDto.Name, Organization = addressDto.Organization, Phone = addressDto.Phone, PostalCode = addressDto.PostalCode, RegionId = addressDto.RegionId, RegionName = addressDto.RegionName, Zip = addressDto.Zip, Type = (AddressType)Enum.Parse(typeof(AddressType), addressDto.AddressType, true) }; return retVal; } public static coreDto.Address ToCoreAddressDto(this Address address) { var retVal = new coreDto.Address { Key = address.Key, City = address.City, CountryCode = address.CountryCode, CountryName = address.CountryName, Email = address.Email, FirstName = address.FirstName, LastName = address.LastName, Line1 = address.Line1, Line2 = address.Line2, MiddleName = address.MiddleName, Name = address.Name, Organization = address.Organization, Phone = address.Phone, PostalCode = address.PostalCode, RegionId = address.RegionId, RegionName = address.RegionName, Zip = address.Zip, AddressType = address.Type.ToString() }; return retVal; } public static Address ToWebModel(this Address address, Country[] countries) { var result = new Address(); result.CopyFrom(address, countries); return result; } public static Address CopyFrom(this Address result, Address address, Country[] countries) { result.City = address.City; result.CountryCode = address.CountryCode; result.FirstName = address.FirstName; result.LastName = address.LastName; result.Name = address.Name; result.Phone = address.Phone; result.Zip = address.Zip; result.Organization = address.Company; result.CountryName = address.Country; result.PostalCode = address.Zip; result.Line1 = address.Address1; result.Line2 = address.Address2; result.RegionName = address.Province; result.Name = result.ToString(); var country = countries.FirstOrDefault(c => string.Equals(c.Name, address.Country, StringComparison.OrdinalIgnoreCase)); if (country != null) { result.CountryCode = country.Code3; if (address.Province != null && country.Regions != null) { var region = country.Regions.FirstOrDefault(r => string.Equals(r.Name, address.Province, StringComparison.OrdinalIgnoreCase)); if (region != null) { result.RegionId = region.Code; } } } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/ContactUsFormConverter.cs ================================================ using System.Linq; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain { public static class ContactUsFormConverter { public static SendDynamicNotificationRequest ToServiceModel(this ContactForm contactUsForm, WorkContext workContext) { var retVal = new SendDynamicNotificationRequest { Language = workContext.CurrentLanguage.CultureName, StoreId = workContext.CurrentStore.Id, Type = contactUsForm.FormType, Fields = contactUsForm.Contact.ToDictionary(x => x.Key, x => x.Value != null ? string.Join(", ", x.Value) : string.Empty) }; return retVal; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/CurrencyConverter.cs ================================================ using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static class CurrencyConverter { public static Currency ToCurrency(this coreDto.Currency currency, Language language) { var retVal = new Currency(language, currency.Code, currency.Name, currency.Symbol, (decimal)currency.ExchangeRate.Value) { CustomFormatting = currency.CustomFormatting }; return retVal; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/DynamicPropertyConverter.cs ================================================ using System.Globalization; using System.Linq; using Newtonsoft.Json.Linq; using VirtoCommerce.Storefront.Model; using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static class DynamicPropertyConverter { public static DynamicProperty ToDynamicProperty(this platformDto.DynamicObjectProperty propertyDto) { var result = new DynamicProperty(); result.Id = propertyDto.Id; result.IsArray = propertyDto.IsArray ?? false; result.IsDictionary = propertyDto.IsDictionary ?? false; result.IsRequired = propertyDto.IsRequired ?? false; result.Name = propertyDto.Name; result.ValueType = propertyDto.ValueType; if (propertyDto.DisplayNames != null) { result.DisplayNames = propertyDto.DisplayNames.Select(x => new LocalizedString(new Language(x.Locale), x.Name)).ToList(); } if (propertyDto.Values != null) { if (result.IsDictionary) { var dictValues = propertyDto.Values .Where(x => x.Value != null) .Select(x => x.Value) .Cast() .Select(x => x.ToObject()) .ToArray(); result.DictionaryValues = dictValues.Select(x => x.ToDictItem()).ToList(); } else { result.Values = propertyDto.Values .Where(x => x.Value != null) .Select(x => x.ToLocalizedString()) .ToList(); } } return result; } public static platformDto.DynamicObjectProperty ToDynamicPropertyDto(this DynamicProperty dynamicProperty) { var result = new platformDto.DynamicObjectProperty(); result.Id = dynamicProperty.Id; result.IsArray = dynamicProperty.IsArray; result.IsDictionary = dynamicProperty.IsDictionary; result.IsRequired = dynamicProperty.IsRequired; result.Name = dynamicProperty.Name; result.ValueType = dynamicProperty.ValueType; if (dynamicProperty.Values != null) { result.Values = dynamicProperty.Values.Select(v => v.ToPropertyValueDto()).ToList(); } else if (dynamicProperty.DictionaryValues != null) { result.Values = dynamicProperty.DictionaryValues.Select(x => x.ToPropertyValueDto()).ToList(); } return result; } private static DynamicPropertyDictionaryItem ToDictItem(this platformDto.DynamicPropertyDictionaryItem dto) { var result = new DynamicPropertyDictionaryItem(); result.Id = dto.Id; result.Name = dto.Name; result.PropertyId = dto.PropertyId; if (dto.DisplayNames != null) { result.DisplayNames = dto.DisplayNames.Select(x => new LocalizedString(new Language(x.Locale), x.Name)).ToList(); } return result; } private static LocalizedString ToLocalizedString(this platformDto.DynamicPropertyObjectValue dto) { return new LocalizedString(new Language(dto.Locale), string.Format(CultureInfo.InvariantCulture, "{0}", dto.Value)); } private static platformDto.DynamicPropertyObjectValue ToPropertyValueDto(this DynamicPropertyDictionaryItem dictItem) { var result = new platformDto.DynamicPropertyObjectValue { Value = dictItem }; return result; } private static platformDto.DynamicPropertyObjectValue ToPropertyValueDto(this LocalizedString dynamicPropertyObjectValue) { var result = new platformDto.DynamicPropertyObjectValue { Value = dynamicPropertyObjectValue.Value, Locale = dynamicPropertyObjectValue.Language.CultureName }; return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/NotificationConverter.cs ================================================ using System.Linq; using VirtoCommerce.Storefront.AutoRestClients.NotificationsModuleApi.Models; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Common { public static class NotificationConverter { public static NotificationRequest ToNotificationDto(this NotificationBase notification) { var result = new NotificationRequest { Language = notification.Language.CultureName, ObjectId = notification.StoreId, ObjectTypeId = "Store", Type = notification.Type, NotificationParameters = notification.GetNotificationParameters().Select(x => new NotificationParameter { Type = "String", Value = x.Value, ParameterName = x.Key }).ToList() }; return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/SeoInfoConverter.cs ================================================ using VirtoCommerce.Storefront.Model; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static class SeoInfoConverter { public static SeoInfo ToSeoInfo(this coreDto.SeoInfo seoDto) { var retVal = new SeoInfo { Id = seoDto.Id, ObjectId = seoDto.ObjectId, ObjectType = seoDto.ObjectType, IsActive = seoDto.IsActive, MetaDescription = seoDto.MetaDescription, MetaKeywords = seoDto.MetaKeywords, Slug = seoDto.SemanticUrl, Title = seoDto.PageTitle, Language = string.IsNullOrEmpty(seoDto.LanguageCode) ? Language.InvariantLanguage : new Language(seoDto.LanguageCode) }; return retVal; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/SettingConverter.cs ================================================ using System.Linq; using VirtoCommerce.Storefront.Model; using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static class SettingConverter { public static SettingEntry ToSettingEntry(this platformDto.ObjectSettingEntry settingDto) { var retVal = new SettingEntry { DefaultValue = settingDto.DefaultValue, IsArray = false, Name = settingDto.Name, Value = settingDto.Value, ValueType = settingDto.ValueType }; if (settingDto.AllowedValues != null) { retVal.AllowedValues = settingDto.AllowedValues.ToList(); } return retVal; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Common/ToolsConverter.cs ================================================ using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; using toolsDto = VirtoCommerce.Tools.Models; namespace VirtoCommerce.Storefront.Domain { public static class ToolsConverter { public static toolsDto.UrlBuilderContext ToToolsContext(this WorkContext workContext) { return new toolsDto.UrlBuilderContext { CurrentUrl = workContext.RequestUrl?.ToString(), CurrentLanguage = workContext.CurrentLanguage?.CultureName, CurrentStore = workContext.CurrentStore.ToToolsStore(), AllStores = workContext.AllStores?.Select(ToToolsStore).ToList(), }; } public static toolsDto.Store ToToolsStore(this Store store) { toolsDto.Store result = null; if (store != null) { result = new toolsDto.Store { Id = store.Id, Url = store.Url, SecureUrl = store.SecureUrl, Catalog = store.Catalog, DefaultLanguage = store.DefaultLanguage.CultureName, SeoLinksType = store.SeoLinksType.ToToolsSeoLinksType(), Languages = store.Languages.Select(l => l.CultureName).ToList(), }; } return result; } public static toolsDto.SeoLinksType ToToolsSeoLinksType(this SeoLinksType seoLinksType) { return EnumUtility.SafeParse(seoLinksType.ToString(), toolsDto.SeoLinksType.None); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/AzureBlobContentOptions.cs ================================================ using System; using Microsoft.WindowsAzure.Storage.Blob; namespace VirtoCommerce.Storefront.Domain { public class AzureBlobContentOptions { public string Container { get; set; } public string ConnectionString { get; set; } public bool PollForChanges { get; set; } = false; public TimeSpan ChangesPollingInterval { get; set; } = TimeSpan.FromSeconds(15); public BlobRequestOptions BlobRequestOptions { get; set; } = new BlobRequestOptions(); } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/AzureBlobContentProvider.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Common.Exceptions; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class AzureBlobContentProvider : IContentBlobProvider { private readonly CloudBlobClient _cloudBlobClient; private readonly CloudBlobContainer _container; private readonly IStorefrontMemoryCache _memoryCache; private readonly AzureBlobContentOptions _options; private readonly IBlobChangesWatcher _watcher; public AzureBlobContentProvider(IOptions options, IStorefrontMemoryCache memoryCache, IBlobChangesWatcher watcher) { _options = options.Value; _memoryCache = memoryCache; if (!CloudStorageAccount.TryParse(_options.ConnectionString, out var cloudStorageAccount)) { throw new StorefrontException("Failed to get valid connection string"); } _cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); _container = _cloudBlobClient.GetContainerReference(_options.Container); _watcher = watcher; } #region IContentBlobProvider Members /// /// Open blob for read /// /// blob relative path /folder/blob.md /// public virtual Stream OpenRead(string path) { return OpenReadAsync(path).GetAwaiter().GetResult(); } public virtual Task OpenReadAsync(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } path = NormalizePath(path); return OpenReadInternalAsync(path); } protected virtual async Task OpenReadInternalAsync(string path) { path = NormalizePath(path); Stream result = null; try { result = await _container.GetBlobReference(path).OpenReadAsync(); } catch (Exception) { //we should not throw an exception for the missed directories and return null as result, because the Azure blob storage does not allow us to check if directories exist //and PathExists method will always return true for these paths. if (!string.IsNullOrEmpty(Path.GetExtension(path))) { //Throw the not found exception for files throw; } } return result; } /// /// Open blob for write by path /// /// /// blob stream public virtual Stream OpenWrite(string path) { return OpenWriteAsync(path).GetAwaiter().GetResult(); } public virtual async Task OpenWriteAsync(string path) { //Container name path = NormalizePath(path); var blob = _container.GetBlockBlobReference(path); blob.Properties.ContentType = MimeTypes.GetMimeType(Path.GetFileName(path)); return await blob.OpenWriteAsync(); } /// /// Check that blob or folder with passed path exist /// /// path /folder/blob.md /// public virtual bool PathExists(string path) { return PathExistsAsync(path).GetAwaiter().GetResult(); } public virtual async Task PathExistsAsync(string path) { path = NormalizePath(path); var cacheKey = CacheKey.With(GetType(), "PathExistsAsync", path); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(ContentBlobCacheRegion.CreateChangeToken()); var isDirectory = string.IsNullOrEmpty(Path.GetExtension(path)); var result = false; if (isDirectory) { //There is only one way to check if the blob directory exists is to request its contents. BlobContinuationToken token = null; var operationContext = new OperationContext(); var directory = GetCloudBlobDirectory(path); var resultSegment = await directory.ListBlobsSegmentedAsync(true, BlobListingDetails.Metadata, 1, token, _options.BlobRequestOptions, operationContext); result = resultSegment.Results.Any(); } else { try { var url = GetAbsoluteUrl(path); result = await (await _cloudBlobClient.GetBlobReferenceFromServerAsync(new Uri(url))).ExistsAsync(); } catch (Exception) { //Azure blob storage client does not provide method to check blob url exist without throwing exception } } return result; }); } /// /// Search blob content in specified folder /// /// folder path in which the search will be processed /// search blob name pattern can be used mask (*, ? symbols) /// recursive search /// Returns relative path for all found blobs example: /folder/blob.md public virtual IEnumerable Search(string path, string searchPattern, bool recursive) { return SearchAsync(path, searchPattern, recursive).GetAwaiter().GetResult(); } public virtual async Task> SearchAsync(string path, string searchPattern, bool recursive) { var retVal = new List(); path = NormalizePath(path); //Search pattern may contains a part of path /path/*.jpg then need to add this part to a base path searchPattern = searchPattern.Replace('\\', '/').TrimStart('/'); var subDir = NormalizePath(Path.GetDirectoryName(searchPattern)); if (!string.IsNullOrEmpty(subDir)) { path = path.TrimEnd('/') + "/" + subDir; searchPattern = Path.GetFileName(searchPattern); } //Try to check that passed search pattern doesn't contain mask wildcard characters //this means that a direct link to the resource is passed, and we do not need to perform any search var directPath = Path.Combine(path, searchPattern); if (!searchPattern.FilePathHasMaskChars() && await PathExistsAsync(directPath)) { retVal.Add(directPath); } else { var blobItems = new List(); BlobContinuationToken token = null; var operationContext = new OperationContext(); var directory = GetCloudBlobDirectory(path); do { var resultSegment = await directory.ListBlobsSegmentedAsync(recursive, BlobListingDetails.Metadata, null, token, _options.BlobRequestOptions, operationContext); token = resultSegment.ContinuationToken; blobItems.AddRange(resultSegment.Results); } while (token != null); // Loop over items within the container and output the length and URI. foreach (var item in blobItems) { if (!(item is CloudBlockBlob block)) { continue; } var blobRelativePath = GetRelativeUrl(block.Uri.ToString()); var fileName = Path.GetFileName(Uri.UnescapeDataString(block.Uri.ToString())); if (fileName.FitsMask(searchPattern)) { retVal.Add(blobRelativePath); } } } return retVal; } public virtual IChangeToken Watch(string path) { return _watcher.CreateBlobChangeToken(NormalizePath(path)); } #endregion protected virtual CloudBlobDirectory GetCloudBlobDirectory(string path) { var isPathToFile = !string.IsNullOrEmpty(Path.GetExtension(path)); if (isPathToFile) { path = NormalizePath(Path.GetDirectoryName(path)); } return _container.GetDirectoryReference(path); } protected virtual string NormalizePath(string path) { return path.Replace('\\', '/').TrimStart('/'); } protected virtual string GetRelativeUrl(string url) { var absoluteUrl = GetAbsoluteUrl(""); return url.Replace(absoluteUrl, string.Empty); } protected virtual string GetAbsoluteUrl(string path) { var builder = new UriBuilder(_cloudBlobClient.BaseUri); builder.Path += string.Join("/", _options.Container, path).Replace("//", "/"); return builder.Uri.ToString(); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/BlobConnectionString.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace VirtoCommerce.Storefront.Domain { /// /// Represent blob resources connection string which can contains complex part as Provider, basepath etc /// public class BlobConnectionString { private BlobConnectionString() { } public string Provider { get; private set; } /// /// root path. Base for blob resources /// public string RootPath { get; private set; } public string ConnectionString { get; private set; } public static BlobConnectionString Parse(string inputString) { if (string.IsNullOrEmpty(inputString)) throw new ArgumentNullException(nameof(inputString)); var retVal = new BlobConnectionString(); var pairs = ToDictionary(inputString, ";", "="); if (pairs.ContainsKey("provider")) { retVal.Provider = pairs["provider"]; pairs.Remove("provider"); } if (pairs.ContainsKey("rootPath")) { retVal.RootPath = pairs["rootPath"]; pairs.Remove("rootPath"); } retVal.ConnectionString = ToString(pairs, ";", "="); return retVal; } private static Dictionary ToDictionary(string sourceString, string pairSeparator, string valueSeparator) { return sourceString.Split(new[] { pairSeparator }, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Split(new[] { valueSeparator }, 2, StringSplitOptions.RemoveEmptyEntries)) .ToDictionary(x => x[0], x => x.Length == 2 ? x[1] : string.Empty, StringComparer.OrdinalIgnoreCase); } public static string ToString(IEnumerable> pairs, string pairSeparator, string valueSeparator) { var builder = new StringBuilder(); foreach (var pair in pairs) { if (builder.Length > 0) { builder.Append(pairSeparator); } builder.Append(pair.Key); builder.Append(valueSeparator); builder.Append(pair.Value); } return builder.ToString(); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/ContentBlobCacheRegion.cs ================================================ using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain { public class ContentBlobCacheRegion : CancellableCacheRegion { } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/FileSystemBlobContentOptions.cs ================================================ namespace VirtoCommerce.Storefront.Domain { public class FileSystemBlobContentOptions { //The root path public string Path { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/ContentBlobProviders/FileSystemContentBlobProvider.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class FileSystemContentBlobProvider : IContentBlobProvider { private readonly FileSystemBlobContentOptions _options; private readonly IStorefrontMemoryCache _memoryCache; private readonly PhysicalFileProvider _physicalFileProvider; public FileSystemContentBlobProvider(IOptions options, IStorefrontMemoryCache memoryCache) { _options = options.Value; _memoryCache = memoryCache; //Create fileSystemWatcher instance only when rootFolder exist to prevent whole application crash on initialization phase. if (Directory.Exists(_options.Path)) { //It is very important to have rootPath with leading slash '\' without this any changes won't reflected var rootPath = _options.Path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; _physicalFileProvider = new PhysicalFileProvider(rootPath); } } #region IContentBlobProvider Members /// /// Open blob for read /// /// blob relative path /folder/blob.md /// public virtual Stream OpenRead(string path) { path = NormalizePath(path); // traversing above root not permitted. if (PathUtils.PathNavigatesAboveRoot(path)) { throw new InvalidOperationException(path); } return File.OpenRead(path); } /// /// Open blob for write by path /// /// /// blob stream public virtual Stream OpenWrite(string path) { path = NormalizePath(path); // traversing above root not permitted. if (PathUtils.PathNavigatesAboveRoot(path)) { throw new InvalidOperationException(path); } var folderPath = Path.GetDirectoryName(path); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } return File.Open(path, FileMode.Create); } /// /// Check that blob or folder with passed path exist /// /// relative path /folder/blob.md /// public virtual bool PathExists(string path) { var cacheKey = CacheKey.With(GetType(), "PathExists", path); return _memoryCache.GetOrCreateExclusive(cacheKey, (cacheEntry) => { path = NormalizePath(path); cacheEntry.AddExpirationToken(Watch(path)); cacheEntry.AddExpirationToken(ContentBlobCacheRegion.CreateChangeToken()); var retVal = Directory.Exists(path); if (!retVal) { retVal = File.Exists(path); } return retVal; }); } /// /// Search blob content in specified folder /// /// relative folder path in which the search Example: /folder /// search blob name pattern can be used mask (*, ? symbols) /// recursive search /// Returns relative path for all found blobs example: /folder/blob.md public virtual IEnumerable Search(string path, string searchPattern, bool recursive) { var retVal = new List(); path = NormalizePath(path); searchPattern = searchPattern.TrimStart(Path.PathSeparator); if (Directory.Exists(Path.GetDirectoryName(Path.Combine(path, searchPattern)))) { var files = Directory.GetFiles(path, searchPattern, recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) .Select(x => GetRelativePath(x)); retVal.AddRange(files); } return retVal; } public virtual IChangeToken Watch(string path) { if (_physicalFileProvider == null) { return NullChangeToken.Singleton; } return _physicalFileProvider.Watch(path); } #endregion protected virtual string GetRelativePath(string path) { return path.Replace(_options.Path, string.Empty).Replace(Path.DirectorySeparatorChar, '/'); } protected virtual string NormalizePath(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } path = path.Replace('/', Path.DirectorySeparatorChar); path = path.Replace(_options.Path, string.Empty); return Path.Combine(_options.Path, path.TrimStart(Path.DirectorySeparatorChar)); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Countries/CountriesWorkContextBuilderExtensions.cs ================================================ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain { public static class CountriesWorkContextBuilderExtensions { public static Task WithCountriesAsync(this IWorkContextBuilder builder, IList countries) { builder.WorkContext.AllCountries = countries; return Task.CompletedTask; } public static async Task WithCountriesAsync(this IWorkContextBuilder builder) { var serviceProvider = builder.HttpContext.RequestServices; var countryService = serviceProvider.GetRequiredService(); var countries = await countryService.GetCountriesAsync(); await builder.WithCountriesAsync(countries); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Countries/FileSystemCountriesOptions.cs ================================================ namespace VirtoCommerce.Storefront.Domain { public class FileSystemCountriesOptions { public string FilePath { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Countries/FileSystemCountriesService.cs ================================================ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.Storefront.Domain { public class FileSystemCountriesService : ICountriesService { private readonly FileSystemCountriesOptions _options; private readonly IStorefrontMemoryCache _memoryCache; public FileSystemCountriesService(IStorefrontMemoryCache cacheManager, IOptions options) { _options = options.Value; _memoryCache = cacheManager; } #region IKnowCountriesProvider members public async Task> GetCountriesAsync() { if (_options == null) { throw new StorefrontException("the path to countries json file not set"); } var cacheKey = CacheKey.With(GetType(), "GetCountries"); return await _memoryCache.GetOrCreateAsync(cacheKey, async (cacheEntry) => { var result = new List(); if (_options != null) { var countriesJson = await File.ReadAllTextAsync(_options.FilePath); var countriesDict = JsonConvert.DeserializeObject>(countriesJson); result = countriesDict .Select(ParseCountry) .Where(c => !string.IsNullOrEmpty(c.Code3)) .ToList(); } return result; }); } #endregion protected static Country ParseCountry(KeyValuePair pair) { var country = new Country { Name = pair.Key, Code2 = pair.Value["Code2"]?.ToString(), Code3 = pair.Value["Code3"]?.ToString(), RegionType = pair.Value["label"]?.ToString() }; var provinceCodes = pair.Value["province_codes"].ToObject>(); if (provinceCodes != null && provinceCodes.Any()) { country.Regions = provinceCodes .Select(kvp => new CountryRegion { Name = kvp.Key, Code = kvp.Value }) .ToArray(); } return country; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/CurrencyService.cs ================================================ using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain { public class CurrencyService : ICurrencyService { private readonly ICommerce _commerceApi; private readonly IStorefrontMemoryCache _memoryCache; private readonly IApiChangesWatcher _apiChangesWatcher; public CurrencyService(ICommerce commerceApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher apiChangesWatcher) { _commerceApi = commerceApi; _memoryCache = memoryCache; _apiChangesWatcher = apiChangesWatcher; } public async Task GetAllCurrenciesAsync(Language language) { var cacheKey = CacheKey.With(GetType(), language.CultureName); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); return (await _commerceApi.GetAllCurrenciesAsync()).Select(x => x.ToCurrency(language)).ToArray(); }); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Customer/CutomerCacheRegion.cs ================================================ using System; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain { public class CustomerCacheRegion : CancellableCacheRegion { public static IChangeToken CreateChangeToken(string memberId) { if (memberId == null) { throw new ArgumentNullException(nameof(memberId)); } return CreateChangeTokenForKey(memberId); } public static void ExpireMember(string memberId) { if (!string.IsNullOrEmpty(memberId)) { ExpireTokenForKey(memberId); } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Customer/Handlers/SecurityEventsHandler.cs ================================================ using System.Threading.Tasks; using VirtoCommerce.Storefront.Model.Common.Events; using VirtoCommerce.Storefront.Model.Customer.Services; using VirtoCommerce.Storefront.Model.Security.Events; namespace VirtoCommerce.Storefront.Domain.Customer.Handlers { public class SecurityEventsHandler : IEventHandler { private readonly IMemberService _memberService; public SecurityEventsHandler(IMemberService memberService) { _memberService = memberService; } #region IEventHandler members public async Task Handle(UserDeletedEvent message) { if (message.User.ContactId != null) { await _memberService.DeleteContactAsync(message.User.ContactId); } } #endregion } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Customer/MemberConverter.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Common; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Customer; using VirtoCommerce.Storefront.Model.Security; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; using customerDto = VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models; using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static partial class MemberConverter { public static DynamicProperty ToDynamicProperty(this customerDto.DynamicObjectProperty propertyDto) { return propertyDto.JsonConvert().ToDynamicProperty(); } public static customerDto.DynamicObjectProperty ToCustomerDynamicPropertyDto(this DynamicProperty property) { return property.ToDynamicPropertyDto().JsonConvert(); } public static Address ToAddress(this customerDto.CustomerAddress addressDto) { return addressDto.JsonConvert().ToAddress(); } public static customerDto.CustomerAddress ToCustomerAddressDto(this Address address) { return address.ToCoreAddressDto().JsonConvert(); } public static Contact ToContact(this UserRegistration userRegistration) { var result = new Contact { Name = userRegistration.Name ?? userRegistration.UserName, FullName = string.IsNullOrWhiteSpace(userRegistration.FullName) ? string.Join(" ", userRegistration.FirstName, userRegistration.LastName) : userRegistration.FullName, FirstName = userRegistration.FirstName, LastName = userRegistration.LastName, Salutation = userRegistration.Salutation, PhotoUrl = userRegistration.PhotoUrl }; if (!string.IsNullOrEmpty(userRegistration.Email)) { result.Emails.Add(userRegistration.Email); } if (string.IsNullOrEmpty(result.FullName) || string.IsNullOrWhiteSpace(result.FullName)) { result.FullName = userRegistration.Email; } if (userRegistration.Address != null) { result.Addresses = new[] { userRegistration.Address }; } return result; } public static Contact ToContact(this customerDto.Contact contactDto) { var result = new Contact { Id = contactDto.Id, Name = contactDto.Name, MemberType = contactDto.MemberType, UserGroups = contactDto.Groups, FullName = contactDto.FullName, FirstName = contactDto.FirstName, LastName = contactDto.LastName, Emails = contactDto.Emails, TimeZone = contactDto.TimeZone, DefaultLanguage = contactDto.DefaultLanguage, OrganizationId = contactDto.Organizations?.FirstOrDefault(), OrganizationsIds = contactDto.Organizations, Salutation = contactDto.Salutation, Status = contactDto.Status, PhotoUrl = contactDto.PhotoUrl }; if (contactDto.Addresses != null) { result.Addresses = contactDto.Addresses.Select(ToAddress).ToList(); } result.DefaultBillingAddress = result.Addresses .Where(a => contactDto.DefaultBillingAddressId != null ? a.Id == contactDto.DefaultBillingAddressId : (a.Type & AddressType.Billing) == AddressType.Billing) // Stabilize order .OrderBy(a => a.Id) .FirstOrDefault(); result.DefaultShippingAddress = result.Addresses .Where(a => contactDto.DefaultShippingAddressId != null ? a.Id == contactDto.DefaultShippingAddressId : (a.Type & AddressType.Shipping) == AddressType.Shipping) // Stabilize order .OrderBy(a => a.Id) .FirstOrDefault(); if (contactDto.Emails != null) { result.Emails = contactDto.Emails; } if (!contactDto.DynamicProperties.IsNullOrEmpty()) { result.DynamicProperties = new MutablePagedList(contactDto.DynamicProperties.Select(ToDynamicProperty).ToList()); } if (!contactDto.SecurityAccounts.IsNullOrEmpty()) { result.SecurityAccounts = contactDto.SecurityAccounts.Select(x => new SecurityAccount { Id = x.Id, Roles = x.Roles?.Select(role => role.Name).ToList(), IsLockedOut = (x.LockoutEndDateUtc ?? DateTime.MinValue) > DateTime.UtcNow, UserName = x.UserName, }); } return result; } public static Organization ToOrganization(this OrganizationRegistration orgRegistration) { var organization = new Organization { Name = orgRegistration.OrganizationName, }; if (organization.Addresses != null) { organization.Addresses.Add(orgRegistration.Address); } return organization; } public static Organization ToOrganization(this customerDto.Organization organizaionDto) { var result = new Organization { Id = organizaionDto.Id, Name = organizaionDto.Name, MemberType = organizaionDto.MemberType, UserGroups = organizaionDto.Groups, }; if (organizaionDto.Addresses != null) { result.Addresses = organizaionDto.Addresses.Select(ToAddress).ToList(); } if (organizaionDto.Phones != null) { result.Phones = organizaionDto.Phones; } if (organizaionDto.Emails != null) { result.Emails = organizaionDto.Emails; } if (!organizaionDto.DynamicProperties.IsNullOrEmpty()) { result.DynamicProperties = new MutablePagedList(organizaionDto.DynamicProperties.Select(ToDynamicProperty).ToList()); } return result; } public static customerDto.Contact ToContactDto(this Contact customer) { var retVal = new customerDto.Contact { Id = customer.Id, Name = customer.Name, FirstName = customer.FirstName, FullName = customer.FullName, LastName = customer.LastName, MiddleName = customer.MiddleName, Salutation = customer.Salutation, Status = customer.Status, PhotoUrl = customer.PhotoUrl, MemberType = "Contact", }; if (!customer.UserGroups.IsNullOrEmpty()) { retVal.Groups = customer.UserGroups.ToArray(); } if (!customer.Addresses.IsNullOrEmpty()) { retVal.Addresses = new List(); foreach (var address in customer.Addresses) { var addressDto = address.ToCustomerAddressDto(); if (string.IsNullOrEmpty(addressDto.FirstName)) { addressDto.FirstName = customer.FirstName; } if (string.IsNullOrEmpty(addressDto.LastName)) { addressDto.LastName = customer.LastName; } if (string.IsNullOrEmpty(addressDto.Email)) { addressDto.Email = customer.Email; } retVal.Addresses.Add(addressDto); } } if (customer.DefaultShippingAddress != null) { retVal.DefaultShippingAddressId = customer.DefaultShippingAddress.Id; } if (customer.DefaultBillingAddress != null) { retVal.DefaultBillingAddressId = customer.DefaultBillingAddress.Id; } if (!customer.Emails.IsNullOrEmpty()) { retVal.Emails = customer.Emails; } if (customer.OrganizationId != null) { retVal.Organizations = new List() { customer.OrganizationId }; } if (customer.OrganizationsIds != null) { retVal.Organizations = customer.OrganizationsIds.Concat(retVal.Organizations ?? Array.Empty()).Distinct().ToArray(); } if (!customer.DynamicProperties.IsNullOrEmpty()) { retVal.DynamicProperties = customer.DynamicProperties.Select(ToCustomerDynamicPropertyDto).ToList(); } return retVal; } public static customerDto.Organization ToOrganizationDto(this Organization org) { var retVal = new customerDto.Organization { Id = org.Id, Name = org.Name, MemberType = "Organization" }; if (!org.UserGroups.IsNullOrEmpty()) { retVal.Groups = org.UserGroups.ToArray(); } if (!org.Addresses.IsNullOrEmpty()) { retVal.Addresses = org.Addresses.Select(ToCustomerAddressDto).ToList(); } if (!org.Emails.IsNullOrEmpty()) { retVal.Emails = org.Emails; } if (!org.Phones.IsNullOrEmpty()) { retVal.Phones = org.Phones; } if (!org.DynamicProperties.IsNullOrEmpty()) { retVal.DynamicProperties = org.DynamicProperties.Select(ToCustomerDynamicPropertyDto).ToList(); } return retVal; } public static customerDto.Contact ToCoreContactDto(this Contact contact) { return contact.ToContactDto().JsonConvert(); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Customer/MemberService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using PagedList.Core; using VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Customer; using VirtoCommerce.Storefront.Model.Customer.Services; using customerDto = VirtoCommerce.Storefront.AutoRestClients.CustomerModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public class MemberService : IMemberService { private readonly ICustomerModule _customerApi; private readonly IStorefrontMemoryCache _memoryCache; private readonly IApiChangesWatcher _apiChangesWatcher; public MemberService(ICustomerModule customerApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher changesWatcher) { _customerApi = customerApi; _memoryCache = memoryCache; _apiChangesWatcher = changesWatcher; } #region ICustomerService Members public virtual Task GetContactByIdAsync(string contactId) { if (contactId == null) { throw new ArgumentNullException(nameof(contactId)); } return GetContactByIdInternalAsync(contactId); } protected virtual async Task GetContactByIdInternalAsync(string contactId) { Contact result = null; var cacheKey = CacheKey.With(GetType(), "GetContactByIdAsync", contactId); var dto = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var contactDto = await _customerApi.GetContactByIdAsync(contactId); if (contactDto != null) { cacheEntry.AddExpirationToken(CustomerCacheRegion.CreateChangeToken(contactDto.Id)); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); } return contactDto; }); if (dto == null) { return null; } result = dto.ToContact(); if (!dto.Organizations.IsNullOrEmpty()) { //Load contact organization result.Organization = await GetOrganizationByIdAsync(dto.Organizations.FirstOrDefault()); } return result; } public virtual async Task CreateContactAsync(Contact contact) { var contactDto = contact.ToContactDto(); var result = await _customerApi.CreateContactAsync(contactDto); return result?.ToContact(); } public virtual async Task DeleteContactAsync(string contactId) { await _customerApi.DeleteContactsAsync(new[] { contactId }); //Invalidate cache CustomerCacheRegion.ExpireMember(contactId); } public virtual async Task UpdateContactAsync(Contact contact) { await _customerApi.UpdateContactAsync(contact.ToContactDto()); //Invalidate cache CustomerCacheRegion.ExpireMember(contact.Id); } public virtual async Task UpdateContactAddressesAsync(string contactId, IList
addresses) { var existContact = await GetContactByIdAsync(contactId); if (existContact != null) { await _customerApi.UpdateAddessesAsync(addresses.Select(x => x.ToCustomerAddressDto()).ToList(), contactId); //Invalidate cache CustomerCacheRegion.ExpireMember(existContact.Id); } } public async Task GetOrganizationByIdAsync(string organizationId) { Organization result = null; var cacheKey = CacheKey.With(GetType(), "GetOrganizationByIdAsync", organizationId); var dto = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var organizationDto = await _customerApi.GetOrganizationByIdAsync(organizationId); if (organizationDto != null) { cacheEntry.AddExpirationToken(CustomerCacheRegion.CreateChangeToken(organizationDto.Id)); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); } return organizationDto; }); if (dto != null) { result = dto.ToOrganization(); //Lazy load organization contacts result.Contacts = new MutablePagedList((pageNumber, pageSize, sortInfos, @params) => { var criteria = new OrganizationContactsSearchCriteria { OrganizationId = result.Id, PageNumber = pageNumber, PageSize = pageSize }; if (!sortInfos.IsNullOrEmpty()) { criteria.Sort = SortInfo.ToString(sortInfos); } if (@params != null) { criteria.CopyFrom(@params); } return SearchOrganizationContacts(criteria); }, 1, 20); } return result; } public async Task CreateOrganizationAsync(Organization organization) { var orgDto = organization.ToOrganizationDto(); var result = await _customerApi.CreateOrganizationAsync(orgDto); return result?.ToOrganization(); } public async Task UpdateOrganizationAsync(Organization organization) { var orgDto = organization.ToOrganizationDto(); await _customerApi.UpdateOrganizationAsync(orgDto); CustomerCacheRegion.ExpireMember(organization.Id); } public IPagedList SearchOrganizationContacts(OrganizationContactsSearchCriteria criteria) { return SearchOrganizationContactsAsync(criteria).GetAwaiter().GetResult(); } public async Task> SearchOrganizationContactsAsync(OrganizationContactsSearchCriteria criteria) { var criteriaDto = new customerDto.MembersSearchCriteria { MemberId = criteria.OrganizationId, Skip = (criteria.PageNumber - 1) * criteria.PageSize, Take = criteria.PageSize, Sort = criteria.Sort, SearchPhrase = criteria.SearchPhrase, ObjectType = "Member" }; var searchResult = await _customerApi.SearchContactsAsync(criteriaDto); var contacts = searchResult.Results.Select(x => x.ToContact()).ToList(); return new StaticPagedList(contacts, criteria.PageNumber, criteria.PageSize, searchResult.TotalCount ?? 0); } #endregion } } ================================================ FILE: VirtoCommerce.Storefront/Domain/IWorkContextBuilder.cs ================================================ using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain { public interface IWorkContextBuilder { HttpContext HttpContext { get; } WorkContext WorkContext { get; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/AnonymousUserForStoreAuthorizationRequirement.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain.Security { public class AnonymousUserForStoreAuthorizationRequirement : IAuthorizationRequirement { public const string PolicyName = "DenyAnonymousForStore"; } public class AnonymousUserForStoreAuthorizationHandler : AuthorizationHandler { private readonly IWorkContextAccessor _workContextAccessor; public AnonymousUserForStoreAuthorizationHandler(IWorkContextAccessor workContextAccessor) { _workContextAccessor = workContextAccessor; } protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, AnonymousUserForStoreAuthorizationRequirement requirement) { var workContext = _workContextAccessor.WorkContext; if (workContext.CurrentUser.IsRegisteredUser || workContext.CurrentStore.AnonymousUsersAllowed) { context.Succeed(requirement); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CanEditOrganizationResourceAuthorizationHandler.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Customer; namespace VirtoCommerce.Storefront.Domain.Security { public class CanEditOrganizationResourceAuthorizeRequirement : IAuthorizationRequirement { public const string PolicyName = "CanEditOrganizationResource"; } public class CanEditOrganizationResourceAuthorizationHandler : AuthorizationHandler { private readonly IWorkContextAccessor _workContextAccessor; public CanEditOrganizationResourceAuthorizationHandler(IWorkContextAccessor workContextAccessor) { _workContextAccessor = workContextAccessor; } protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CanEditOrganizationResourceAuthorizeRequirement requirement, Organization resource) { var workContext = _workContextAccessor.WorkContext; //Allow to do all things with self var currentUserOrgIds = workContext.CurrentUser?.Contact?.OrganizationsIds; var result = currentUserOrgIds != null && resource != null && currentUserOrgIds.Contains(resource.Id); if (result) { context.Succeed(requirement); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CanImpersonateAuthorizationHandler.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain.Security { public class CanImpersonateAuthorizationRequirement : IAuthorizationRequirement { public const string PolicyName = "CanImpersonate"; } public class CanImpersonateAuthorizationHandler : AuthorizationHandler { private readonly IStoreModule _storeApi; private readonly IWorkContextAccessor _workContextAccessor; public CanImpersonateAuthorizationHandler(IStoreModule storeApi, IWorkContextAccessor workContextAccessor) { _storeApi = storeApi; _workContextAccessor = workContextAccessor; } protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, CanImpersonateAuthorizationRequirement requirement) { var workContext = _workContextAccessor.WorkContext; // Validate the requirement against the resource and identity. var info = await _storeApi.GetLoginOnBehalfInfoAsync(workContext.CurrentStore.Id, workContext.CurrentUser.Id); if (info.CanLoginOnBehalf == true) { context.Succeed(requirement); } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CanReadContentItemAuthorizationHandler.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain.Security { public class CanReadContentItemAuthorizeRequirement : IAuthorizationRequirement { public const string PolicyName = "CanReadContentItem"; } public class CanReadContentItemAuthorizationHandler : AuthorizationHandler { private readonly IWorkContextAccessor _workContextAccessor; public CanReadContentItemAuthorizationHandler(IWorkContextAccessor workContextAccessor) { _workContextAccessor = workContextAccessor; } protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CanReadContentItemAuthorizeRequirement requirement, ContentItem resource) { var workContext = _workContextAccessor.WorkContext; if (resource.Authorize) { if (workContext.CurrentUser.IsRegisteredUser) { context.Succeed(requirement); } } else { context.Succeed(requirement); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CustomCookieAuthenticationEvents.cs ================================================ using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using VirtoCommerce.Storefront.Extensions; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Domain.Security { public class CustomCookieAuthenticationEvents : CookieAuthenticationEvents { private readonly IStorefrontUrlBuilder _storefrontUrlBuilder; public CustomCookieAuthenticationEvents(IStorefrontUrlBuilder storefrontUrlBuilder) { _storefrontUrlBuilder = storefrontUrlBuilder; } public override Task RedirectToLogin(RedirectContext context) { if (context.Request.Path.IsApi()) { context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; return Task.CompletedTask; } var absolutePath = _storefrontUrlBuilder.ToStoreAbsolute(context.RedirectUri).ToAbsolutePath(); context.RedirectUri = WebUtility.UrlDecode(absolutePath); return base.RedirectToLogin(context); } public override Task RedirectToAccessDenied(RedirectContext context) { if (context.Request.Path.IsApi()) { context.Response.StatusCode = (int)HttpStatusCode.Forbidden; return Task.CompletedTask; } var absolutePath = _storefrontUrlBuilder.ToStoreAbsolute(context.RedirectUri).ToAbsolutePath(); context.RedirectUri = WebUtility.UrlDecode(absolutePath); return base.RedirectToAccessDenied(context); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CustomSignInManager.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Model.Security.Specifications; namespace VirtoCommerce.Storefront.Domain.Security { public class CustomSignInManager : SignInManager { public CustomSignInManager(UserManager userManager, IHttpContextAccessor contextAccessor, IUserClaimsPrincipalFactory claimsFactory, IOptions optionsAccessor, ILogger> logger, IAuthenticationSchemeProvider schemes, IUserConfirmation userConfirmation) : base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes, userConfirmation) { } protected override async Task PreSignInCheck(User user) { return await base.PreSignInCheck(user) ?? (new IsUserSuspendedSpecification().IsSatisfiedBy(user) ? CustomSignInResult.Rejected : null); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/CustomUserManager.cs ================================================ using System; using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Domain.Security { public class CustomUserManager : AspNetUserManager { private readonly ISecurity _platformSecurityApi; public CustomUserManager(IUserStore userStore, IOptions optionsAccessor, IPasswordHasher passwordHasher, IEnumerable> userValidators, IEnumerable> passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger> logger, ISecurity platformSecurityApi) : base(userStore, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { _platformSecurityApi = platformSecurityApi; } public async override Task GetUserAsync(ClaimsPrincipal principal) { //User can be anonymous and also should be signed-in var user = new User { Id = principal.FindFirstValue(ClaimTypes.NameIdentifier), UserName = principal.FindFirstValue(ClaimTypes.Name), SecurityStamp = principal.FindFirstValue("AspNet.Identity.SecurityStamp") }; //For registered users need to load it from storage if (principal.Identity.IsAuthenticated && user.UserName != SecurityConstants.AnonymousUsername) { user = await FindByIdAsync(user.Id); } //Restore some properties from cookies if (user != null) { user.OperatorUserId = principal.FindFirstValue(SecurityConstants.Claims.OperatorUserIdClaimType); user.OperatorUserName = principal.FindFirstValue(SecurityConstants.Claims.OperatorUserNameClaimType); user.SelectedCurrencyCode = principal.FindFirstValue(SecurityConstants.Claims.CurrencyClaimType); } return user; } public override async Task ResetPasswordAsync(User user, string token, string newPassword) { var result = await _platformSecurityApi.ResetPasswordByTokenAsync(user.Id, new ResetPasswordConfirmRequest() { NewPassword = newPassword, Token = token }); return result.ToIdentityResult(); } public override async Task ConfirmEmailAsync(User user, string token) { var result = await _platformSecurityApi.ConfirmEmailAsync(user.Id, new ConfirmEmailRequest() { Token = token }); return result.ToIdentityResult(); } public override async Task GenerateChangeEmailTokenAsync(User user, string newEmail) { return await _platformSecurityApi.GenerateChangeEmailTokenAsync(user.Id, newEmail); } public override async Task GenerateEmailConfirmationTokenAsync(User user) { return await _platformSecurityApi.GenerateEmailConfirmationTokenAsync(user.Id); } public override async Task GeneratePasswordResetTokenAsync(User user) { return await _platformSecurityApi.GeneratePasswordResetTokenAsync(user.Id); } public override async Task GenerateUserTokenAsync(User user, string tokenProvider, string purpose) { return await _platformSecurityApi.GenerateUserTokenAsync(user.Id, tokenProvider, purpose); } public override async Task VerifyUserTokenAsync(User user, string tokenProvider, string purpose, string token) { return await _platformSecurityApi.VerifyUserTokenAsync(user.Id, new VerifyTokenRequest() { TokenProvider = tokenProvider, Purpose = purpose, Token = tokenProvider }) ?? false; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/ChangePhoneNumberSmsNotification.cs ================================================ using System.Collections.Generic; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class ChangePhoneNumberSmsNotification : SmsNotificationBase { public ChangePhoneNumberSmsNotification(string storeId, Language language) : base(storeId, language) { } public string Token { get; set; } public override IEnumerable> GetNotificationParameters() { foreach (var kvp in base.GetNotificationParameters()) { yield return kvp; } yield return new KeyValuePair(nameof(Token), Token); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/EmailConfirmationNotification.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class EmailConfirmationNotification : EmailNotificationBase { public EmailConfirmationNotification(string storeId, Language language) : base(storeId, language) { } public string Url { get; set; } public override IEnumerable> GetNotificationParameters() { var result = base.GetNotificationParameters().ToList(); result.Add(new KeyValuePair(nameof(Url), Url)); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/RegistrationEmailNotification.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class RegistrationEmailNotification : EmailNotificationBase { public RegistrationEmailNotification(string storeId, Language language) : base(storeId, language) { } public string Login { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public override IEnumerable> GetNotificationParameters() { var result = base.GetNotificationParameters().ToList(); result.Add(new KeyValuePair(nameof(Login), Login)); result.Add(new KeyValuePair(nameof(FirstName), FirstName)); result.Add(new KeyValuePair(nameof(LastName), LastName)); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/RegistrationInvitationNotification.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class RegistrationInvitationNotification : EmailNotificationBase { public RegistrationInvitationNotification(string storeId, Language language) : base(storeId, language) { } public string InviteUrl { get; set; } public override IEnumerable> GetNotificationParameters() { var result = base.GetNotificationParameters().ToList(); result.Add(new KeyValuePair(nameof(InviteUrl), InviteUrl)); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/RemindUserNameNotification.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class RemindUserNameNotification : EmailNotificationBase { public RemindUserNameNotification(string storeId, Language language) : base(storeId, language) { } public string UserName { get; set; } public override IEnumerable> GetNotificationParameters() { var result = base.GetNotificationParameters().ToList(); result.Add(new KeyValuePair(nameof(UserName), UserName)); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/ResetPasswordEmailNotification.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class ResetPasswordEmailNotification : EmailNotificationBase { public ResetPasswordEmailNotification(string storeId, Language language) : base(storeId, language) { } public string Url { get; set; } public override IEnumerable> GetNotificationParameters() { var result = base.GetNotificationParameters().ToList(); result.Add(new KeyValuePair(nameof(Url), Url)); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/ResetPasswordSmsNotification.cs ================================================ using System.Collections.Generic; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class ResetPasswordSmsNotification : SmsNotificationBase { public ResetPasswordSmsNotification(string storeId, Language language) : base(storeId, language) { } public string Token { get; set; } public override IEnumerable> GetNotificationParameters() { foreach (var kvp in base.GetNotificationParameters()) { yield return kvp; } yield return new KeyValuePair(nameof(Token), Token); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/TwoFactorEmailNotification.cs ================================================ using System.Collections.Generic; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class TwoFactorEmailNotification : EmailNotificationBase { public TwoFactorEmailNotification(string storeId, Language language) : base(storeId, language) { } public string Token { get; set; } public override IEnumerable> GetNotificationParameters() { foreach (var kvp in base.GetNotificationParameters()) { yield return kvp; } yield return new KeyValuePair(nameof(Token), Token); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/Notifications/TwoFactorSmsNotification.cs ================================================ using System.Collections.Generic; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common.Notifications; namespace VirtoCommerce.Storefront.Domain.Security.Notifications { public class TwoFactorSmsNotification : SmsNotificationBase { public TwoFactorSmsNotification(string storeId, Language language) : base(storeId, language) { } public string Token { get; set; } public override IEnumerable> GetNotificationParameters() { foreach (var kvp in base.GetNotificationParameters()) { yield return kvp; } yield return new KeyValuePair(nameof(Token), Token); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/OnlyRegisteredUserAuthorizationHandler.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain.Security { public class OnlyRegisteredUserAuthorizationRequirement : IAuthorizationRequirement { public const string PolicyName = "OnlyRegisteredUser"; } /// /// We need this policy as alternative for [Authorize] attribute, because in the storefront all users are registered in terms of ASP.NET authorization. /// public class OnlyRegisteredUserAuthorizationHandler : AuthorizationHandler { private readonly IWorkContextAccessor _workContextAccessor; public OnlyRegisteredUserAuthorizationHandler(IWorkContextAccessor workContextAccessor) { _workContextAccessor = workContextAccessor; } protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, OnlyRegisteredUserAuthorizationRequirement requirement) { var workContext = _workContextAccessor.WorkContext; if (workContext.CurrentUser.IsRegisteredUser) { context.Succeed(requirement); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/PermissionAuthorizationHandler.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Domain.Security { public class PermissionAuthorizationHandler : AuthorizationHandler { protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionAuthorizationRequirement requirement) { if (context.User.IsInRole(SecurityConstants.Roles.Administrator)) { context.Succeed(requirement); } if (context.User.HasClaim(SecurityConstants.Claims.PermissionClaimType, requirement.Permission)) { context.Succeed(requirement); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/PermissionAuthorizationPolicyProvider.cs ================================================ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Domain.Security { /// /// https://www.jerriepelser.com/blog/creating-dynamic-authorization-policies-aspnet-core/ /// public class PermissionAuthorizationPolicyProvider : DefaultAuthorizationPolicyProvider { private readonly IStorefrontMemoryCache _memoryCache; private readonly ISecurity _platformSecurityApi; public PermissionAuthorizationPolicyProvider(IOptions options, ISecurity platformSecurityApi, IStorefrontMemoryCache memoryCache) : base(options) { _memoryCache = memoryCache; _platformSecurityApi = platformSecurityApi; } public override async Task GetPolicyAsync(string policyName) { // Check static policies first var policy = await base.GetPolicyAsync(policyName); if (policy == null) { var map = await GetDynamicAuthorizationPoliciesFromPlatformPermissions(); map.TryGetValue(policyName, out policy); } return policy; } private async Task> GetDynamicAuthorizationPoliciesFromPlatformPermissions() { var cacheKey = CacheKey.With(GetType(), "GetDynamicAuthorizationPoliciesFromPlatformPermissions"); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(SecurityCacheRegion.CreateChangeToken()); var resultLookup = new Dictionary(); foreach (var permission in await _platformSecurityApi.GetAllRegisteredPermissionsAsync()) { resultLookup[permission.Id] = new AuthorizationPolicyBuilder().AddRequirements(new PermissionAuthorizationRequirement { Permission = permission.Id }).Build(); } //Register storefront permissions foreach (var permission in SecurityConstants.Permissions.AllPermissions) { resultLookup[permission] = new AuthorizationPolicyBuilder().AddRequirements(new PermissionAuthorizationRequirement { Permission = permission }).Build(); } return resultLookup; }); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/PermissionAuthorizationRequirement.cs ================================================ using Microsoft.AspNetCore.Authorization; namespace VirtoCommerce.Storefront.Domain.Security { public class PermissionAuthorizationRequirement : IAuthorizationRequirement { public string Permission { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/PollingApiUserChangeToken.cs ================================================ using System; using System.Linq; using System.Threading; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Domain.Security { public sealed class PollingApiUserChangeToken : IChangeToken { private readonly ISecurity _platformSecurityApi; private static DateTime _previousChangeTimeUtcStatic = DateTime.UtcNow; private static DateTime _lastCheckedTimeUtcStatic; private readonly TimeSpan _pollingInterval; private readonly object _lock = new object(); public PollingApiUserChangeToken(ISecurity platformSecurityApi, TimeSpan pollingInterval) { _pollingInterval = pollingInterval; _platformSecurityApi = platformSecurityApi; } public static void UpdatePreviousChangeTimeUtcStatic(DateTime currentTime) { _previousChangeTimeUtcStatic = currentTime; } public static void UpdateLastCheckedTimeUtcStatic(DateTime currentTime) { _lastCheckedTimeUtcStatic = currentTime; } /// /// Always false. /// public bool ActiveChangeCallbacks => false; public bool HasChanged { get { var currentTime = DateTime.UtcNow; if (currentTime - _lastCheckedTimeUtcStatic < _pollingInterval) { return false; } var lockTaken = Monitor.TryEnter(_lock); try { //Do not wait if is locked by another thread if (lockTaken) { var result = _platformSecurityApi.SearchUsersAsync(new UserSearchCriteria() { Skip = 0, Take = int.MaxValue, ModifiedSinceDate = _previousChangeTimeUtcStatic }); if (result.Result.TotalCount > 0) { UpdatePreviousChangeTimeUtcStatic(currentTime); foreach (var userId in result.Result.Users.Select(x => x.Id)) { SecurityCacheRegion.ExpireUser(userId); } } UpdateLastCheckedTimeUtcStatic(currentTime); } } finally { if (lockTaken) { Monitor.Exit(_lock); } } return false; } } /// /// Does not actually register callbacks. /// /// This parameter is ignored /// This parameter is ignored /// A disposable object that noops when disposed public IDisposable RegisterChangeCallback(Action callback, object state) => EmptyDisposable.Instance; } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/SecurityCacheRegion.cs ================================================ using System; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain.Security { public class SecurityCacheRegion : CancellableCacheRegion { public static IChangeToken CreateChangeToken(string userId) { if (userId == null) { throw new ArgumentNullException(nameof(userId)); } return CreateChangeTokenForKey(userId); } public static void ExpireUser(string userId) { if (!string.IsNullOrEmpty(userId)) { ExpireTokenForKey(userId); } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/SecurityConverter.cs ================================================ using System.Linq; using Microsoft.AspNetCore.Identity; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Security; using Dto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; namespace VirtoCommerce.Storefront.Domain.Security { public static class SecurityConverter { public static IdentityResult ToIdentityResult(this Dto.SecurityResult resultDto) { if (resultDto.Succeeded == true) { return IdentityResult.Success; } return IdentityResult.Failed(resultDto.Errors.Select(x => new IdentityError { Description = x }).ToArray()); } public static Dto.Role ToRoleDto(this Role role) { return new Dto.Role { Id = role.Id, Name = role.Name, Permissions = role.Permissions.Select(x => new Dto.Permission { Id = x, Name = x }).ToList() }; } public static Role ToRole(this Dto.Role roleDto) { return new Role { Id = roleDto.Id, Name = roleDto.Name, Permissions = roleDto.Permissions.Select(x => x.Id).ToList() }; } public static User ToUser(this OrganizationUserRegistration registerForm) { var result = ((UserRegistration)registerForm).ToUser(); if (!string.IsNullOrEmpty(registerForm.Role)) { var role = SecurityConstants.Roles.AllRoles.FirstOrDefault(x => x.Id.EqualsInvariant(registerForm.Role)); if (role != null) { result.Roles = new[] { role }; } else { result.Roles = new[] { new Role { Id = registerForm.Role, Name = registerForm.Role } }; } } return result; } public static User ToUser(this UserRegistration registerForm) { var result = new User { Email = registerForm.Email, UserName = registerForm.UserName, Password = registerForm.Password, UserType = "Customer" }; //Take userName as Email if it valid and Email is not set if (string.IsNullOrEmpty(result.Email)) { result.Email = registerForm.UserName.IsValidEmail() ? registerForm.UserName : result.Email; } return result; } public static User ToUser(this Dto.ApplicationUser userDto) { var result = new User() { Email = userDto.Email, Id = userDto.Id, ContactId = userDto.MemberId, PhoneNumber = userDto.PhoneNumber, UserName = userDto.UserName, StoreId = userDto.StoreId, IsRegisteredUser = true, IsAdministrator = userDto.IsAdministrator ?? false, Permissions = userDto.Permissions, AccessFailedCount = userDto.AccessFailedCount ?? 0, LockoutEnabled = userDto.LockoutEnabled ?? false, EmailConfirmed = userDto.EmailConfirmed ?? false, LockoutEndDateUtc = userDto.LockoutEndDateUtc, LastLoginDate = userDto.LastLoginDate, PasswordExpired = userDto.PasswordExpired ?? false, PasswordHash = userDto.PasswordHash, SecurityStamp = userDto.SecurityStamp, UserState = EnumUtility.SafeParse(userDto.UserState, AccountState.Approved), UserType = userDto.UserType, TwoFactorEnabled = userDto.TwoFactorEnabled ?? false, PhoneNumberConfirmed = userDto.PhoneNumberConfirmed ?? false, Status = userDto.Status, }; if (!userDto.Roles.IsNullOrEmpty()) { result.Roles = userDto.Roles.Select(x => new Role { Id = x.Id, Name = x.Name }); } if (!userDto.Logins.IsNullOrEmpty()) { result.ExternalLogins = userDto.Logins.Select(x => new ExternalUserLoginInfo { LoginProvider = x.LoginProvider, ProviderKey = x.ProviderKey }).ToList(); } return result; } public static Dto.ApplicationUser ToUserDto(this User user) { var result = new Dto.ApplicationUser { Id = user.Id, Email = user.Email, Password = user.Password, UserName = user.UserName, StoreId = user.StoreId, MemberId = user.Contact?.Id ?? user.ContactId, AccessFailedCount = user.AccessFailedCount, EmailConfirmed = user.EmailConfirmed, LockoutEnabled = user.LockoutEnabled, LockoutEndDateUtc = user.LockoutEndDateUtc, LastLoginDate = user.LastLoginDate, TwoFactorEnabled = user.TwoFactorEnabled, SecurityStamp = user.SecurityStamp, PasswordHash = user.PasswordHash, UserState = user.UserState.ToString(), UserType = user.UserType, IsAdministrator = user.IsAdministrator, PhoneNumber = user.PhoneNumber, PhoneNumberConfirmed = user.PhoneNumberConfirmed, PasswordExpired = user.PasswordExpired, Status = user.Status }; if (!user.Roles.IsNullOrEmpty()) { //Need to convert role names to the registered in the platform roles entities result.Roles = user.Roles.Select(ToRoleDto).ToList(); } if (!user.ExternalLogins.IsNullOrEmpty()) { result.Logins = user.ExternalLogins.Select(x => new Dto.ApplicationUserLogin { LoginProvider = x.LoginProvider, ProviderKey = x.ProviderKey }).ToList(); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/SecurityWorkContextBuilderExtensions.cs ================================================ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Model.Security.Specifications; namespace VirtoCommerce.Storefront.Domain.Security { public static class SecurityWorkContextBuilderExtensions { public static async Task WithCurrentUserAsync(this IWorkContextBuilder builder) { var serviceProvider = builder.HttpContext.RequestServices; var signInManager = serviceProvider.GetRequiredService>(); // Gets the collection of external login providers var externalAuthTypes = (await signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); builder.WorkContext.ExternalLoginProviders = externalAuthTypes.Select(at => new LoginProvider { AuthenticationType = at.Name, Caption = at.DisplayName, }).ToList(); var user = await signInManager.UserManager.GetUserAsync(builder.HttpContext.User); if (user != null && !new CanUserLoginToStoreSpecification(user).IsSatisfiedBy(builder.WorkContext.CurrentStore)) { await signInManager.SignOutAsync(); user = null; } if (user != null && new IsUserSuspendedSpecification().IsSatisfiedBy(user)) { await signInManager.SignOutAsync(); user = null; } //Login as a new anonymous user if (user == null || user.IsTransient()) { user = new User { Id = Guid.NewGuid().ToString(), SecurityStamp = Guid.NewGuid().ToString(), UserName = SecurityConstants.AnonymousUsername, }; //Workaround: Do not sign out for js map requests they are always coming without authentication if (!builder.HttpContext.Request.Path.Value.EndsWith(".map")) { //Sign-in anonymous user await signInManager.SignInAsync(user, isPersistent: true); //https://github.com/aspnet/Security/issues/1131 //the sign in operation doesn't change the current request user principal. //That only happens on incoming requests once the cookie or bearer token (or whatever thing the type of auth requires to create an identity) is set. //Need to manually set User in the HttpContext to avoid issues such like Antiforegery token generation for undefined user for the current request builder.HttpContext.User = await signInManager.ClaimsFactory.CreateAsync(user); } } builder.WorkContext.CurrentUser = user; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Security/UserStoreStub.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Customer.Services; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Domain.Security { //Stub for UserManager public sealed class UserStoreStub : IUserEmailStore, IUserPasswordStore, IUserLockoutStore, IUserLoginStore, IUserSecurityStampStore, IUserClaimStore, IRoleStore, IUserPhoneNumberStore, IUserTwoFactorStore, IUserAuthenticatorKeyStore { private readonly ISecurity _platformSecurityApi; private readonly IStorefrontMemoryCache _memoryCache; private readonly IMemberService _memberService; private readonly StorefrontOptions _options; private readonly IApiChangesWatcher _apiChangesWatcher; public UserStoreStub(ISecurity platformSecurityApi, IMemberService memberService, IStorefrontMemoryCache memoryCache, IOptions options, IApiChangesWatcher apiChangesWatcher) { _platformSecurityApi = platformSecurityApi; _memoryCache = memoryCache; _memberService = memberService; _options = options.Value; _apiChangesWatcher = apiChangesWatcher; } #region IUserStore members public async Task CreateAsync(User user, CancellationToken cancellationToken) { var newContactCreated = false; if (user.Contact != null) { user.Contact = await _memberService.CreateContactAsync(user.Contact); newContactCreated = true; } var dtoUser = user.ToUserDto(); var resultDto = await _platformSecurityApi.CreateAsync(dtoUser); if (resultDto.Succeeded != true && newContactCreated) { await _memberService.DeleteContactAsync(user.Contact.Id); } return resultDto.ToIdentityResult(); } public async Task CreateAsync(Role role, CancellationToken cancellationToken) { return await SaveAsync(role, cancellationToken); } public async Task DeleteAsync(User user, CancellationToken cancellationToken) { await _platformSecurityApi.DeleteAsync(new[] { user.UserName }); //Evict user from the cache SecurityCacheRegion.ExpireUser(user.Id); return IdentityResult.Success; } public Task DeleteAsync(Role role, CancellationToken cancellationToken) { throw new NotImplementedException(); } public async Task UpdateAsync(Role role, CancellationToken cancellationToken) { return await SaveAsync(role, cancellationToken); } public async Task FindByIdAsync(string userId, CancellationToken cancellationToken) { var cacheKey = CacheKey.With(GetType(), "FindByIdAsync", userId); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var userDto = await _platformSecurityApi.GetUserByIdAsync(userId); return await PrepareUserResultAsync(cacheEntry, userDto); }, cacheNullValue: false); //Load user associated contact if (result != null && result.ContactId != null) { result.Contact = await _memberService.GetContactByIdAsync(result.ContactId); } return result; } public async Task FindByNameAsync(string normalizedUserName, CancellationToken cancellationToken) { var cacheKey = CacheKey.With(GetType(), "FindByNameAsync", normalizedUserName); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var userDto = await _platformSecurityApi.GetUserByNameAsync(normalizedUserName); return await PrepareUserResultAsync(cacheEntry, userDto); }, cacheNullValue: false); //Load user associated contact if (result != null && result.ContactId != null) { result.Contact = await _memberService.GetContactByIdAsync(result.ContactId); } return result; } public Task GetNormalizedUserNameAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.UserName); } public Task GetUserIdAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.Id); } public Task GetUserNameAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.UserName); } public Task SetNormalizedUserNameAsync(User user, string normalizedName, CancellationToken cancellationToken) { user.NormalizedUserName = normalizedName; return Task.CompletedTask; } public Task SetUserNameAsync(User user, string userName, CancellationToken cancellationToken) { user.UserName = userName; return Task.CompletedTask; } public async Task UpdateAsync(User user, CancellationToken cancellationToken) { if (user.Contact != null) { if (user.Contact.IsTransient()) { user.Contact = await _memberService.CreateContactAsync(user.Contact); } else { await _memberService.UpdateContactAsync(user.Contact); } } var dtoUser = user.ToUserDto(); var resultDto = await _platformSecurityApi.UpdateAsync(dtoUser); //Evict user from the cache SecurityCacheRegion.ExpireUser(user.Id); return resultDto.ToIdentityResult(); } #endregion #region IUserLockoutStore members public Task GetAccessFailedCountAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.AccessFailedCount); } public Task GetLockoutEnabledAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.LockoutEnabled); } public Task GetLockoutEndDateAsync(User user, CancellationToken cancellationToken) { return Task.FromResult((DateTimeOffset?)user.LockoutEndDateUtc); } public Task IncrementAccessFailedCountAsync(User user, CancellationToken cancellationToken) { user.AccessFailedCount++; return Task.FromResult(user.AccessFailedCount); } public Task ResetAccessFailedCountAsync(User user, CancellationToken cancellationToken) { user.AccessFailedCount = 0; return Task.CompletedTask; } public Task SetLockoutEnabledAsync(User user, bool enabled, CancellationToken cancellationToken) { user.LockoutEnabled = enabled; return Task.CompletedTask; } public Task SetLockoutEndDateAsync(User user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken) { user.LockoutEndDateUtc = lockoutEnd?.UtcDateTime; return Task.CompletedTask; } #endregion #region IUserEmailStore members public async Task FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken) { var cacheKey = CacheKey.With(GetType(), "FindByEmailAsync", normalizedEmail); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var userDto = await _platformSecurityApi.GetUserByEmailAsync(normalizedEmail); return await PrepareUserResultAsync(cacheEntry, userDto); }, cacheNullValue: false); //Load user associated contact if (result != null && result.ContactId != null) { result.Contact = await _memberService.GetContactByIdAsync(result.ContactId); } return result; } public Task GetEmailAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.Email); } public Task GetEmailConfirmedAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.EmailConfirmed); } public Task GetNormalizedEmailAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.NormalizedEmail); } public Task SetEmailAsync(User user, string email, CancellationToken cancellationToken) { user.Email = email; return Task.CompletedTask; } public Task SetEmailConfirmedAsync(User user, bool confirmed, CancellationToken cancellationToken) { user.EmailConfirmed = confirmed; return Task.CompletedTask; } public Task SetNormalizedEmailAsync(User user, string normalizedEmail, CancellationToken cancellationToken) { user.NormalizedEmail = normalizedEmail; return Task.CompletedTask; } #endregion #region IUserLoginStore members public Task AddLoginAsync(User user, UserLoginInfo login, CancellationToken cancellationToken) { user.ExternalLogins.Add(new ExternalUserLoginInfo { LoginProvider = login.LoginProvider, ProviderKey = login.ProviderKey, ProviderDisplayName = login.ProviderDisplayName }); return Task.CompletedTask; } public async Task FindByLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken) { var cacheKey = CacheKey.With(GetType(), "FindByLoginAsync", loginProvider, providerKey); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var userDto = await _platformSecurityApi.GetUserByLoginAsync(loginProvider, providerKey); return await PrepareUserResultAsync(cacheEntry, userDto); }, cacheNullValue: false); //Load user associated contact if (result != null && result.ContactId != null) { result.Contact = await _memberService.GetContactByIdAsync(result.ContactId); } return result; } public Task> GetLoginsAsync(User user, CancellationToken cancellationToken) { IList result = user.ExternalLogins?.Select(x => new UserLoginInfo(x.LoginProvider, x.ProviderKey, x.ProviderDisplayName)).ToList(); return Task.FromResult(result); } public Task RemoveLoginAsync(User user, string loginProvider, string providerKey, CancellationToken cancellationToken) { var existUserLogin = user.ExternalLogins?.FirstOrDefault(x => x.LoginProvider.EqualsInvariant(loginProvider) && x.ProviderKey.EqualsInvariant(providerKey)); if (existUserLogin != null) { user.ExternalLogins.Remove(existUserLogin); } return Task.CompletedTask; } #endregion #region IUserPasswordStore members public Task GetPasswordHashAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.PasswordHash); } public Task HasPasswordAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.PasswordHash != null); } public Task SetPasswordHashAsync(User user, string passwordHash, CancellationToken cancellationToken) { user.PasswordHash = passwordHash; return Task.CompletedTask; } #endregion #region IUserSecurityStampStore members public Task SetSecurityStampAsync(User user, string stamp, CancellationToken cancellationToken) { user.SecurityStamp = stamp; return Task.CompletedTask; } public Task GetSecurityStampAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.SecurityStamp); } #endregion #region IUserPhoneNumberStore members public Task SetPhoneNumberAsync(User user, string phoneNumber, CancellationToken cancellationToken) { user.PhoneNumber = phoneNumber; return Task.CompletedTask; } public Task GetPhoneNumberAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.PhoneNumber); } public Task GetPhoneNumberConfirmedAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.PhoneNumberConfirmed); } public Task SetPhoneNumberConfirmedAsync(User user, bool confirmed, CancellationToken cancellationToken) { user.PhoneNumberConfirmed = confirmed; return Task.CompletedTask; } #endregion public Task SetTwoFactorEnabledAsync(User user, bool enabled, CancellationToken cancellationToken) { user.TwoFactorEnabled = enabled; return Task.CompletedTask; } public Task GetTwoFactorEnabledAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.TwoFactorEnabled); } #region IUserClaimStore members public Task> GetClaimsAsync(User user, CancellationToken cancellationToken) { IList result = new List(); if (user.IsAdministrator) { result.Add(new Claim(ClaimTypes.Role, SecurityConstants.Roles.Administrator)); } if (user.SelectedCurrencyCode != null) { result.Add(new Claim(SecurityConstants.Claims.CurrencyClaimType, user.SelectedCurrencyCode)); } if (!string.IsNullOrEmpty(user.OperatorUserName)) { result.Add(new Claim(SecurityConstants.Claims.OperatorUserNameClaimType, user.OperatorUserName)); } if (!string.IsNullOrEmpty(user.OperatorUserId)) { result.Add(new Claim(SecurityConstants.Claims.OperatorUserIdClaimType, user.OperatorUserId)); result.Add(new Claim(SecurityConstants.Claims.OperatorUserNameClaimType, user.OperatorUserName)); } if (!user.Permissions.IsNullOrEmpty()) { foreach (var permission in user.Permissions) { result.Add(new Claim(SecurityConstants.Claims.PermissionClaimType, permission)); } } if (!user.Roles.IsNullOrEmpty()) { foreach (var role in user.Roles) { result.Add(new Claim(ClaimTypes.Role, role.Id)); } } return Task.FromResult(result); } public Task AddClaimsAsync(User user, IEnumerable claims, CancellationToken cancellationToken) { return Task.CompletedTask; } public Task ReplaceClaimAsync(User user, Claim claim, Claim newClaim, CancellationToken cancellationToken) { return Task.CompletedTask; } public Task RemoveClaimsAsync(User user, IEnumerable claims, CancellationToken cancellationToken) { throw new NotImplementedException(); } public Task> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken) { IList result = new List(); return Task.FromResult(result); } #endregion #region IRoleStore members public Task GetRoleIdAsync(Role role, CancellationToken cancellationToken) { return Task.FromResult(role.Id); } public Task GetRoleNameAsync(Role role, CancellationToken cancellationToken) { return Task.FromResult(role.Name); } public Task SetRoleNameAsync(Role role, string roleName, CancellationToken cancellationToken) { role.Name = roleName; return Task.CompletedTask; } public Task GetNormalizedRoleNameAsync(Role role, CancellationToken cancellationToken) { return Task.FromResult(role.Name); } public Task SetNormalizedRoleNameAsync(Role role, string normalizedName, CancellationToken cancellationToken) { role.Name = normalizedName; return Task.CompletedTask; } async Task IRoleStore.FindByIdAsync(string roleId, CancellationToken cancellationToken) { var result = (await _platformSecurityApi.GetRoleAsync(roleId))?.ToRole(); return result; } Task IRoleStore.FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken) { throw new NotImplementedException(); } #endregion #region IUserAuthenticatorKeyStore public Task SetAuthenticatorKeyAsync(User user, string key, CancellationToken cancellationToken) { user.TwoFactorAuthenticatorKey = key; return Task.CompletedTask; } public Task GetAuthenticatorKeyAsync(User user, CancellationToken cancellationToken) { return Task.FromResult(user.TwoFactorAuthenticatorKey); } #endregion IUserAuthenticatorKeyStore public void Dispose() { // Cleanup } private Task PrepareUserResultAsync(MemoryCacheEntryOptions options, AutoRestClients.PlatformModuleApi.Models.ApplicationUser userDto) { User result = null; if (userDto != null) { result = userDto.ToUser(); options.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); options.AddExpirationToken(new PollingApiUserChangeToken(_platformSecurityApi, _options.ChangesPollingInterval)); options.AddExpirationToken(SecurityCacheRegion.CreateChangeToken(userDto.Id)); } return Task.FromResult(result); } private async Task SaveAsync(Role role, CancellationToken cancellationToken) { var result = IdentityResult.Success; await _platformSecurityApi.UpdateRoleAsync(role.ToRoleDto(), cancellationToken); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/SeoInfoService.cs ================================================ using System; using System.Linq; using System.Threading.Tasks; using VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi; using VirtoCommerce.Storefront.Common; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public class SeoInfoService : ISeoInfoService { private readonly ICommerce _coreModuleApi; public SeoInfoService(ICommerce coreModuleApi) { _coreModuleApi = coreModuleApi; } public async Task GetSeoInfosBySlug(string slug) { var result = (await _coreModuleApi.GetSeoInfoBySlugAsync(slug)).Select(x => x.ToSeoInfo()).ToArray(); return result; } public async Task GetBestMatchingSeoInfos(string slug, Store store, string currentCulture) { var result = (await _coreModuleApi.GetSeoInfoBySlugAsync(slug)).GetBestMatchingSeoInfos(store, currentCulture, slug).Select(x => x.ToSeoInfo()).ToArray(); return result; } public ContentItem GetContentItem(string slug, WorkContext context) { ContentItem result = null; var pageUrl = slug == "__index__home__page__" ? "/" : $"/{slug}"; try { var pages = context.Pages.Where(p => string.Equals(p.Url, pageUrl, StringComparison.OrdinalIgnoreCase) || string.Equals(p.Url, slug, StringComparison.OrdinalIgnoreCase) ); var page = pages.FirstOrDefault(x => x.Language.CultureName.EqualsInvariant(context.CurrentLanguage.CultureName)) ?? pages.FirstOrDefault(x => x.Language.IsInvariant) ?? pages.FirstOrDefault(x => x.AliasesUrls.Contains(pageUrl, StringComparer.OrdinalIgnoreCase)); result = page; } catch { //do nothing } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/SpaRouteService.cs ================================================ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using Newtonsoft.Json; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class SpaRouteService : ISpaRouteService { private readonly IContentBlobProvider _contentBlobProvider; private readonly IStorefrontMemoryCache _memoryCache; private readonly IWorkContextAccessor _workContextAccessor; public SpaRouteService( IContentBlobProvider contentBlobProvider, IStorefrontMemoryCache memoryCache, IWorkContextAccessor workContextAccessor) { _contentBlobProvider = contentBlobProvider; _memoryCache = memoryCache; _workContextAccessor = workContextAccessor; } public virtual async Task IsSpaRoute(string route) { var workContext = _workContextAccessor.WorkContext; var cacheKey = CacheKey.With(GetType(), nameof(IsSpaRoute), workContext.CurrentStore.Id, route); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (_) => { var routes = await GetSpaRoutes(); var isSpaRoute = routes.Any(jsPattern => { // Input sample: jsPattern = "/^\\/account\\/profile\\/?$/i" // Only the char "i" can be an ending. The others chars are not used // when generating RegExp patterns in the `routes.json` file. var options = jsPattern.EndsWith("i") ? RegexOptions.IgnoreCase : RegexOptions.None; var pattern = Regex.Replace(jsPattern, @"^\/|\/i?$", string.Empty); return Regex.IsMatch(route, pattern, options); }); return isSpaRoute; }); return result; } protected virtual async Task> GetSpaRoutes() { var workContext = _workContextAccessor.WorkContext; var cacheKey = CacheKey.With(GetType(), nameof(GetSpaRoutes), workContext.CurrentStore.Id); var routes = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (_) => { var result = new List(); var currentThemeName = !string.IsNullOrEmpty(workContext.CurrentStore.ThemeName) ? workContext.CurrentStore.ThemeName : "default"; var currentThemePath = Path.Combine("Themes", workContext.CurrentStore.Id, currentThemeName); var currentThemeSettingPath = Path.Combine(currentThemePath, "config", "routes.json"); if (_contentBlobProvider.PathExists(currentThemeSettingPath)) { await using var stream = _contentBlobProvider.OpenRead(currentThemeSettingPath); result = JsonConvert.DeserializeObject>(await stream.ReadToStringAsync()); } return result; }); return routes; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/LinkListConverter.cs ================================================ using System.Linq; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using contentDto = VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static partial class LinkListConverter { public static MenuLinkList ToMenuLinkList(this contentDto.MenuLinkList menuLinkListDto) { var result = new MenuLinkList { Id = menuLinkListDto.Id, Name = menuLinkListDto.Name?.Handelize(), StoreId = menuLinkListDto.StoreId, Language = string.IsNullOrEmpty(menuLinkListDto.Language) ? Language.InvariantLanguage : new Language(menuLinkListDto.Language) }; if (menuLinkListDto.MenuLinks != null) { result.MenuLinks = menuLinkListDto.MenuLinks.Select(ToMenuLink).ToList(); } return result; } public static MenuLink ToMenuLink(this contentDto.MenuLink menuLinkDto) { var result = new MenuLink(); if (menuLinkDto.AssociatedObjectType != null) { if ("product" == menuLinkDto.AssociatedObjectType.ToLowerInvariant()) { result = new ProductMenuLink(); } else if ("category" == menuLinkDto.AssociatedObjectType.ToLowerInvariant()) { result = new CategoryMenuLink(); } } result.Id = menuLinkDto.Id; result.AssociatedObjectId = menuLinkDto.AssociatedObjectId; result.AssociatedObjectType = menuLinkDto.AssociatedObjectType; result.Priority = menuLinkDto.Priority ?? 0; result.Title = menuLinkDto.Title; result.Url = menuLinkDto.Url; return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/LinkListServiceImpl.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using VirtoCommerce.Storefront.AutoRestClients.ContentModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.LinkList.Services; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public class MenuLinkListServiceImpl : IMenuLinkListService { private readonly IMenu _cmsApi; private readonly IStorefrontMemoryCache _memoryCache; private readonly IApiChangesWatcher _apiChangesWatcher; public MenuLinkListServiceImpl(IMenu cmsApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher apiChangesWatcher) { _cmsApi = cmsApi; _memoryCache = memoryCache; _apiChangesWatcher = apiChangesWatcher; } public IList LoadAllStoreLinkLists(Store store, Language language) { return LoadAllStoreLinkListsAsync(store, language).GetAwaiter().GetResult(); } public Task> LoadAllStoreLinkListsAsync(Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } return LoadAllStoreLinkListsInternalAsync(store, language); } public async Task> LoadAllStoreLinkListsInternalAsync(Store store, Language language) { var cacheKey = CacheKey.With(GetType(), "LoadAllStoreLinkLists", store.Id, language.CultureName); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(StaticContentCacheRegion.CreateChangeToken()); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); var result = new List(); var listsDto = await _cmsApi.GetListsAsync(store.Id); if (listsDto != null) { result.AddRange(listsDto.Select(x => x.ToMenuLinkList())); } result = result.GroupBy(x => x.Name).Select(x => x.FindWithLanguage(language)).Where(x => x != null).ToList(); return result.ToList(); }); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/MarkdownContentLoader.cs ================================================ using Markdig; namespace VirtoCommerce.Storefront.Domain { public class MarkdownContentLoader : StaticContentLoader { private readonly MarkdownPipeline _markdownPipeline; public MarkdownContentLoader(MarkdownPipeline markdownPipeline) { _markdownPipeline = markdownPipeline; } public override string PrepareContent(string content) { return Markdown.ToHtml(base.PrepareContent(content), _markdownPipeline); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/PageBuilderContentLoader.cs ================================================ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class PageBuilderContentLoader : IStaticContentLoader { public string PrepareContent(string content) { return content; } public void ReadMetaData(string content, IDictionary> metadata) { var page = JsonConvert.DeserializeObject(content); var settings = page.GetValue("settings"); var items = settings.AsJEnumerable(); foreach (var item in items.OfType()) { metadata.Add(item.Name, new List { item.Value.ToString() }); } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentCacheRegion.cs ================================================ using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain { public class StaticContentCacheRegion : CancellableCacheRegion { } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentItemFactory.cs ================================================ using System.IO; using System.Text.RegularExpressions; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class StaticContentItemFactory : IStaticContentItemFactory { private static readonly Regex _blogMatchRegex = new Regex(@"blogs/(?[^\/]*)\/([^\/]*)\.[^\.]+$", RegexOptions.Compiled); public ContentItem GetItemFromPath(string path) { ContentItem retVal = null; if (!string.IsNullOrEmpty(path)) { //Blog var blogMatch = _blogMatchRegex.Match(path); if (blogMatch.Success) { var blogName = blogMatch.Groups["blog"].Value; var fileName = Path.GetFileNameWithoutExtension(path); if (fileName.EqualsInvariant(blogName) || fileName.EqualsInvariant("default")) { retVal = new Blog() { Name = blogName, }; } else { retVal = new BlogArticle() { BlogName = blogName }; } } else { retVal = new ContentPage(); } } return retVal; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentLoader.cs ================================================ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using VirtoCommerce.Storefront.Model.StaticContent; using YamlDotNet.RepresentationModel; namespace VirtoCommerce.Storefront.Domain { public class StaticContentLoader : IStaticContentLoader { private static readonly Regex _headerRegExp = new Regex(@"(?s:^---(.*?)---)"); public virtual string PrepareContent(string content) { return RemoveYamlHeader(content); } public virtual void ReadMetaData(string content, IDictionary> metadata) { ReadYamlHeader(content, metadata); } private static string RemoveYamlHeader(string text) { var result = text; var headerMatches = _headerRegExp.Matches(text); if (headerMatches.Count > 0) { result = text.Replace(headerMatches[0].Groups[0].Value, "").Trim(); } return result; } private static void ReadYamlHeader(string text, IDictionary> metadata) { var headerMatches = _headerRegExp.Matches(text); if (headerMatches.Count > 0) { var input = new StringReader(headerMatches[0].Groups[1].Value); var yaml = new YamlStream(); yaml.Load(input); if (yaml.Documents.Count > 0) { var root = yaml.Documents[0].RootNode; if (root is YamlMappingNode collection) { foreach (var entry in collection.Children) { if (entry.Key is YamlScalarNode node) { metadata.Add(node.Value, GetYamlNodeValues(entry.Value)); } } } } } } private static IEnumerable GetYamlNodeValues(YamlNode value) { var result = new List(); if (value is YamlSequenceNode list) { result.AddRange(list.Children.OfType().Select(node => node.Value)); } else { result.Add(value.ToString()); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentLoaderFactory.cs ================================================ using System.IO; using Markdig; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.StaticContent; namespace VirtoCommerce.Storefront.Domain { public class StaticContentLoaderFactory : IStaticContentLoaderFactory { public IStaticContentLoader CreateLoader(ContentItem contentItem) { switch (Path.GetExtension(contentItem.StoragePath)) { case string value when value.EqualsInvariant(".PAGE") || value.EqualsInvariant(".JSON"): return new PageBuilderContentLoader(); case string value when value.EqualsInvariant(".MD"): return new MarkdownContentLoader(new MarkdownPipelineBuilder().UseAdvancedExtensions().Build()); default: return new StaticContentLoader(); } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentService.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Model.Stores; using VirtoCommerce.Tools; namespace VirtoCommerce.Storefront.Domain { /// /// Represent a search and rendering static content (pages and blogs) /// public class StaticContentService : IStaticContentService { private static readonly string[] _extensions = { ".md", ".html", ".page", ".template", ".json" }; private readonly IStaticContentItemFactory _contentItemFactory; private readonly IContentBlobProvider _contentBlobProvider; private readonly IStorefrontMemoryCache _memoryCache; private readonly IStaticContentLoaderFactory _metadataFactory; public StaticContentService(IStorefrontMemoryCache memoryCache, IStaticContentItemFactory contentItemFactory, IContentBlobProvider contentBlobProvider, IStaticContentLoaderFactory metadataFactory) { _contentItemFactory = contentItemFactory; _contentBlobProvider = contentBlobProvider; _memoryCache = memoryCache; _metadataFactory = metadataFactory; } #region IStaticContentService Members public IEnumerable LoadStoreStaticContent(Store store, string type, bool force = false) { var theme = store.ThemeName ?? "default"; var baseStoreContentPath = Path.Combine("Themes", store.Id, theme, "content", type); if (force) { var retVal = ReadContentInternal(baseStoreContentPath); return retVal.ToArray(); } var cacheKey = CacheKey.With(GetType(), "LoadStoreStaticContent", store.Id, type, theme); return _memoryCache.GetOrCreateExclusive(cacheKey, (cacheEntry) => { cacheEntry.AddExpirationToken(new CompositeChangeToken(new[] { StaticContentCacheRegion.CreateChangeToken(), _contentBlobProvider.Watch(baseStoreContentPath + "/**/*") })); var retVal = ReadContentInternal(baseStoreContentPath); return retVal.ToArray(); }); } private ContentItem[] ReadContentInternal(string baseStoreContentPath) { var retVal = new List(); const string searchPattern = "*.*"; if (!_contentBlobProvider.PathExists(baseStoreContentPath)) { return retVal.ToArray(); } // Search files by requested search pattern var contentBlobs = _contentBlobProvider.Search(baseStoreContentPath, searchPattern, true) .Where(x => _extensions.Any(x.EndsWith)) .Select(x => x.Replace("\\\\", "\\")); // each content file has a name pattern {name}.{language?}.{ext} var localizedBlobs = contentBlobs.Select(x => new LocalizedBlobInfo(x)); foreach (var localizedBlob in localizedBlobs.OrderBy(x => x.Name)) { var blobRelativePath = "/" + localizedBlob.Path.TrimStart('/'); var contentItem = _contentItemFactory.GetItemFromPath(blobRelativePath); if (contentItem == null) { continue; } contentItem.Name ??= localizedBlob.Name; contentItem.Language = localizedBlob.Language; contentItem.FileName = Path.GetFileName(blobRelativePath); contentItem.StoragePath = "/" + blobRelativePath.Replace(baseStoreContentPath + "/", string.Empty).TrimStart('/'); LoadAndRenderContentItem(blobRelativePath, contentItem); retVal.Add(contentItem); } return retVal.ToArray(); } #endregion private void LoadAndRenderContentItem(string contentPath, ContentItem contentItem) { string content; using (var stream = _contentBlobProvider.OpenRead(contentPath)) { // Load raw content with metadata content = stream.ReadToString(); } IDictionary> metaHeaders = new Dictionary>(); var metadataReader = _metadataFactory.CreateLoader(contentItem); try { metadataReader.ReadMetaData(content, metaHeaders); } catch (Exception ex) // NOTE: Exception must have a specific type! { var error = $"Failed to parse metadata from \"{contentItem.StoragePath}\"
{ex.Message}"; content = $"{error}
{content}"; } content = metadataReader.PrepareContent(content); contentItem.LoadContent(content, metaHeaders); if (string.IsNullOrEmpty(contentItem.Permalink)) { contentItem.Permalink = ":folder/:categories/:title"; } // Transform permalink template to url contentItem.Url = GetContentItemUrl(contentItem, contentItem.Permalink); // Transform aliases permalink templates to urls contentItem.AliasesUrls = contentItem.Aliases.Select(x => GetContentItemUrl(contentItem, x)).ToList(); } private static string GetContentItemUrl(ContentItem item, string permalink) { return new FrontMatterPermalink { UrlTemplate = permalink, Categories = item.Categories, Date = item.CreatedDate, FilePath = item.StoragePath }.ToUrl(); } // each content file has a name pattern {name}.{language?}.{ext} private class LocalizedBlobInfo { public LocalizedBlobInfo(string blobPath) { Path = blobPath; Language = Language.InvariantLanguage; var parts = System.IO.Path.GetFileName(blobPath)?.Split('.'); Name = parts?.FirstOrDefault(); if (parts?.Length == 3) { try { Language = new Language(parts[1]); } catch (Exception) { Language = Language.InvariantLanguage; } } } public string Name { get; } public Language Language { get; } public string Path { get; } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/StaticContent/StaticContentWorkContextBuilderExtensions.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using PagedList.Core; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.LinkList.Services; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public static class StaticContentWorkContextBuilderExtensions { public static Task WithMenuLinksAsync(this IWorkContextBuilder builder, IMutablePagedList linkLists) { builder.WorkContext.CurrentLinkLists = linkLists; return Task.CompletedTask; } public static Task WithMenuLinksAsync(this IWorkContextBuilder builder, Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } var serviceProvider = builder.HttpContext.RequestServices; var linkListService = serviceProvider.GetRequiredService(); IPagedList Factory(int pageNumber, int pageSize, IEnumerable sorInfos) { var linkLists = linkListService.LoadAllStoreLinkLists(store, language); return new StaticPagedList(linkLists, pageNumber, pageSize, linkLists.Count()); } return builder.WithMenuLinksAsync(new MutablePagedList((Func, IPagedList>)Factory, 1, 20)); } public static Task WithPagesAsync(this IWorkContextBuilder builder, IMutablePagedList pages) { builder.WorkContext.Pages = pages; return Task.CompletedTask; } public static Task WithPagesAsync(this IWorkContextBuilder builder, Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } var serviceProvider = builder.HttpContext.RequestServices; var staticContentService = serviceProvider.GetRequiredService(); // all static content items IPagedList Factory(int pageNumber, int pageSize, IEnumerable sorInfos) { var contentItems = staticContentService.LoadStoreStaticContent(store, "pages", builder.WorkContext.IsPreviewMode); return new StaticPagedList(contentItems, pageNumber, pageSize, contentItems.Count()); } return builder.WithPagesAsync(new MutablePagedList((Func, IPagedList>)Factory, 1, 20)); } public static Task WithBlogsAsync(this IWorkContextBuilder builder, IMutablePagedList blogs) { builder.WorkContext.Blogs = blogs; return Task.CompletedTask; } public static Task WithBlogsAsync(this IWorkContextBuilder builder, Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } var serviceProvider = builder.HttpContext.RequestServices; var staticContentService = serviceProvider.GetRequiredService(); IPagedList Factory(int pageNumber, int pageSize, IEnumerable sorInfos) { var contentItems = staticContentService.LoadStoreStaticContent(store, "blogs", builder.WorkContext.IsPreviewMode).Where(x => x.Language.IsInvariant || x.Language == language); var blogs = contentItems.OfType().ToArray(); var blogArticlesGroup = contentItems.OfType().GroupBy(x => x.BlogName, x => x).ToList(); foreach (var blog in blogs) { var blogArticles = blogArticlesGroup.FirstOrDefault(x => string.Equals(x.Key, blog.Name, StringComparison.OrdinalIgnoreCase)); if (blogArticles != null) { blog.Articles = new MutablePagedList(blogArticles); } } return new StaticPagedList(blogs, pageNumber, pageSize, blogs.Count()); } // Initialize blogs search criteria builder.WorkContext.CurrentBlogSearchCritera = new BlogSearchCriteria(builder.WorkContext.QueryString); return builder.WithBlogsAsync(new MutablePagedList(Factory, 1, 20)); } public static Task WithTemplatesAsync(this IWorkContextBuilder builder, IMutablePagedList templates) { builder.WorkContext.Templates = templates; return Task.CompletedTask; } public static Task WithTemplatesAsync(this IWorkContextBuilder builder, Store store) { if (store == null) { throw new ArgumentNullException(nameof(store)); } var serviceProvider = builder.HttpContext.RequestServices; var staticContentService = serviceProvider.GetRequiredService(); // all static content items IPagedList Factory(int pageNumber, int pageSize, IEnumerable sorInfos) { var contentItems = staticContentService.LoadStoreStaticContent(store, "templates", builder.WorkContext.IsPreviewMode); return new StaticPagedList(contentItems, pageNumber, pageSize, contentItems.Count()); } return builder.WithTemplatesAsync(new MutablePagedList(Factory, 1, 20)); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/SelectCurrentCurrencyPolicy.cs ================================================ using System.Collections.Generic; using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public static class SelectCurrentCurrencyPolicy { public static Currency GetCurrentCurrency(this HttpContext context, IEnumerable currencies, Store store) { //Try get default store currency first var result = currencies.FirstOrDefault(x => x.Equals(store.DefaultCurrencyCode)); //Try get currency from request url StringValues currencyCode; if (!context.Request.Query.TryGetValue("currency", out currencyCode)) { //Next try get from claims currencyCode = context.User.FindFirstValue(SecurityConstants.Claims.CurrencyClaimType); } //Get store default currency if currency not in the supported by stores list if (!string.IsNullOrEmpty(currencyCode)) { result = currencies.FirstOrDefault(x => x.Equals(currencyCode.First())) ?? result; } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/SelectCurrentLanguagePolicy.cs ================================================ using System; using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public static class SelectCurrentLanguagePolicy { public static Language GetCurrentLanguage(this HttpContext context, Store store) { if (store == null) { throw new ArgumentNullException(nameof(store)); } //Try to get language from request var result = store.DefaultLanguage; var regexpPattern = string.Format(@"\/({0})\/?", string.Join("|", store.Languages.Select(x => x.CultureName))); var match = Regex.Match(context.Request.Path, regexpPattern, RegexOptions.IgnoreCase); if (match.Success && match.Groups.Count > 1) { var language = new Language(match.Groups[1].Value); //Get store default language if language not in the supported by stores list result = store.Languages.Contains(language) ? language : result; } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/SelectCurrentStorePolicy.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using Microsoft.ApplicationInsights.AspNetCore.Extensions; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public static class SelectCurrentStorePolicy { public static Store GetCurrentStore(this HttpContext context, IEnumerable stores, string defaultStoreId) { if (stores == null) { throw new ArgumentNullException(nameof(stores)); } //Try first find by store url (if it defined) var result = stores.FirstOrDefault(x => context.Request.Path.StartsWithSegments(new PathString("/" + x.Id))); if (result == null) { result = stores.FirstOrDefault(x => x.IsStoreUrl(context.Request.GetUri())); } if (result == null && defaultStoreId != null) { result = stores.FirstOrDefault(x => x.Id.EqualsInvariant(defaultStoreId)); } if (result == null) { result = stores.FirstOrDefault(); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/StoreCacheRegion.cs ================================================ using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Domain { public class StoreCacheRegion : CancellableCacheRegion { } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/StoreConverter.cs ================================================ using System; using System.Linq; using VirtoCommerce.Storefront.Common; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; using storeDto = VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { public static partial class StoreConverter { public static SeoInfo ToSeoInfo(this storeDto.SeoInfo seoDto) { return seoDto.JsonConvert().ToSeoInfo(); } public static DynamicProperty ToDynamicProperty(this storeDto.DynamicObjectProperty propertyDto) { return propertyDto.JsonConvert().ToDynamicProperty(); } public static Store ToStore(this storeDto.Store storeDto) { var result = new Store { AdminEmail = storeDto.AdminEmail, Catalog = storeDto.Catalog, Country = storeDto.Country, Description = storeDto.Description, Email = storeDto.Email, Id = storeDto.Id, Name = storeDto.Name, Region = storeDto.Region, SecureUrl = storeDto.SecureUrl, TimeZone = storeDto.TimeZone, Url = storeDto.Url, DefaultFulfillmentCenterId = storeDto.MainFulfillmentCenterId, AvailFulfillmentCenterIds = (storeDto.AdditionalFulfillmentCenterIds ?? Array.Empty()).ToList(), }; if (result.DefaultFulfillmentCenterId != null) { result.AvailFulfillmentCenterIds.Add(result.DefaultFulfillmentCenterId); } if (!storeDto.SeoInfos.IsNullOrEmpty()) { result.SeoInfos = storeDto.SeoInfos.Select(ToSeoInfo).ToList(); } result.DefaultLanguage = storeDto.DefaultLanguage != null ? new Language(storeDto.DefaultLanguage) : Language.InvariantLanguage; if (!storeDto.Languages.IsNullOrEmpty()) { result.Languages = storeDto.Languages.Select(x => new Language(x)).ToList(); } result.CurrenciesCodes = storeDto.Currencies.Concat(new[] { storeDto.DefaultCurrency }) .Where(x => !string.IsNullOrEmpty(x)) .Distinct() .ToList(); result.DefaultCurrencyCode = storeDto.DefaultCurrency; if (!storeDto.DynamicProperties.IsNullOrEmpty()) { result.DynamicProperties = new MutablePagedList(storeDto.DynamicProperties.Select(ToDynamicProperty).ToList()); result.ThemeName = result.DynamicProperties.GetDynamicPropertyValue("DefaultThemeName"); } if (!storeDto.Settings.IsNullOrEmpty()) { result.Settings = new MutablePagedList(storeDto.Settings.Where(x => !x.ValueType.EqualsInvariant("SecureString")) .Select(x => x.JsonConvert() .ToSettingEntry())); } result.TrustedGroups = storeDto.TrustedGroups; result.StoreState = EnumUtility.SafeParse(storeDto.StoreState, StoreStatus.Open); result.SeoLinksType = EnumUtility.SafeParse(result.Settings.GetSettingValue("Stores.SeoLinksType", ""), SeoLinksType.Collapsed); result.QuotesEnabled = result.Settings.GetSettingValue("Quotes.EnableQuotes", false); result.SubscriptionEnabled = result.Settings.GetSettingValue("Subscription.EnableSubscriptions", false); result.TaxCalculationEnabled = result.Settings.GetSettingValue("Stores.TaxCalculationEnabled", true); result.AnonymousUsersAllowed = result.Settings.GetSettingValue("Stores.AllowAnonymousUsers", true); result.IsSpa = result.Settings.GetSettingValue("Stores.IsSpa", false); result.EmailVerificationEnabled = result.Settings.GetSettingValue("Stores.EmailVerificationEnabled", false); result.CreateAnonymousOrderEnabled = result.Settings.GetSettingValue("XOrder.CreateAnonymousOrderEnabled", true); result.CartValidationRuleSet = result.Settings.GetSettingValue("Stores.CartValidationRuleSet", null); if (string.IsNullOrEmpty(result.CartValidationRuleSet)) { result.CartValidationRuleSet = result.DynamicProperties?.GetDynamicPropertyValue("CartValidationRuleSet"); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/StoreService.cs ================================================ using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.Stores; using StoreApi = VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models; namespace VirtoCommerce.Storefront.Domain { /// /// Data access object for stores implementation /// public class StoreService : IStoreService { private readonly IStoreModule _storeApi; private readonly IStorefrontMemoryCache _memoryCache; private readonly IApiChangesWatcher _apiChangesWatcher; private readonly StorefrontOptions _storefrontOptions; public StoreService(IStoreModule storeApi , IStorefrontMemoryCache memoryCache , IApiChangesWatcher apiChangesWatcher , IOptions storefrontOptions) { _storeApi = storeApi; _memoryCache = memoryCache; _apiChangesWatcher = apiChangesWatcher; _storefrontOptions = storefrontOptions.Value; } public async Task GetAllStoresAsync() { var cacheKey = CacheKey.With(GetType(), "GetAllStoresAsync"); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(StoreCacheRegion.CreateChangeToken()); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); var storeDtos = await _storeApi.GetStoresAsync(); return await Task.WhenAll(storeDtos.Select(x => ConvertStoreAndLoadDependeciesAsync(x))); }, cacheNullValue: false); } public async Task GetStoreByIdAsync(string id, Currency currency = null) { var cacheKey = CacheKey.With(GetType(), "GetStoreByIdAsync", id, currency?.ToString()); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(StoreCacheRegion.CreateChangeToken()); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); var storeDto = await _storeApi.GetStoreByIdAsync(id); return await ConvertStoreAndLoadDependeciesAsync(storeDto, currency); }, cacheNullValue: false); } protected virtual Task ConvertStoreAndLoadDependeciesAsync(StoreApi.Store storeDto, Currency currency = null) { var result = storeDto.ToStore(); //use url for stores from configuration file with hight priority than store url defined in manager result.Url = _storefrontOptions.StoreUrls[result.Id] ?? result.Url; //theme name defined in storefront app options has a higher prioirty over one defined in admin result.ThemeName = !string.IsNullOrEmpty(_storefrontOptions.DefaultTheme) ? _storefrontOptions.DefaultTheme : result.ThemeName; return Task.FromResult(result); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/Stores/StoreWorkContextBuilderExtensions.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text.Encodings.Web; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using VirtoCommerce.Storefront.Infrastructure.Exceptions; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Domain { public static class StoreWorkContextBuilderExtensions { public static Task WithStoresAsync(this IWorkContextBuilder builder, IEnumerable stores, string defaultStoreId) { if (stores == null) { throw new NoStoresException(); } builder.WorkContext.AllStores = stores.ToArray(); var currentStore = builder.HttpContext.GetCurrentStore(stores, defaultStoreId); currentStore.ThemeName = builder.WorkContext.QueryString["previewtheme"] ?? currentStore.ThemeName; //Very important workaround. If left Null or Empty as Url for default store with condition of multiple stores present, will be generated a relative url '/store_name/' instead of // '/' thats can leads to invalid urls to default store and other issue with that contains invalid relative url if (defaultStoreId != null && string.IsNullOrEmpty(currentStore.Url) && currentStore.Id.EqualsInvariant(defaultStoreId)) { currentStore.Url = "/"; } builder.WorkContext.CurrentStore = currentStore; builder.WorkContext.CurrentLanguage = builder.HttpContext.GetCurrentLanguage(builder.WorkContext.CurrentStore); // SEO for category, product and blogs is set inside corresponding controllers // there we default SEO for requested store var seoInfo = builder.WorkContext.CurrentStore.SeoInfos?.FirstOrDefault(x => x.Language == builder.WorkContext.CurrentLanguage); if (seoInfo != null && builder.WorkContext.RequestUrl != null) { var htmlEncoder = builder.HttpContext.RequestServices.GetRequiredService(); seoInfo.Slug = htmlEncoder.Encode(builder.WorkContext.RequestUrl.ToString()); builder.WorkContext.CurrentPageSeo = seoInfo; } return Task.CompletedTask; } public static async Task WithStoresAsync(this IWorkContextBuilder builder, string defaultStoreId) { var serviceProvider = builder.HttpContext.RequestServices; var storeService = serviceProvider.GetRequiredService(); var stores = await storeService.GetAllStoresAsync(); if (stores.IsNullOrEmpty()) { throw new NoStoresException(); } await builder.WithStoresAsync(stores, defaultStoreId); } public static Task WithCurrenciesAsync(this IWorkContextBuilder builder, IList availCurrencies, Store store) { if (availCurrencies == null) { throw new ArgumentNullException(nameof(availCurrencies)); } //Filter all avail currencies, leave only currencies define for store var storeCurrencies = availCurrencies.Where(x => store.CurrenciesCodes.Any(y => x.Equals(y))).ToList(); builder.WorkContext.AllCurrencies = storeCurrencies; builder.WorkContext.CurrentCurrency = builder.HttpContext.GetCurrentCurrency(availCurrencies, store); return Task.CompletedTask; } public static Task WithCurrenciesAsync(this IWorkContextBuilder builder, Language language, Store store) { if (language == null) { throw new ArgumentNullException(nameof(language)); } return WithCurrenciesInternalAsync(builder, language, store); } private static async Task WithCurrenciesInternalAsync(this IWorkContextBuilder builder, Language language, Store store) { var serviceProvider = builder.HttpContext.RequestServices; var currencyService = serviceProvider.GetRequiredService(); var currencies = await currencyService.GetAllCurrenciesAsync(language); await builder.WithCurrenciesAsync(currencies, store); } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/WorkContextAccessor.cs ================================================ using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Domain { public class WorkContextAccessor : IWorkContextAccessor { private readonly IHttpContextAccessor _httpContextAccessor; public WorkContextAccessor(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } public WorkContext WorkContext { get { return _httpContextAccessor.HttpContext?.Items["WorkContext"] as WorkContext; } set { _httpContextAccessor.HttpContext.Items["WorkContext"] = value; } } } } ================================================ FILE: VirtoCommerce.Storefront/Domain/WorkContextBuilder.cs ================================================ using System.Linq; using Microsoft.ApplicationInsights.AspNetCore.Extensions; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Domain { public partial class WorkContextBuilder : IWorkContextBuilder { public WorkContextBuilder(HttpContext httpContext, StorefrontOptions options) { HttpContext = httpContext; var qs = HttpContext.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString()).WithDefaultValue(null); WorkContext = new WorkContext { RequestUrl = HttpContext.Request.GetUri(), QueryString = qs, PageNumber = qs["page"].ToNullableInt() ?? 1, }; var pageSize = qs["count"].ToNullableInt() ?? qs["page_size"].ToNullableInt(); if (pageSize != null && pageSize.Value > options.PageSizeMaxValue) { pageSize = options.PageSizeMaxValue; } WorkContext.PageSize = pageSize ?? 20; //To interpret as true the value of preview_mode from the query string according to its actual presence, since another value of this parameter can be passed. WorkContext.IsPreviewMode = !string.IsNullOrEmpty(WorkContext.QueryString["preview_mode"]) || httpContext.Request.Headers["x-template-builder"] == "preview-mode"; } public HttpContext HttpContext { get; } public WorkContext WorkContext { get; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/ClaimsPrincipalExtensions.cs ================================================ using System.Security.Claims; namespace VirtoCommerce.Storefront.Extensions { public static class ClaimsPrincipalExtensions { public static string FindFirstValue(this ClaimsPrincipal principal, string[] claimTypes, string defaultValue) { foreach (var claimType in claimTypes) { var result = principal.FindFirstValue(claimType); if (!string.IsNullOrEmpty(result)) return result; } return defaultValue; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/HostingEnviromentExtension.cs ================================================ using System.IO; using Microsoft.AspNetCore.Hosting; namespace VirtoCommerce.Storefront.Extensions { public static class HostingEnviromentExtension { public static string MapPath(this IWebHostEnvironment hostEnv, string path) { var result = hostEnv.WebRootPath; if (path.StartsWith("~/")) { result = System.IO.Path.Combine(result, path.Replace("~/", string.Empty)); } else if (Path.IsPathRooted(path)) { result = path; } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/ObjectExtensions.cs ================================================ using Newtonsoft.Json.Linq; namespace VirtoCommerce.Storefront.Common { public static class ObjectExtensions { public static T JsonClone(this T source) { var jObject = JObject.FromObject(source); var result = jObject.ToObject(); return result; } public static T JsonConvert(this object source) { var jObject = JObject.FromObject(source); var result = jObject.ToObject(); return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/PathStringExtensions.cs ================================================ using System; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Extensions { public static class PathStringExtensions { const string FILE_SCHEME = "file"; private static string _storeLangeExpr = @"^/\b\S+\b/[a-zA-Z]{2}/"; public static PathString GetStoreAndLangSegment(this PathString path) { var matches = Regex.Match(path, _storeLangeExpr); return matches.Success ? matches.Value : "/"; } public static bool IsApi(this PathString path) { return path.ToString().Contains("/storefrontapi/"); } public static PathString TrimStoreAndLangSegment(this PathString path, Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } //need to remove store and language if it already exist in path path = Regex.Replace(path, @"^/\b" + store.Id + @"\b/", "/", RegexOptions.IgnoreCase); path = Regex.Replace(path, @"/\b" + language.CultureName + @"\b/", "/", RegexOptions.IgnoreCase); return path; } public static PathString AddStoreAndLangSegment(this PathString path, Store store, Language language) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } var result = new PathString(); //add store to path result = result.Add(new PathString("/" + store.Id)); //add language to path result = result.Add(new PathString("/" + language.CultureName)); //need to remove store and language if it already exist in the path result = result.Add(new PathString(path.TrimStoreAndLangSegment(store, language))); return result; } /// /// Trims first occurrence of store path ("/store" for "http://localhost/store") from the beginning of the url. Does nothing in case of empty store.Url. /// /// Path to trim store path from. /// Store which path to trim. /// public static PathString TrimStorePath(this PathString path, Store store) { if (store == null) { throw new ArgumentNullException(nameof(store)); } // Need to remove store path only if store has URL var storeUrl = !string.IsNullOrWhiteSpace(store.Url) ? store.Url : store.SecureUrl; if (!string.IsNullOrWhiteSpace(storeUrl) && (Uri.TryCreate(storeUrl, UriKind.Absolute, out var storeUri) && storeUri.Scheme != FILE_SCHEME)) { var storeUriPath = storeUri.AbsolutePath.Trim('/'); // Uri.AbsolutePath by default is "/" - no need to trim it if (!string.IsNullOrWhiteSpace(storeUriPath) && !storeUriPath.Equals("/")) { // Removing store url path from the beginning of path path = Regex.Replace(path, @"^/\b" + storeUriPath + @"\b/", "/", RegexOptions.IgnoreCase); } } return path; } public static PathString ToAbsolutePath(this string path) { // Checks whether path is absolute path (starts with scheme), and extract local path if it is if (Uri.TryCreate(path, UriKind.Absolute, out var absoluteUri) && absoluteUri.Scheme != FILE_SCHEME) { return absoluteUri.PathAndQuery; } return path; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/QueryCollectionExtensions.cs ================================================ using System; using System.Collections.Specialized; using Microsoft.AspNetCore.Http; namespace VirtoCommerce.Storefront.Extensions { public static class QueryCollectionExtensions { public static NameValueCollection ToNameValueCollection(this IQueryCollection queryCollection) { if (queryCollection == null) { throw new ArgumentNullException(nameof(queryCollection)); } var result = new NameValueCollection(); foreach (var pair in queryCollection) { result.Add(pair.Key, pair.Value); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Extensions/SeoExtensions.cs ================================================ using System.Collections.Generic; using System.Linq; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Stores; using VirtoCommerce.Tools; using catalogDto = VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi.Models; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; using toolsDto = VirtoCommerce.Tools.Models; namespace VirtoCommerce.Storefront.Common { public static class SeoExtensions { /// /// Returns SEO path if all outline items of the first outline have SEO keywords, otherwise returns default value. /// Path: GrandParentCategory/ParentCategory/ProductCategory/Product /// /// /// /// /// /// public static string GetSeoPath(this IEnumerable outlines, Store store, Language language, string defaultValue) { return outlines ?.Select(o => o.JsonConvert()) .GetSeoPath(store.ToToolsStore(), language.CultureName, defaultValue); } /// /// Returns SEO records with highest score /// http://docs.virtocommerce.com/display/vc2devguide/SEO /// /// /// /// /// /// public static IList GetBestMatchingSeoInfos(this IEnumerable seoRecords, Store store, Language language, string slug = null) { return seoRecords ?.Select(s => s.JsonConvert()) .GetBestMatchingSeoInfos(store.Id, store.DefaultLanguage.CultureName, language.CultureName, slug) .Select(s => s.JsonConvert()) .ToList(); } /// /// Returns SEO records with highest score /// http://docs.virtocommerce.com/display/vc2devguide/SEO /// /// /// /// /// /// public static IList GetBestMatchingSeoInfos(this IEnumerable seoRecords, Store store, string currentCulture, string slug = null) { return seoRecords ?.Select(s => s.JsonConvert()) .GetBestMatchingSeoInfos(store.Id, store.DefaultLanguage.CultureName, currentCulture, slug) .Select(s => s.JsonConvert()) .ToList(); } } } ================================================ FILE: VirtoCommerce.Storefront/Filters/AngularAntiforgeryCookieResultFilterAttribute.cs ================================================ using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; namespace VirtoCommerce.Storefront.Filters { /// /// Angular will be using their $http service for sending AJAX requests and will automatically include a header with the name X-XSRF-TOKEN /// if it can find the token value as a cookie with the name XSRF-TOKEN. /// This filter automatically set XSRF-TOKEN cookies for each request routed to the view /// public class AngularAntiforgeryCookieResultFilterAttribute : ResultFilterAttribute { private readonly IAntiforgery antiforgery; public AngularAntiforgeryCookieResultFilterAttribute(IAntiforgery antiforgery) { this.antiforgery = antiforgery; } public override void OnResultExecuting(ResultExecutingContext context) { var statusCodeReExecuteFeature = context.HttpContext.Features.Get(); //Reissue antiforgery cookies for follow cases: //- when is requested only an ASP.NET View. Since set cookies for each requests such Assets or file resources can leads to stop working the output cache middleware for that controllers //- when there are no errors or inner status codes ReExecute occurs (404, 500 etc) (IStatusCodeReExecuteFeature is presents). Since this can leads for reissue an antiforgery cookies .AspNetCore.Antiforgery without AspNetCore.Identity.Application //that can leads for 400 errors for antiforgery validation due to different User in the antiforgery tokens are received as cookies and request headers if (context.Result is ViewResult viewResult && statusCodeReExecuteFeature == null) { var tokens = antiforgery.GetAndStoreTokens(context.HttpContext); //We need to set this Cookies XSRF-TOKEN which can be used on the client's side. The most web frameworks such angular can automatically read this cookie add X-XSRF-TOKEN header to each request. context.HttpContext.Response.Cookies.Append("XSRF-TOKEN", tokens.RequestToken, new CookieOptions() { HttpOnly = false, IsEssential = true, SameSite = SameSiteMode.Lax }); } } } } ================================================ FILE: VirtoCommerce.Storefront/Filters/AnonymousUserForStoreAuthorizationFilter.cs ================================================ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization.Policy; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; using VirtoCommerce.Storefront.Domain.Security; namespace VirtoCommerce.Storefront.Filters { /// /// Authorization filter that redirects all unauthorized users to Login page (deafult AuthorizeFilter could show AccessDenied for non-authorized authenticated users) /// public class AnonymousUserForStoreAuthorizationFilter : IAsyncAuthorizationFilter { public readonly IAuthorizationPolicyProvider _policyProvider; public AnonymousUserForStoreAuthorizationFilter(IAuthorizationPolicyProvider policyProvider) { _policyProvider = policyProvider; } public Task OnAuthorizationAsync(AuthorizationFilterContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return OnAuthorizationInternalAsync(context); } protected async Task OnAuthorizationInternalAsync(AuthorizationFilterContext context) { // Don not call filter for ReExecute requests (such as status code pages) and skips all paths marked as AllowAnonymous attribute if (context.HttpContext.Features.Get() != null || context.Filters.Any(x => x is IAllowAnonymousFilter)) { return; } var policy = await _policyProvider.GetPolicyAsync(AnonymousUserForStoreAuthorizationRequirement.PolicyName); var policyEvaluator = context.HttpContext.RequestServices.GetRequiredService(); var authenticateResult = await policyEvaluator.AuthenticateAsync(policy, context.HttpContext); var authorizeResult = await policyEvaluator.AuthorizeAsync(policy, authenticateResult, context.HttpContext, context); // For all the results except Succeeded we need to return if (!authorizeResult.Succeeded) { // Here we need only ChallengeResult to redirect to Login instead of ForbiddenResult that standard AuthorizeFilter returns in that case (authenticated and non authorized user) // https://github.com/aspnet/AspNetCore/blob/v2.2.3/src/Mvc/Mvc.Core/src/Authorization/AuthorizeFilter.cs#L210 // https://github.com/aspnet/AspNetCore/blob/v2.2.3/src/Security/Authorization/Policy/src/PolicyEvaluator.cs#L91 context.Result = new ChallengeResult(policy.AuthenticationSchemes.ToArray()); } } } } ================================================ FILE: VirtoCommerce.Storefront/IISUrlRewrite.xml ================================================ ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/ApiAuthMode.cs ================================================ namespace VirtoCommerce.Storefront.Infrastructure { public enum ApiAuthMode { /// /// Barrier token by using AppId and SecretKey /// BarrierToken, /// /// OAuth2 resource owner password credentials grand flow (username, password) /// OAuthPassword } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/ApiChangesWatcher.cs ================================================ using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; namespace VirtoCommerce.Storefront.Infrastructure { public class ApiChangesWatcher : IApiChangesWatcher { private readonly IChangeLog _cacheApi; private readonly StorefrontOptions _options; public ApiChangesWatcher(IChangeLog cacheApi, IOptions options) { _cacheApi = cacheApi; _options = options.Value; } public IChangeToken CreateChangeToken() { return new PollingApiChangeToken(_cacheApi, _options.ChangesPollingInterval); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/ApplicationInsights/ServiceCollectionExtension.cs ================================================ using Microsoft.ApplicationInsights.AspNetCore; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.SnapshotCollector; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace VirtoCommerce.Storefront.Infrastructure.ApplicationInsights { public static class ServiceCollectionExtension { public static void AddApplicationInsightsExtensions(this IServiceCollection services, IConfiguration configuration) { services.AddSingleton(); services.Configure(configuration.GetSection(nameof(SnapshotCollectorConfiguration))); services.AddSingleton(sp => new SnapshotCollectorTelemetryProcessorFactory(sp)); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/ApplicationInsights/SnapshotCollectorTelemetryProcessorFactory.cs ================================================ using System; using Microsoft.ApplicationInsights.AspNetCore; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.SnapshotCollector; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; namespace VirtoCommerce.Storefront.Infrastructure.ApplicationInsights { /// /// https://docs.microsoft.com/en-us/azure/application-insights/app-insights-snapshot-debugger /// public class SnapshotCollectorTelemetryProcessorFactory : ITelemetryProcessorFactory { private readonly IServiceProvider _serviceProvider; public SnapshotCollectorTelemetryProcessorFactory(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } public ITelemetryProcessor Create(ITelemetryProcessor nextProcessor) { var snapshotConfigurationOptions = _serviceProvider.GetService>(); return new SnapshotCollectorTelemetryProcessor(nextProcessor, configuration: snapshotConfigurationOptions.Value); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/ApplicationInsights/UserTelemetryInitializer.cs ================================================ using Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers; using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.DataContracts; using Microsoft.AspNetCore.Http; namespace VirtoCommerce.Storefront.Infrastructure { /// /// A telemetry initializer that will gather user identity context information. /// public class UserTelemetryInitializer : TelemetryInitializerBase { public UserTelemetryInitializer(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) { } // /// Initializes user id and name for Azure Web App case. /// /// Platform context. /// Request telemetry. /// Telemetry item. protected override void OnInitializeTelemetry(HttpContext platformContext, RequestTelemetry requestTelemetry, ITelemetry telemetry) { if (platformContext.User != null) { telemetry.Context.User.AuthenticatedUserId = platformContext.User.Identity.Name; } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/ApiKeySecretAuthHandler.cs ================================================ using System.Net.Http; using System.Net.Http.Headers; using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { /// /// HTTP message delegating handler that encapsulates access token handling and renewment /// Implements key-secret authorization to the Platform API /// public class ApiKeySecretAuthHandler : BaseAuthHandler { private readonly PlatformEndpointOptions _options; public ApiKeySecretAuthHandler(IOptions options, IWorkContextAccessor workContextAccessor, IHttpContextAccessor httpContextAccessor) : base(workContextAccessor, httpContextAccessor) { _options = options.Value; } protected override Task AddAuthenticationAsync(HttpRequestMessage request) { if (_options != null) { var signature = new ApiRequestSignature { AppId = _options.AppId }; var parameters = new[] { new NameValuePair(null, _options.AppId), new NameValuePair(null, signature.TimestampString) }; signature.Hash = HmacUtility.GetHashString(key => new HMACSHA256(key), _options.SecretKey, parameters); request.Headers.Authorization = new AuthenticationHeaderValue("HMACSHA256", signature.ToString()); } return Task.CompletedTask; } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/AuthenticationHandlerFactory.cs ================================================ using System; using System.Net.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { public class AuthenticationHandlerFactory { private readonly IServiceProvider _serviceProvider; private readonly IOptions _platformEndpointOptions; public AuthenticationHandlerFactory(IServiceProvider serviceProvider, IOptions platformEndpointOptions) { _serviceProvider = serviceProvider; _platformEndpointOptions = platformEndpointOptions; } public DelegatingHandler CreateAuthHandler() { DelegatingHandler result = null; var options = _platformEndpointOptions.Value; if (!string.IsNullOrEmpty(options.ClientId) && !string.IsNullOrEmpty(options.ClientSecret)) { result = _serviceProvider.GetService(); } else if (!string.IsNullOrEmpty(options.UserName) && !string.IsNullOrEmpty(options.Password)) { result = _serviceProvider.GetService(); } else if (!string.IsNullOrEmpty(options.AppId) && !string.IsNullOrEmpty(options.SecretKey)) { result = _serviceProvider.GetService(); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/BaseAuthHandler.cs ================================================ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { /// /// Basic implementation of authorization handlers to the Platform API /// public abstract class BaseAuthHandler : DelegatingHandler { private readonly IWorkContextAccessor _workContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor; protected BaseAuthHandler(IWorkContextAccessor workContextAccessor, IHttpContextAccessor httpContextAccessor) { _workContextAccessor = workContextAccessor; _httpContextAccessor = httpContextAccessor; } /// /// Add platform-specific headers and authentification, then call basic SendAsync /// /// /// /// protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { AddCurrentUser(request); AddUserIp(request); await AddAuthenticationAsync(request); return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); } /// /// Add end-user name to the reqiest header /// /// protected void AddCurrentUser(HttpRequestMessage request) { var worContex = _workContextAccessor.WorkContext; if (worContex != null) { var currentUser = worContex.CurrentUser; //Add special header with user name to each API request for future audit and logging if (currentUser != null && currentUser.IsRegisteredUser) { var userName = currentUser.UserName; if (!string.IsNullOrEmpty(userName)) { request.Headers.Add("VirtoCommerce-User-Name", userName); } var operatorUserName = currentUser.OperatorUserName; if (!string.IsNullOrEmpty(operatorUserName)) { request.Headers.Add("VirtoCommerce-Operator-User-Name", operatorUserName); } } else { // Skip Passing of VirtoCommerce-User-Name if Token Authorization is usdde if (!request.Headers.Contains("Authorization")) { request.Headers.Add("VirtoCommerce-User-Name", "Anonymous"); request.Headers.Add("VirtoCommerce-Anonymous-User-Id", currentUser?.Id); } } } } /// /// Add end-user IP to the reqiest header /// /// protected void AddUserIp(HttpRequestMessage request) { var userIp = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress.ToString(); if (!string.IsNullOrEmpty(userIp)) { request.Headers.Add("True-Client-IP", userIp); } } /// /// Add authentication details to the request. /// This method should be implemented depending on authorization way /// /// protected abstract Task AddAuthenticationAsync(HttpRequestMessage request); } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/ClientCredentialsAuthHandler.cs ================================================ using System; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; using IdentityModel.Client; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { /// /// HTTP message delegating handler that encapsulates access token handling and renewment /// Implements id-secret authorization to the Platform API /// public class ClientCredentialsAuthHandler : BaseAuthHandler { private readonly PlatformEndpointOptions _options; private readonly IHttpClientFactory _clientFactory; private readonly IStorefrontMemoryCache _memoryCache; /// /// Initializes a new instance of the class. /// /// /// public ClientCredentialsAuthHandler( IStorefrontMemoryCache memoryCache , IOptions options , IHttpClientFactory clientFactory , IWorkContextAccessor workContextAccessor , IHttpContextAccessor httpContextAccessor) : base(workContextAccessor, httpContextAccessor) { _options = options.Value; _clientFactory = clientFactory; _memoryCache = memoryCache; } /// /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation. /// /// The HTTP request message to send to the server. /// A cancellation token to cancel operation. /// /// Returns . The task object representing the asynchronous operation. /// protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var response = await base.SendAsync(request, cancellationToken); if (response.StatusCode != HttpStatusCode.Unauthorized) { return response; } return await base.SendAsync(request, cancellationToken); } protected override async Task AddAuthenticationAsync(HttpRequestMessage request) { request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await GetOrRenewTokenAsync()); } private async Task GetOrRenewTokenAsync() { var cacheKey = CacheKey.With(GetType(), "token"); var token = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var request = new ClientCredentialsTokenRequest() { Address = $"{_options.Url?.ToString().TrimEnd('/')}/connect/token", ClientId = _options.ClientId, ClientSecret = _options.ClientSecret }; var client = _clientFactory.CreateClient(); var response = await client.RequestClientCredentialsTokenAsync(request); if (!response.IsError) { cacheEntry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(response.ExpiresIn); return response.AccessToken; } return null; }, cacheNullValue: false); return token; } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/EmptyServiceClientCredentials.cs ================================================ using Microsoft.Rest; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { public class EmptyServiceClientCredentials : ServiceClientCredentials { public EmptyServiceClientCredentials() { } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Autorest/UserPasswordAuthHandler.cs ================================================ using System; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; using IdentityModel.Client; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Infrastructure.Autorest { /// /// HTTP message delegating handler that encapsulates access token handling and renewment /// Implements user-password authorization to the Platform API /// public class UserPasswordAuthHandler : BaseAuthHandler { private readonly PlatformEndpointOptions _options; private readonly IHttpClientFactory _clientFactory; private readonly IStorefrontMemoryCache _memoryCache; /// /// Gets or sets the timeout /// public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(5); /// /// Initializes a new instance of the class. /// /// /// public UserPasswordAuthHandler( IStorefrontMemoryCache memoryCache , IOptions options , IHttpClientFactory clientFactory , IWorkContextAccessor workContextAccessor , IHttpContextAccessor httpContextAccessor) : base(workContextAccessor, httpContextAccessor) { _options = options.Value; _clientFactory = clientFactory; _memoryCache = memoryCache; } /// /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation. /// /// The HTTP request message to send to the server. /// A cancellation token to cancel operation. /// /// Returns . The task object representing the asynchronous operation. /// protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var response = await base.SendAsync(request, cancellationToken); if (response.StatusCode != HttpStatusCode.Unauthorized) { return response; } return await base.SendAsync(request, cancellationToken); } protected override async Task AddAuthenticationAsync(HttpRequestMessage request) { if (!request.Headers.Contains("Authorization") && !request.RequestUri.AbsoluteUri.EndsWith("/token")) { request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await GetOrRenewTokenAsync()); } } private async Task GetOrRenewTokenAsync() { var cacheKey = CacheKey.With(GetType(), "token"); var token = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { var client = _clientFactory.CreateClient(); var response = await client.RequestPasswordTokenAsync(new PasswordTokenRequest { Address = $"{_options.Url?.ToString().TrimEnd('/')}/connect/token", UserName = _options.UserName, Password = _options.Password }); if (!response.IsError) { cacheEntry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(response.ExpiresIn); return response.AccessToken; } return null; }, cacheNullValue: false); return token; } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/BlobChangeToken.cs ================================================ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Primitives; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Infrastructure { /// /// Based on PollingFileChangeToken /// public class BlobChangeToken : IChangeToken { private static ConcurrentDictionary _previousChangeTimeUtcTokenLookup = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); public string BlobName { get; set; } private bool _hasChanged; private readonly CloudBlobContainer _container; private readonly AzureBlobContentOptions _options; private DateTime _lastModifiedUtc; private DateTime _prevModifiedUtc; private static DateTime _lastCheckedTimeUtcStatic; private static readonly object _lock = new object(); public BlobChangeToken(string blobName, CloudBlobContainer container, AzureBlobContentOptions options) { BlobName = blobName; _container = container; _options = options; _lastModifiedUtc = _prevModifiedUtc = DateTime.UtcNow; } private static void UpdateLastCheckedTimeUtcStatic(DateTime currentTime) { _lastCheckedTimeUtcStatic = currentTime; } public bool HasChanged { get { //get last modified dt _lastModifiedUtc = GetLastModifiedUtc(); var hasChanged = _lastModifiedUtc > _prevModifiedUtc; if (hasChanged) { _prevModifiedUtc = _lastModifiedUtc; _hasChanged = true; } //check polling interval var currentTime = DateTime.UtcNow; if (currentTime - _lastCheckedTimeUtcStatic < _options.ChangesPollingInterval) { return _hasChanged; } lock (_lock) { currentTime = DateTime.UtcNow; if (currentTime - _lastCheckedTimeUtcStatic < _options.ChangesPollingInterval) { return _hasChanged; } UpdateLastCheckedTimeUtcStatic(currentTime); Task.Run(() => { EvaluateBlobsModifiedDate(); }); } return _hasChanged; } } private DateTime GetLastModifiedUtc() { if (IsRegularFileName(BlobName)) { return _previousChangeTimeUtcTokenLookup.GetOrAdd(BlobName, _lastModifiedUtc); } else { var list = _previousChangeTimeUtcTokenLookup.Where(x => WildcardMatch(BlobName, x.Key)).Select(x => x.Value.Ticks); var result = list.Any() ? new DateTime(list.Max()) : _lastModifiedUtc; return result; } } private static bool WildcardMatch(string wildcard, string filename) { // it's a simplest realization for case when wildcard ends with **/* var path = wildcard.Split('*')[0]; return filename.StartsWith(path, StringComparison.InvariantCultureIgnoreCase); } private bool IsRegularFileName(string pattern) { return !new[] { '?', '*' }.Any(pattern.Contains); } private void EvaluateBlobsModifiedDate(CancellationToken cancellationToken = default(CancellationToken)) { var files = ListBlobs().GetAwaiter().GetResult(); foreach (var file in files) { if (cancellationToken.IsCancellationRequested) { break; } var lastModifiedUtc = file.Properties.LastModified?.UtcDateTime ?? DateTime.UtcNow; if (!_previousChangeTimeUtcTokenLookup.TryGetValue(file.Name, out var dt)) { _previousChangeTimeUtcTokenLookup.GetOrAdd(file.Name, lastModifiedUtc); } else { _previousChangeTimeUtcTokenLookup[file.Name] = lastModifiedUtc; } } } private async Task> ListBlobs() { var blobItems = new List(); BlobContinuationToken token = null; var operationContext = new OperationContext(); do { var resultSegment = await _container.ListBlobsSegmentedAsync(null, true, BlobListingDetails.Metadata, null, token, _options.BlobRequestOptions, operationContext); token = resultSegment.ContinuationToken; blobItems.AddRange(resultSegment.Results); } while (token != null); var result = blobItems.OfType().ToList(); return result; } /// /// Don't know what to do with this one, so false /// public bool ActiveChangeCallbacks => false; /// /// Don't know what to do with this either /// public IDisposable RegisterChangeCallback(Action callback, object state) => EmptyDisposable.Instance; } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/BlobChangesWatcher.cs ================================================ using System.Threading; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using VirtoCommerce.Storefront.Domain; namespace VirtoCommerce.Storefront.Infrastructure { public class BlobChangesWatcher : IBlobChangesWatcher { private readonly AzureBlobContentOptions _options; private readonly CloudBlobContainer _container; public BlobChangesWatcher(IOptions options) { _options = options.Value; if (CloudStorageAccount.TryParse(_options.ConnectionString, out CloudStorageAccount cloudStorageAccount)) { var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); _container = cloudBlobClient.GetContainerReference(_options.Container); } } public IChangeToken CreateBlobChangeToken(string path) { if (!_options.PollForChanges || _container == null) { return new CancellationChangeToken(new CancellationToken()); } return new BlobChangeToken(path, _container, _options); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Exceptions/NoStoresException.cs ================================================ using System; using System.Runtime.Serialization; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.Storefront.Infrastructure.Exceptions { [Serializable] public class NoStoresException : StorefrontException { [Obsolete(DiagnosticId = "SYSLIB0051")] protected NoStoresException(SerializationInfo info, StreamingContext context) : base(info, context) { } public NoStoresException() : base("No stores defined", "NoStore") { } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Exceptions/NoThemeException.cs ================================================ using System; using System.Runtime.Serialization; using VirtoCommerce.Storefront.Model.Common.Exceptions; namespace VirtoCommerce.Storefront.Infrastructure { [Serializable] public class NoThemeException : StorefrontException { [Obsolete(DiagnosticId = "SYSLIB0051")] protected NoThemeException(SerializationInfo info, StreamingContext context) : base(info, context) { } public NoThemeException() : base("No theme defined", "NoTheme") { } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/HealthCheck/PlatformConnectionHealthChecker.cs ================================================ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Diagnostics.HealthChecks; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Infrastructure.HealthCheck { public class PlatformConnectionHealthChecker : IHealthCheck { private readonly IStoreService _storeService; public PlatformConnectionHealthChecker(IStoreService storeService) { _storeService = storeService; } public async Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { try { await _storeService.GetAllStoresAsync(); return HealthCheckResult.Healthy("Connection to the Platform is OK"); } catch { return HealthCheckResult.Unhealthy("Connection to the Platform fails"); } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/HmacUtility.cs ================================================ using System; using System.Globalization; using System.Linq; using System.Security.Cryptography; using System.Text; namespace VirtoCommerce.Storefront.Infrastructure { public static class HmacUtility { public const string NameValueSeparator = "="; public const string ParameterSeparator = "&"; public static string ComputeHash(Func hmacFactory, string secretKey, string data) { var dataBytes = Encoding.UTF8.GetBytes(data); var keyBytes = ConvertHexStringToBytes(secretKey); return ComputeHash(hmacFactory, keyBytes, dataBytes); } public static string ComputeHash(Func hmacFactory, byte[] secretKey, byte[] data) { if (data == null) { throw new ArgumentNullException("data"); } using (var hmac = hmacFactory(secretKey)) { var hash = hmac.ComputeHash(data, 0, data.Length); return ConvertBytesToHexString(hash); } } public static string GetHashString(Func hmacFactory, string secretKey, NameValuePair[] parameters) { var data = BuildDataString(parameters); return ComputeHash(hmacFactory, secretKey, data); } private static string BuildDataString(NameValuePair[] parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } var builder = new StringBuilder(); var orderedParameters = parameters.Where(p => string.IsNullOrEmpty(p.Name) && !string.IsNullOrEmpty(p.Value)) .Union( parameters.Where(p => !string.IsNullOrEmpty(p.Name) && !string.IsNullOrEmpty(p.Value)) .OrderBy(i => i.Name)) .ToList(); foreach (var parameter in orderedParameters) { if (builder.Length > 0) { builder.Append(ParameterSeparator); } if (!string.IsNullOrEmpty(parameter.Name)) { builder.Append(parameter.Name); builder.Append(NameValueSeparator); } builder.Append(parameter.Value); } var data = builder.ToString(); return data; } private static string ConvertBytesToHexString(byte[] bytes) { var builder = new StringBuilder(); foreach (var b in bytes) { builder.Append(b.ToString("x2", CultureInfo.InvariantCulture)); } return builder.ToString(); } private static byte[] ConvertHexStringToBytes(string hexString) { return Enumerable.Range(0, hexString.Length) .Where(i => i % 2 == 0) .Select(i => Convert.ToByte(hexString.Substring(i, 2), 16)) .ToArray(); } } public class NameValuePair { public string Name { get; private set; } public string Value { get; private set; } public NameValuePair(string name, string value) { Name = name; Value = value; } public override string ToString() { var builder = new StringBuilder(); builder.Append("["); builder.Append(Name); builder.Append(", "); builder.Append(Value); builder.Append("]"); return builder.ToString(); } } public class ApiRequestSignature { public string AppId { get; set; } public string Hash { get; set; } public DateTime Timestamp { get; private set; } public string TimestampString { get; private set; } public ApiRequestSignature() { Timestamp = DateTime.UtcNow; TimestampString = Timestamp.ToString("o", CultureInfo.InvariantCulture); } public static bool TryParse(string input, out ApiRequestSignature parsedValue) { parsedValue = null; if (input == null) { return false; } var parts = input.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length != 3 || parts[2].Length != 64 || !DateTime.TryParseExact( parts[1], "o", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out var timestamp)) { return false; } parsedValue = new ApiRequestSignature { AppId = parts[0], TimestampString = parts[1], Hash = parts[2], Timestamp = timestamp, }; return true; } public override string ToString() { return string.Join(";", AppId, TimestampString, Hash); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/IApiChangesWatcher.cs ================================================ using Microsoft.Extensions.Primitives; namespace VirtoCommerce.Storefront.Infrastructure { public interface IApiChangesWatcher { IChangeToken CreateChangeToken(); } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/IBlobChangesWatcher.cs ================================================ using Microsoft.Extensions.Primitives; namespace VirtoCommerce.Storefront.Infrastructure { public interface IBlobChangesWatcher { IChangeToken CreateBlobChangeToken(string path); } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/PlatformEndpointOptions.cs ================================================ using System; namespace VirtoCommerce.Storefront.Infrastructure { public class PlatformEndpointOptions { public ApiAuthMode AuthMode { get; set; } = ApiAuthMode.BarrierToken; public Uri Url { get; set; } /// /// Credentials used for ApiAuthMode.BarrierToken mode /// public string AppId { get; set; } public string SecretKey { get; set; } /// /// Client credentials used for client credential flow /// public string ClientId { get; set; } public string ClientSecret { get; set; } /// /// Credentials used for ApiAuthMode.OAuthPassword mode /// public string UserName { get; set; } public string Password { get; set; } public TimeSpan RequestTimeout { get; set; } = TimeSpan.FromSeconds(30); } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/PollingApiChangeToken.cs ================================================ using System; using System.Threading; using Microsoft.Extensions.Primitives; using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Infrastructure { public class PollingApiChangeToken : IChangeToken { private readonly IChangeLog _cacheApi; private static DateTime _previousChangeTimeUtcStatic; private static DateTime _lastCheckedTimeUtcStatic; private readonly DateTime _previousChangeTimeUtc; private readonly TimeSpan _pollingInterval; private static readonly object _lock = new object(); public PollingApiChangeToken(IChangeLog cacheApi, TimeSpan pollingInterval) { _pollingInterval = pollingInterval; _cacheApi = cacheApi; _previousChangeTimeUtc = _previousChangeTimeUtcStatic; } public static void UpdatePreviousChangeTimeUtcStatic(DateTime currentTime) { _previousChangeTimeUtcStatic = currentTime; } public static void UpdateLastCheckedTimeUtcStatic(DateTime currentTime) { _lastCheckedTimeUtcStatic = currentTime; } private DateTime GetLastChangeTimeUtc() { return _cacheApi.GetLastModifiedDate().LastModifiedDate ?? default(DateTime); } /// /// Always false. /// public bool ActiveChangeCallbacks => false; public bool HasChanged { get { var hasChanged = _previousChangeTimeUtc < _previousChangeTimeUtcStatic; var currentTime = DateTime.UtcNow; if (currentTime - _lastCheckedTimeUtcStatic < _pollingInterval) { return hasChanged; } //Need to prevent API flood for multiple token instances var lockTaken = Monitor.TryEnter(_lock); try { if (lockTaken) { var lastChangeTimeUtc = GetLastChangeTimeUtc(); if (_previousChangeTimeUtcStatic < lastChangeTimeUtc) { UpdatePreviousChangeTimeUtcStatic(lastChangeTimeUtc); hasChanged = true; } UpdateLastCheckedTimeUtcStatic(currentTime); } } finally { if (lockTaken) { Monitor.Exit(_lock); } } return hasChanged; } } /// /// Does not actually register callbacks. /// /// This parameter is ignored /// This parameter is ignored /// A disposable object that noops when disposed public IDisposable RegisterChangeCallback(Action callback, object state) => EmptyDisposable.Instance; } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/RequireHttpsOptions.cs ================================================ namespace VirtoCommerce.Storefront.Infrastructure { public class RequireHttpsOptions { public bool Enabled { get; set; } = false; public int StatusCode { get; set; } = 308; public string ReasonPhrase { get; set; } = "Permanent Redirect"; public int Port { get; set; } = 443; } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/StorefrontOptions.cs ================================================ using System; using System.Collections.Generic; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Infrastructure { public class StorefrontOptions { public string DefaultStore { get; set; } public string DefaultTheme { get; set; } public TimeSpan ChangesPollingInterval { get; set; } = TimeSpan.FromMinutes(1); public PlatformEndpointOptions Endpoint { get; set; } public LiquidThemeEngineOptions LiquidThemeEngine { get; set; } public RequireHttpsOptions RequireHttps { get; set; } public bool SendAccountConfirmation { get; set; } = false; public int WishlistLimit { get; set; } //The options contains mapping of urls with concrete stores public IDictionary StoreUrls { get; set; } = new Dictionary().WithDefaultValue(null); public bool CacheEnabled { get; set; } public TimeSpan? CacheAbsoluteExpiration { get; set; } public TimeSpan? CacheSlidingExpiration { get; set; } public int PageSizeMaxValue { get; set; } = 100; public string ResetPasswordNotificationGateway { get; set; } = "Email"; public string TwoFactorAuthenticationNotificationGateway { get; set; } = "Phone"; } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/StorefrontUrlBuilder.cs ================================================ using System; using System.Linq; using System.Web; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Extensions; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Stores; using VirtoCommerce.Tools; namespace VirtoCommerce.Storefront.Infrastructure { /// /// Create storefront url contains language and store information /// public class StorefrontUrlBuilder : IStorefrontUrlBuilder { private readonly IUrlBuilder _urlBuilder; private readonly IWorkContextAccessor _workContextAccessor; private readonly IWebHostEnvironment _hostEnv; private readonly IHttpContextAccessor _httpContextAccessor; private static readonly string[] UrlContainingQueryParameters = { "ReturnUrl", }; public StorefrontUrlBuilder(IUrlBuilder urlBuilder, IWorkContextAccessor workContextAccessor, IWebHostEnvironment hostEnv, IHttpContextAccessor httpContextAccessor) { _urlBuilder = urlBuilder; _workContextAccessor = workContextAccessor; _hostEnv = hostEnv; _httpContextAccessor = httpContextAccessor; } #region IStorefrontUrlBuilder members public string ToAppAbsolute(string virtualPath) { var workContext = _workContextAccessor.WorkContext; return ToAppAbsolute(virtualPath, workContext.CurrentStore, workContext.CurrentLanguage); } public string ToAppAbsolute(string virtualPath, Store store, Language language) { var appRelativePath = ToAppRelative(virtualPath, store, language); var result = appRelativePath != null && appRelativePath.StartsWith("~") ? _httpContextAccessor.HttpContext.Request.PathBase + appRelativePath.Replace("~", string.Empty) : appRelativePath; return result; } public string ToStoreAbsolute(string virtualPath, Store store = null, Language language = null) { // Need to build from an host absolute url a relative store-based url // http://localhost/Account/Login -> http://localhost/{store}/{lang}/Account/Login // Need to be able to properly handle the following case: // http://localhost/store/Account/Login?ReturnUrl=%2Fstore%2FElectronics%2Fen-US%2Faccount, storeUrl = "http://localhost/store" // 1. Should trim store path "/store" from the url path "/store/Account/Login" => path should become "/Account/Login" // 2. Check for url params (e.g. ReturnUrl) in query string and trim store url for them too. ReturnUrl=%2Fstore%2FElectronics%2Fen-US%2Faccount => ReturnUrl=%2FElectronics%2Fen-US%2Faccount var uri = new Uri(virtualPath, UriKind.RelativeOrAbsolute); var absolutePathOrUrl = ConvertPathToStoreAbsolutePathOrUrl(uri.IsAbsoluteUri ? uri.AbsolutePath : virtualPath, store, language); var storeRelativeOrAbsoluteUrl = new Uri(absolutePathOrUrl, UriKind.RelativeOrAbsolute); var urlBuilder = new UriBuilder(new Uri(uri, storeRelativeOrAbsoluteUrl)) { Query = ConvertQueryUrlsToStoreAbsolutePaths(uri.Query, store, language) }; return urlBuilder.Uri.ToString(); } private string ConvertPathToStoreAbsolutePathOrUrl(PathString path, Store store = null, Language language = null) { var relativeToAppPath = path.TrimStorePath(_workContextAccessor.WorkContext.CurrentStore); var storeUrl = store != null || language != null ? ToAppAbsolute(relativeToAppPath.TrimStoreAndLangSegment(_workContextAccessor.WorkContext.CurrentStore, _workContextAccessor.WorkContext.CurrentLanguage), store ?? _workContextAccessor.WorkContext.CurrentStore, language ?? store.DefaultLanguage ?? _workContextAccessor.WorkContext.CurrentLanguage) : ToAppAbsolute(relativeToAppPath); return storeUrl; } /// /// Trims store path for known url containing params. Encoding/Decoding is handled by HttpUtility.ParseQueryString. /// /// Query params need to be converted. private string ConvertQueryUrlsToStoreAbsolutePaths(string query, Store store = null, Language language = null) { var queryParams = HttpUtility.ParseQueryString(query); var allParamKeys = queryParams.AllKeys; foreach (var paramName in UrlContainingQueryParameters) { var paramKey = allParamKeys.FirstOrDefault(x => x.EqualsInvariant(paramName)); var paramValue = paramKey != null ? queryParams[paramKey] : null; // Need to check that param value is a valid relative url to avoid exception at PathString creation if (paramKey != null && Uri.TryCreate(paramValue, UriKind.Relative, out _)) { queryParams[paramKey] = ConvertPathToStoreAbsolutePathOrUrl(new PathString(paramValue), store, language).ToAbsolutePath(); } } return queryParams.ToString(); } public string ToAppRelative(string virtualPath) { var workContext = _workContextAccessor.WorkContext; return ToAppRelative(virtualPath, workContext.CurrentStore, workContext.CurrentLanguage); } public string ToAppRelative(string virtualPath, Store store, Language language) { var workContext = _workContextAccessor.WorkContext; var urlBuilderContext = workContext.ToToolsContext(); return _urlBuilder.BuildStoreUrl(urlBuilderContext, virtualPath, store.ToToolsStore(), null); } public string ToLocalPath(string virtualPath) { return _hostEnv.MapPath(virtualPath); } #endregion } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/ApiExplorerApiControllersConvention.cs ================================================ using System; using Microsoft.AspNetCore.Mvc.ApplicationModels; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { public class ApiExplorerApiControllersConvention : IControllerModelConvention { public void Apply(ControllerModel controller) { var controllerNamespace = controller.ControllerType.Namespace; // Include only those controllers, whose namespace ends with .Api controller.ApiExplorer.IsVisible = controllerNamespace.EndsWith(".Api", StringComparison.OrdinalIgnoreCase); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/ArrayInQueryParametersFilter.cs ================================================ using System.Linq; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// The workaround for openapi3/autorest query parameters serialization /// See more: https://github.com/Azure/autorest/issues/3373, https://swagger.io/specification/ /// public class ArrayInQueryParametersFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { foreach (var parameter in operation.Parameters.Where(x => (x.In == ParameterLocation.Query && x.Schema.Type == "array"))) { if (!parameter.Style.HasValue) { parameter.Style = ParameterStyle.Form; } } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/AuthResponsesOperationFilter.cs ================================================ using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { public class AuthResponsesOperationFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { var authAttributes = context.MethodInfo.DeclaringType.GetCustomAttributes(true) .Union(context.MethodInfo.GetCustomAttributes(true)) .OfType(); if (authAttributes.Any()) operation.Responses.Add("401", new OpenApiResponse { Description = "Unauthorized" }); } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/ConsumeFromBodyFilter.cs ================================================ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// This temporary filter removes broken "application/*+json" content-type. /// It seems it's some openapi/swagger bug, because Autorest fails. /// public class ConsumeFromBodyFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { if (operation.RequestBody != null && operation.RequestBody.Content.Count > 0 && operation.RequestBody.Content.ContainsKey("application/*+json")) { operation.RequestBody.Content.Remove("application/*+json"); } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/EnumSchemaFilter.cs ================================================ using System; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// Compatibility: publish enumeration values as strings instead of integers (default in openapi 3) /// public class EnumSchemaFilter : ISchemaFilter { public void Apply(OpenApiSchema schema, SchemaFilterContext context) { var type = context.Type; if (type.IsEnum) { schema.Format = null; schema.Type = "string"; schema.Enum.Clear(); foreach (var enumValueInString in Enum.GetNames(type)) { schema.Enum.Add(new OpenApiString(enumValueInString)); } } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/FileResponseTypeFilter.cs ================================================ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { public class FileResponseTypeFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { if (IsFileResponse(context)) { var key = ((int)HttpStatusCode.OK).ToString(); // Attention! // Accordingly to: https://swagger.io/docs/specification/describing-responses/#response-that-returns-a-file // the type of response should have Format = "binary", Type = "string". var responseSchema = new OpenApiSchema { Format = "binary", Type = "string" }; if (operation.Responses == null) { operation.Responses = new OpenApiResponses(); } if (!operation.Responses.TryGetValue(key, out var response)) { response = new OpenApiResponse(); } response.Description = "OK"; response.Content = new Dictionary { { "multipart/form-data", new OpenApiMediaType() { Schema = responseSchema } } }; } } private static bool IsFileResponse(OperationFilterContext context) { var fileResponseAttributes = context.MethodInfo.DeclaringType.GetCustomAttributes(true) .Union(context.MethodInfo.GetCustomAttributes(true)) .OfType(); var result = fileResponseAttributes.Any(); if (!result) { result = context.ApiDescription.SupportedResponseTypes.Any(r => r.Type == typeof(Stream)); } return result; } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/FileUploadOperationFilter.cs ================================================ using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { //[CLSCompliant(false)] public class FileUploadOperationFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { if (context.ApiDescription.TryGetMethodInfo(out var methodInfo)) { var requestAttributes = methodInfo.GetCustomAttributes().ToArray(); operation.Parameters ??= new List(); foreach (var attr in requestAttributes) { operation.Parameters.Add(new OpenApiParameter { Name = attr.Name, Description = attr.Description, In = ParameterLocation.Query, Required = attr.Required, Schema = new OpenApiSchema() { Type = attr.Type } }); } if (requestAttributes.Any(x => x.Type == "file")) { // https://swagger.io/docs/specification/describing-request-body/file-upload/ operation.RequestBody = new OpenApiRequestBody() { Content = { ["multipart/form-data"] = new OpenApiMediaType() { Schema = new OpenApiSchema() { Type = "object", Properties = { ["file"] = new OpenApiSchema() { Description = "Select file", Type = "string", Format = "binary" } } } } } }; } } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/NewtonsoftJsonIgnoreFilter.cs ================================================ using System.Linq; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// Allows to ignore . /// public class NewtonsoftJsonIgnoreFilter : ISchemaFilter { public void Apply(OpenApiSchema schema, SchemaFilterContext context) { var type = context.Type; foreach (var prop in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) .Where(p => p.GetCustomAttributes(typeof(Newtonsoft.Json.JsonIgnoreAttribute), true)?.Any() == true)) { var propName = prop.Name[0].ToString().ToLower() + prop.Name.Substring(1); if (schema?.Properties?.ContainsKey(propName) == true) schema?.Properties?.Remove(propName); } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/OptionalParametersFilter.cs ================================================ using System.Linq; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { public class OptionalParametersFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { if (operation.Parameters == null || !operation.Parameters.Any()) { return; } var optionalParameters = context.ApiDescription.ParameterDescriptions .Where(p => p.ParameterDescriptor != null && ((ControllerParameterDescriptor)p.ParameterDescriptor).ParameterInfo.CustomAttributes.Any(attr => attr.AttributeType == typeof(SwaggerOptionalAttribute))).ToList(); foreach (var apiParameter in optionalParameters) { var parameter = operation.Parameters.FirstOrDefault(p => p.Name == apiParameter.Name); if (parameter != null) { parameter.Required = false; } } } } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/SwaggerFileResponseAttribute.cs ================================================ using System; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// Mark with this attribute all API methods which returned stream response /// for correct generation swagger API document schema /// [AttributeUsage(AttributeTargets.Method, Inherited = false)] public class SwaggerFileResponseAttribute : Attribute { } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/SwaggerOptionalAttribute.cs ================================================ using System; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] public class SwaggerOptionalAttribute : Attribute { } } ================================================ FILE: VirtoCommerce.Storefront/Infrastructure/Swagger/UploadFileAttribute.cs ================================================ using System; namespace VirtoCommerce.Storefront.Infrastructure.Swagger { /// /// Use this attribute for controllers methods to allow file upload via Swagger /// [AttributeUsage(AttributeTargets.Method)] public sealed class UploadFileAttribute : Attribute { /// /// The parameter name in the resulting swagger doc /// public string Name { get; set; } = "uploadedFile"; /// /// The parameter description in the resulting swagger doc /// public string Description { get; set; } = "Upload File"; /// /// Parameter type (only string value supported) /// Accordingly to: // https://swagger.io/docs/specification/describing-request-body/file-upload/ /// public string Type { get; set; } = "string"; /// /// Set true for required parameter /// public bool Required { get; set; } = false; } } ================================================ FILE: VirtoCommerce.Storefront/Middleware/NoLiquidThemeMiddleware.cs ================================================ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Models; namespace VirtoCommerce.Storefront.Middleware { public class NoLiquidThemeMiddleware { public const string NoThemeModelKey = "NoLiquidThemeMiddleware.NoThemeModel"; private readonly RequestDelegate _next; private readonly IWorkContextAccessor _workContextAccessor; private readonly ILiquidThemeEngine _liquidThemeEngine; public NoLiquidThemeMiddleware(RequestDelegate next, IWorkContextAccessor workContextAccessor, ILiquidThemeEngine liquidThemeEngine) { _next = next; _workContextAccessor = workContextAccessor; _liquidThemeEngine = liquidThemeEngine; } public async Task Invoke(HttpContext context) { var workContext = _workContextAccessor.WorkContext; if (workContext != null && string.IsNullOrEmpty(_liquidThemeEngine.ResolveTemplatePath("index"))) { context.Request.Path = "/common/notheme"; context.Items[NoThemeModelKey] = new NoThemeViewModel { SearchedLocations = _liquidThemeEngine.DiscoveryPaths.ToList() }; } await _next(context); } } } ================================================ FILE: VirtoCommerce.Storefront/Middleware/StoreMaintenanceMiddleware.cs ================================================ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Stores; namespace VirtoCommerce.Storefront.Middleware { public class StoreMaintenanceMiddleware { private readonly RequestDelegate _next; private readonly IWorkContextAccessor _workContextAccessor; public StoreMaintenanceMiddleware(RequestDelegate next, IWorkContextAccessor workContextAccessor) { _next = next; _workContextAccessor = workContextAccessor; } public async Task Invoke(HttpContext context) { var workContext = _workContextAccessor.WorkContext; if (workContext != null && workContext.CurrentStore != null && workContext.CurrentStore.StoreState == StoreStatus.Closed) { context.Request.Path = "/common/maintenance"; } await _next(context); } } } ================================================ FILE: VirtoCommerce.Storefront/Middleware/WorkContextBuildMiddleware.cs ================================================ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Domain.Security; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Middleware { public class WorkContextBuildMiddleware { private readonly RequestDelegate _next; private readonly IWebHostEnvironment _hostingEnvironment; private readonly StorefrontOptions _options; private readonly IWorkContextAccessor _workContextAccessor; private readonly Dictionary _applicationSettings = null; public WorkContextBuildMiddleware(RequestDelegate next, IWebHostEnvironment hostingEnvironment, IOptions options, IWorkContextAccessor workContextAccessor) { _next = next; _hostingEnvironment = hostingEnvironment; _workContextAccessor = workContextAccessor; _options = options.Value; } public async Task Invoke(HttpContext context) { //Do not process for exist exception var exceptionFeature = context.Features.Get(); if (exceptionFeature != null) { await _next(context); return; } var builder = new WorkContextBuilder(context, _options); var workContext = builder.WorkContext; workContext.IsDevelopment = _hostingEnvironment.IsDevelopment(); workContext.ApplicationSettings = _applicationSettings; //The important to preserve the order of initialization await builder.WithCountriesAsync(); await builder.WithStoresAsync(_options.DefaultStore); await builder.WithCurrentUserAsync(); await builder.WithCurrenciesAsync(workContext.CurrentLanguage, workContext.CurrentStore); await builder.WithMenuLinksAsync(workContext.CurrentStore, workContext.CurrentLanguage); await builder.WithPagesAsync(workContext.CurrentStore, workContext.CurrentLanguage); await builder.WithBlogsAsync(workContext.CurrentStore, workContext.CurrentLanguage); await builder.WithTemplatesAsync(workContext.CurrentStore); //EU General Data Protection Regulation (GDPR) support var consentFeature = context.Features.Get(); if (consentFeature != null) { workContext.CanTrack = !consentFeature?.CanTrack ?? false; workContext.ConsentCookie = consentFeature?.CreateConsentCookie(); } workContext.AvailableRoles = SecurityConstants.Roles.AllRoles; workContext.BusinessToBusinessRoles = SecurityConstants.Roles.B2BRoles; _workContextAccessor.WorkContext = workContext; if (workContext.IsPreviewMode) { context.Response.Headers.Append("non-cached-result", "true"); } await _next(context); } } } ================================================ FILE: VirtoCommerce.Storefront/Models/NoThemeViewModel.cs ================================================ using System.Collections.Generic; namespace VirtoCommerce.Storefront.Models { public class NoThemeViewModel { public NoThemeViewModel() { SearchedLocations = new List(); } public IEnumerable SearchedLocations { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/Models/ResetCacheModel.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VirtoCommerce.Storefront.Models { /// /// Cache Event Model For Web Hook from Virto Commmerce Platform /// public class ResetCacheEventModel { public string EventId { get; set; } public ResetCacheEventBodyModel[] EventBody { get; set; } } public class ResetCacheEventBodyModel { public string ObjectType { get; set; } public string Id { get; set; } public string Path { get; set; } public string Type { get; set; } } } ================================================ FILE: VirtoCommerce.Storefront/Program.cs ================================================ using System.IO; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace VirtoCommerce.Storefront { public static class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IHostBuilder CreateWebHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseContentRoot(Directory.GetCurrentDirectory()) .ConfigureLogging((hostingContext, logging) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddConsole(); logging.AddDebug(); //Enable Azure logging //https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1#logging-in-azure logging.AddAzureWebAppDiagnostics(); }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); webBuilder.UseIISIntegration(); }); } } ================================================ FILE: VirtoCommerce.Storefront/Properties/launchSettings.json ================================================ { "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "VirtoCommerce.Storefront": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_preventHostingStartup": "True", "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:4302/" } }, "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:2082/", "sslPort": 0 } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/ISlugRouteService.cs ================================================ using System.Threading.Tasks; using VirtoCommerce.Storefront.Model; namespace VirtoCommerce.Storefront.Routing { public interface ISlugRouteService { Task HandleSlugRequestAsync(string slugPath, WorkContext workContext); } } ================================================ FILE: VirtoCommerce.Storefront/Routing/MapStorefrontRouteBuilderExtension.cs ================================================ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; namespace VirtoCommerce.Storefront.Routing { /// /// Provides extension methods for to add routes. /// public static class MapStorefrontRouteBuilderExtension { public static IRouteBuilder MapStorefrontRoute( this IRouteBuilder routeBuilder, string name, string template) { return MapStorefrontRoute(routeBuilder, name, template, defaults: null); } public static IRouteBuilder MapStorefrontRoute( this IRouteBuilder routeBuilder, string name, string template, object defaults) { return MapStorefrontRoute(routeBuilder, name, template, defaults, constraints: null); } public static IRouteBuilder MapStorefrontRoute( this IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints) { return MapStorefrontRoute(routeBuilder, name, template, defaults, constraints, dataTokens: null); } public static IRouteBuilder MapStorefrontRoute( this IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints, object dataTokens) { if (routeBuilder.DefaultHandler == null) { throw new RouteCreationException($"Must be set { nameof(IRouteBuilder) }"); } var inlineConstraintResolver = routeBuilder .ServiceProvider .GetRequiredService(); routeBuilder.Routes.Add(new StorefrontRoute( routeBuilder.DefaultHandler, name, template, new RouteValueDictionary(defaults), new RouteValueDictionary(constraints), new RouteValueDictionary(dataTokens), inlineConstraintResolver)); return routeBuilder; } public static IRouteBuilder MapSlugRoute( this IRouteBuilder routeBuilder, string template, object defaults) { if (routeBuilder.DefaultHandler == null) { throw new RouteCreationException($"Must be set { nameof(IRouteBuilder) }"); } var inlineConstraintResolver = routeBuilder .ServiceProvider .GetRequiredService(); routeBuilder.Routes.Add(new SlugRoute( routeBuilder.DefaultHandler, template, new RouteValueDictionary(defaults), inlineConstraintResolver)); return routeBuilder; } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/RoutingCacheRegion.cs ================================================ using VirtoCommerce.Storefront.Model.Common.Caching; namespace VirtoCommerce.Storefront.Routing { public class RoutingCacheRegion : CancellableCacheRegion { } } ================================================ FILE: VirtoCommerce.Storefront/Routing/SlugRoute.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using VirtoCommerce.Storefront.Extensions; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; namespace VirtoCommerce.Storefront.Routing { /// /// Reads the slug from request path and tried to find object and controller best matched to it /// public class SlugRoute : Route { public SlugRoute(IRouter target, string template, RouteValueDictionary defaults, IInlineConstraintResolver inlineConstraintResolver) : base(target, template, defaults, null, null, inlineConstraintResolver) { } protected override async Task OnRouteMatched(RouteContext context) { var serviceProvider = context.HttpContext.RequestServices; var seoRouteService = serviceProvider.GetRequiredService(); var storefrontUrlBuilder = serviceProvider.GetRequiredService(); var workContext = serviceProvider.GetRequiredService().WorkContext; var path = context.HttpContext.Request.Path.TrimStoreAndLangSegment(workContext.CurrentStore, workContext.CurrentLanguage).ToString().TrimStart('/'); if (!string.IsNullOrEmpty(path)) { var seoRouteResponse = await seoRouteService.HandleSlugRequestAsync(path, workContext); if (seoRouteResponse != null) { if (seoRouteResponse.Redirect) { //Redirect via call specific controller method (because usage of Response.Redirect leads to the rendering the main page) context.RouteData.Values["action"] = "InternalRedirect"; context.RouteData.Values["controller"] = "Common"; context.RouteData.Values["url"] = storefrontUrlBuilder.ToAppAbsolute(seoRouteResponse.RedirectLocation); } else if (seoRouteResponse.RouteData != null) { foreach (var kvp in seoRouteResponse.RouteData) { context.RouteData.Values[kvp.Key] = kvp.Value; } } var actionDescriptor = FindMatchingActionDescriptor(context.RouteData.Values, serviceProvider); if (actionDescriptor != null) { context.Handler = httpContext => { var actionContext = new ActionContext(httpContext, context.RouteData, actionDescriptor); var actionInvokerFactory = serviceProvider.GetRequiredService(); var invoker = actionInvokerFactory.CreateInvoker(actionContext); return invoker.InvokeAsync(); }; return; } } } await base.OnRouteMatched(context); } private ActionDescriptor FindMatchingActionDescriptor(IReadOnlyDictionary routeDataValues, IServiceProvider serviceProvider) { if (!routeDataValues.TryGetValue("controller", out var controllerNameObject)) { return null; } if (!routeDataValues.TryGetValue("action", out var actionNameObject)) { return null; } var controllerName = (string)controllerNameObject; var actionName = (string)actionNameObject; var actionDescriptorCollectionProvider = serviceProvider.GetRequiredService(); var actions = actionDescriptorCollectionProvider.ActionDescriptors; var controllerActions = actions.Items.OfType(); var matchingAction = controllerActions.FirstOrDefault(action => action.ControllerName == controllerName && action.ActionName == actionName); return matchingAction; } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/SlugRouteResponse.cs ================================================ using System; using System.Collections.Generic; namespace VirtoCommerce.Storefront.Routing { public class SlugRouteResponse { public SlugRouteResponse() { RouteData = new Dictionary(StringComparer.OrdinalIgnoreCase); } public bool Redirect { get; set; } public string RedirectLocation { get; set; } public IDictionary RouteData { get; private set; } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/SlugRouteService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using VirtoCommerce.Storefront.AutoRestClients.CatalogModuleApi; using VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi; using VirtoCommerce.Storefront.Common; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Caching; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Model.Stores; using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; namespace VirtoCommerce.Storefront.Routing { public class SlugRouteService : ISlugRouteService { private readonly IStorefrontMemoryCache _memoryCache; private readonly ICommerce _coreApi; private readonly IApiChangesWatcher _apiChangesWatcher; private readonly ICatalogModuleCategories _apiCategories; private readonly ICatalogModuleProducts _apiProducts; public SlugRouteService( IStorefrontMemoryCache memoryCache, ICommerce coreApi, IApiChangesWatcher apiChangesWatcher, ICatalogModuleCategories apiCategories, ICatalogModuleProducts apiProducts) { _memoryCache = memoryCache; _coreApi = coreApi; _apiChangesWatcher = apiChangesWatcher; _apiCategories = apiCategories; _apiProducts = apiProducts; } public virtual async Task HandleSlugRequestAsync(string slugPath, WorkContext workContext) { var entity = new SlugRoutingData { ObjectType = "Asset", SeoPath = slugPath }; //Do not use slug routing for SPA themes if (!workContext.CurrentStore.IsSpa) { entity = await FindEntityBySlugPath(slugPath, workContext) ?? entity; } var response = entity.SeoPath.EqualsInvariant(slugPath) ? View(entity) : Redirect(entity); return response; } protected virtual SlugRouteResponse View(SlugRoutingData routingData) { var response = new SlugRouteResponse(); switch (routingData.ObjectType) { case "Asset": response.RouteData["action"] = "GetThemeAssets"; response.RouteData["controller"] = "Asset"; response.RouteData["path"] = routingData.SeoPath; break; } return response; } protected virtual SlugRouteResponse Redirect(SlugRoutingData entity) { return new SlugRouteResponse { Redirect = true, RedirectLocation = entity.SeoPath, }; } protected virtual async Task FindEntityBySlugPath(string path, WorkContext workContext) { path = path.Trim('/'); var slugs = path.Split('/'); var lastSlug = slugs.LastOrDefault(); // Get all SEO records for requested slug and also all other SEO records with different slug and languages but related to the same object var allSeoRecords = await GetAllSeoRecordsAsync(lastSlug); var bestSeoRecords = GetBestMatchingSeoRecords(allSeoRecords, workContext.CurrentStore, workContext.CurrentLanguage, lastSlug); var routingComparer = AnonymousComparer.Create((SlugRoutingData x) => string.Join(":", x.ObjectType, x.ObjectId, x.SeoPath)); // Find distinct objects var entities = bestSeoRecords .Select(s => new SlugRoutingData { ObjectType = s.ObjectType, ObjectId = s.ObjectId, SeoPath = s.SemanticUrl }) .Distinct(routingComparer) .ToList(); // Don't load objects for non-SEO links if (workContext.CurrentStore.SeoLinksType != SeoLinksType.None) { foreach (var group in entities.GroupBy(e => e.ObjectType)) { await LoadObjectsAndBuildFullSeoPaths(group.Key, group.ToList(), workContext.CurrentStore, workContext.CurrentLanguage); } entities = entities.Where(e => !string.IsNullOrEmpty(e.SeoPath)).ToList(); } // If found multiple entities, keep those which have the requested SEO path if (entities.Count > 1) { entities = entities.Where(e => e.SeoPath.EqualsInvariant(path)).ToList(); } // If still found multiple entities, give up var result = entities.Count == 1 ? entities.FirstOrDefault() : null; if (result == null) { // Try to find a static page var page = FindPageBySeoPath(path, workContext); if (page != null) { result = new SlugRoutingData { ObjectType = "Page", SeoPath = page.Url, ObjectInstance = page, }; } } return result; } protected virtual ContentItem FindPageBySeoPath(string seoPath, WorkContext workContext) { ContentItem result = null; if (workContext.Pages != null) { var pages = workContext.Pages .Where(p => string.Equals(p.Url, seoPath, StringComparison.OrdinalIgnoreCase)) .ToList(); // Find page with current language result = pages.FirstOrDefault(x => x.Language == workContext.CurrentLanguage); if (result == null) { // Find page with invariant language result = pages.FirstOrDefault(x => x.Language.IsInvariant); } if (result == null) { // Check alternate page URLs result = workContext.Pages.FirstOrDefault(x => x.AliasesUrls.Contains(seoPath, StringComparer.OrdinalIgnoreCase)); } } return result; } protected virtual async Task> GetAllSeoRecordsAsync(string slug) { var result = new List(); if (!string.IsNullOrEmpty(slug)) { var cacheKey = CacheKey.With(GetType(), "GetAllSeoRecords", slug); var apiResult = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(RoutingCacheRegion.CreateChangeToken()); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); return await _coreApi.GetSeoInfoBySlugAsync(slug); }); result.AddRange(apiResult); } return result; } protected virtual IList GetBestMatchingSeoRecords(IEnumerable allSeoRecords, Store store, Language language, string slug) { return allSeoRecords.GetBestMatchingSeoInfos(store, language, slug); } protected virtual async Task LoadObjectsAndBuildFullSeoPaths(string objectType, IList objects, Store store, Language language) { var objectIds = objects.Select(o => o.ObjectId).ToArray(); var seoPaths = await GetFullSeoPathsAsync(objectType, objectIds, store, language); if (seoPaths != null) { foreach (var seo in objects) { seo.SeoPath = seoPaths[seo.ObjectId]; } } } protected virtual async Task> GetFullSeoPathsAsync(string objectType, string[] objectIds, Store store, Language language) { var cacheKey = CacheKey.With(GetType(), "GetFullSeoPaths", store.Id, objectType, string.Join("-", objectIds.OrderBy(x => x))); var result = await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(RoutingCacheRegion.CreateChangeToken()); cacheEntry.AddExpirationToken(_apiChangesWatcher.CreateChangeToken()); switch (objectType) { case "Category": return await GetCategorySeoPathsAsync(objectIds, store, language); case "CatalogProduct": return await GetProductSeoPathsAsync(objectIds, store, language); } return new Dictionary().WithDefaultValue(null); }); return result; } protected virtual async Task> GetCategorySeoPathsAsync(string[] objectIds, Store store, Language language) { var result = await _apiCategories.GetCategoriesByPlentyIdsAsync(objectIds, "WithOutlines|WithSeo"); return result.ToDictionary(x => x.Id, x => x.Outlines.GetSeoPath(store, language, null)).WithDefaultValue(null); } protected virtual async Task> GetProductSeoPathsAsync(string[] objectIds, Store store, Language language) { var result = await _apiProducts.GetProductByPlentyIdsAsync(objectIds, "Outlines|Seo"); return result.ToDictionary(x => x.Id, x => x.Outlines.GetSeoPath(store, language, null)).WithDefaultValue(null); } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/StorefrontApiRouteAttribute.cs ================================================ using System; namespace VirtoCommerce.Storefront.Infrastructure { [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class StorefrontApiRouteAttribute : StorefrontRouteAttribute { public StorefrontApiRouteAttribute() : this(string.Empty) { } public StorefrontApiRouteAttribute(string template) : base($"storefrontapi/{template}") { } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/StorefrontRoute.cs ================================================ using System.Collections.Generic; using Microsoft.AspNetCore.Routing; namespace VirtoCommerce.Storefront.Routing { public class StorefrontRoute : Route { private const string _regexp = ""; public StorefrontRoute(IRouter target, string routeTemplate, IInlineConstraintResolver inlineConstraintResolver) : this(target, routeTemplate, null, null, null, inlineConstraintResolver) { } public StorefrontRoute(IRouter target, string routeTemplate, RouteValueDictionary defaults, IDictionary constraints, RouteValueDictionary dataTokens, IInlineConstraintResolver inlineConstraintResolver) : this(target, null, routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver) { } public StorefrontRoute(IRouter target, string routeName, string routeTemplate, RouteValueDictionary defaults, IDictionary constraints, RouteValueDictionary dataTokens, IInlineConstraintResolver inlineConstraintResolver) : base(target, routeName, _regexp + routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver) { } } } ================================================ FILE: VirtoCommerce.Storefront/Routing/StorefrontRouteAttribute.cs ================================================ using System; using Microsoft.AspNetCore.Mvc.Routing; namespace VirtoCommerce.Storefront.Infrastructure { [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class StorefrontRouteAttribute : Attribute, IRouteTemplateProvider { private const string _regexp = ""; public StorefrontRouteAttribute() : this(string.Empty) { } public StorefrontRouteAttribute(string template) { Template = _regexp + template; } #region IRouteTemplateProvider members public string Template { get; private set; } public int? Order => 0; public string Name => null; #endregion } } ================================================ FILE: VirtoCommerce.Storefront/Startup.cs ================================================ using System; using System.IO; using System.Linq; using System.Text.Encodings.Web; using System.Text.Unicode; using FluentValidation.AspNetCore; using GraphQL.Client.Abstractions; using GraphQL.Client.Http; using GraphQL.Client.Serializer.Newtonsoft; using Microsoft.ApplicationInsights.Extensibility.Implementation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Rewrite; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.Extensions.WebEncoders; using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using ProxyKit; using Swashbuckle.AspNetCore.SwaggerGen; using VirtoCommerce.LiquidThemeEngine; using VirtoCommerce.Storefront.Caching; using VirtoCommerce.Storefront.DependencyInjection; using VirtoCommerce.Storefront.Domain; using VirtoCommerce.Storefront.Domain.Security; using VirtoCommerce.Storefront.Extensions; using VirtoCommerce.Storefront.Filters; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Infrastructure.ApplicationInsights; using VirtoCommerce.Storefront.Infrastructure.Autorest; using VirtoCommerce.Storefront.Infrastructure.HealthCheck; using VirtoCommerce.Storefront.Infrastructure.Swagger; using VirtoCommerce.Storefront.Middleware; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Common; using VirtoCommerce.Storefront.Model.Common.Bus; using VirtoCommerce.Storefront.Model.Common.Events; using VirtoCommerce.Storefront.Model.Customer.Services; using VirtoCommerce.Storefront.Model.Features; using VirtoCommerce.Storefront.Model.LinkList.Services; using VirtoCommerce.Storefront.Model.Security; using VirtoCommerce.Storefront.Model.StaticContent; using VirtoCommerce.Storefront.Model.Stores; using VirtoCommerce.Storefront.Routing; using VirtoCommerce.Tools; using SameSiteMode = Microsoft.AspNetCore.Http.SameSiteMode; namespace VirtoCommerce.Storefront { public class Startup { public Startup(IConfiguration configuration, IWebHostEnvironment hostingEnviroment) { Configuration = configuration; HostingEnvironment = hostingEnviroment; } public IConfiguration Configuration { get; } public IWebHostEnvironment HostingEnvironment { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMemoryCache(); services.AddResponseCaching(); services.AddHealthChecks() .AddCheck("Platform connection health", failureStatus: HealthStatus.Unhealthy, tags: new[] { "PlatformConnection" }); services.Configure(Configuration.GetSection("VirtoCommerce")); //The IHttpContextAccessor service is not registered by default //https://github.com/aspnet/Hosting/issues/793 services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddTransient(); services.AddTransient(); //Register events framework dependencies services.AddSingleton(new InProcessBus()); services.AddSingleton(provider => provider.GetService()); services.AddSingleton(provider => provider.GetService()); // register features toggling agent services.AddSingleton(); //Cache var redisConnectionString = Configuration.GetConnectionString("RedisConnectionString"); services.AddStorefrontCache(redisConnectionString, o => { Configuration.GetSection("VirtoCommerce:Redis").Bind(o); }); //Register platform API clients services.AddPlatformEndpoint(options => { Configuration.GetSection("VirtoCommerce:Endpoint").Bind(options); }); services.AddSingleton(); services.Configure(options => { options.FilePath = HostingEnvironment.MapPath("~/countries.json"); }); var contentConnectionString = BlobConnectionString.Parse(Configuration.GetConnectionString("ContentConnectionString")); if (contentConnectionString.Provider.EqualsInvariant("AzureBlobStorage")) { var azureBlobOptions = new AzureBlobContentOptions(); Configuration.GetSection("VirtoCommerce:AzureBlobStorage").Bind(azureBlobOptions); services.AddAzureBlobContent(options => { options.Container = contentConnectionString.RootPath; options.ConnectionString = contentConnectionString.ConnectionString; options.PollForChanges = azureBlobOptions.PollForChanges; options.ChangesPollingInterval = azureBlobOptions.ChangesPollingInterval; }); } else { var fileSystemBlobOptions = new FileSystemBlobContentOptions(); Configuration.GetSection("VirtoCommerce:FileSystemBlobStorage").Bind(fileSystemBlobOptions); services.AddFileSystemBlobContent(options => { options.Path = HostingEnvironment.MapPath(contentConnectionString.RootPath); }); } //Identity overrides for use remote user storage services.AddScoped, UserStoreStub>(); services.AddScoped, UserStoreStub>(); services.AddScoped, CustomUserManager>(); services.AddScoped, CustomSignInManager>(); //Resource-based authorization that requires API permissions for some operations services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); // register the AuthorizationPolicyProvider which dynamically registers authorization policies for each permission defined in the platform services.AddSingleton(); //Storefront authorization handler for policy based on permissions services.AddSingleton(); services.AddSingleton(); services.AddAuthorization(options => { options.AddPolicy(CanImpersonateAuthorizationRequirement.PolicyName, policy => policy.Requirements.Add(new CanImpersonateAuthorizationRequirement())); options.AddPolicy(CanReadContentItemAuthorizeRequirement.PolicyName, policy => policy.Requirements.Add(new CanReadContentItemAuthorizeRequirement())); options.AddPolicy(CanEditOrganizationResourceAuthorizeRequirement.PolicyName, policy => policy.Requirements.Add(new CanEditOrganizationResourceAuthorizeRequirement())); options.AddPolicy(OnlyRegisteredUserAuthorizationRequirement.PolicyName, policy => policy.Requirements.Add(new OnlyRegisteredUserAuthorizationRequirement())); options.AddPolicy(AnonymousUserForStoreAuthorizationRequirement.PolicyName, policy => policy.Requirements.Add(new AnonymousUserForStoreAuthorizationRequirement())); }); var auth = services.AddAuthentication(); var facebookSection = Configuration.GetSection("Authentication:Facebook"); if (facebookSection.GetChildren().Any()) { auth.AddFacebook(facebookOptions => { facebookSection.Bind(facebookOptions); }); } var googleSection = Configuration.GetSection("Authentication:Google"); if (googleSection.GetChildren().Any()) { auth.AddGoogle(googleOptions => { googleSection.Bind(googleOptions); }); } var githubSection = Configuration.GetSection("Authentication:Github"); if (githubSection.GetChildren().Any()) { auth.AddGitHub(GitHubAuthenticationOptions => { githubSection.Bind(GitHubAuthenticationOptions); }); } var stackexchangeSection = Configuration.GetSection("Authentication:Stackexchange"); if (stackexchangeSection.GetChildren().Any()) { auth.AddStackExchange(StackExchangeAuthenticationOptions => { stackexchangeSection.Bind(StackExchangeAuthenticationOptions); }); } services.Configure(Configuration.GetSection("IdentityOptions")); services.AddIdentity(options => { }).AddDefaultTokenProviders(); services.AddScoped(); services.ConfigureApplicationCookie(options => { Configuration.GetSection("CookieAuthenticationOptions").Bind(options); options.EventsType = typeof(CustomCookieAuthenticationEvents); }); services.Configure(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.Lax; }); // The Tempdata provider cookie is not essential. Make it essential // so Tempdata is functional when tracking is disabled. services.Configure(options => { options.Cookie.IsEssential = true; }); // Add Liquid view engine services.AddLiquidViewEngine(options => { Configuration.GetSection("VirtoCommerce:LiquidThemeEngine").Bind(options); }); services.AddAntiforgery(options => { options.HeaderName = "X-XSRF-TOKEN"; options.SuppressXFrameOptionsHeader = true; }); services.AddMvc(options => { // Thus we disable anonymous users based on "Store:AllowAnonymous" store option options.Filters.AddService(); options.CacheProfiles.Add("Default", new CacheProfile() { Duration = (int)TimeSpan.FromHours(1).TotalSeconds, VaryByHeader = "host" }); options.CacheProfiles.Add("None", new CacheProfile() { NoStore = true, Location = ResponseCacheLocation.None }); options.Filters.AddService(typeof(AngularAntiforgeryCookieResultFilterAttribute)); // To include only Api controllers to swagger document options.Conventions.Add(new ApiExplorerApiControllersConvention()); // Use the routing logic of ASP.NET Core 2.1 or earlier: options.EnableEndpointRouting = false; }).AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver() { NamingStrategy = new CamelCaseNamingStrategy() }; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Include; options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.MissingMemberHandling = MissingMemberHandling.Ignore; }); services.AddFluentValidationAutoValidation(); services.AddFluentValidationClientsideAdapters(); // Register event handlers via reflection services.RegisterAssembliesEventHandlers(typeof(Startup)); // The following line enables Application Insights telemetry collection. services.AddApplicationInsightsTelemetry(); services.AddApplicationInsightsExtensions(Configuration); // https://github.com/aspnet/HttpAbstractions/issues/315 // Changing the default html encoding options, to not encode non-Latin characters services.Configure(options => options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All)); services.Configure(options => { options.IncludeSubDomains = true; options.MaxAge = TimeSpan.FromDays(30); }); // Register the Swagger generator, defining 1 or more Swagger documents services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Storefront REST API documentation", Version = "v1" }); c.IgnoreObsoleteProperties(); c.IgnoreObsoleteActions(); // To include 401 response type to actions that requires Authorization c.OperationFilter(); c.OperationFilter(); c.OperationFilter(); c.OperationFilter(); c.OperationFilter(); c.OperationFilter(); c.SchemaFilter(); // Use method name as operation ID, i.e. ApiAccount.GetOrganization instead of /storefrontapi/account/organization (will be treated as just organization method) c.CustomOperationIds(apiDesc => apiDesc.TryGetMethodInfo(out var methodInfo) ? methodInfo.Name : null); // To avoid errors with repeating type names c.CustomSchemaIds(type => (Attribute.GetCustomAttribute(type, typeof(SwaggerSchemaIdAttribute)) as SwaggerSchemaIdAttribute)?.Id ?? type.FriendlyId()); }); services.AddSwaggerGenNewtonsoftSupport(); services.AddResponseCompression(); services.AddProxy(builder => builder.AddHttpMessageHandler(sp => sp.GetService().CreateAuthHandler())); services.Configure(options => options.WebSocketKeepAliveInterval = TimeSpan.FromSeconds(50)); services.AddSingleton(s => { var platformEndpointOptions = s.GetRequiredService>().Value; return new GraphQLHttpClient($"{platformEndpointOptions.Url}graphql", new NewtonsoftJsonSerializer()); }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseForwardedHeaders(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/error/500"); app.UseHsts(); } // Do not write telemetry to debug output TelemetryDebugWriter.IsTracingDisabled = true; app.UseHealthChecks("/storefrontapi/health", new HealthCheckOptions { ResponseWriter = async (context, report) => { context.Response.ContentType = "application/json; charset=utf-8"; var reportJson = JsonConvert.SerializeObject(report.Entries, Formatting.Indented, new StringEnumConverter()); await context.Response.WriteAsync(reportJson); } }); app.UseResponseCaching(); app.UseResponseCompression(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseRouting(); app.UseAuthentication(); // WorkContextBuildMiddleware must always be registered first in the Middleware chain app.UseMiddleware(); app.UseMiddleware(); app.UseMiddleware(); var mvcViewOptions = app.ApplicationServices.GetService>().Value; mvcViewOptions.ViewEngines.Add(app.ApplicationServices.GetService()); // Do not use status code pages for Api requests app.UseWhen(context => !context.Request.Path.IsApi(), appBuilder => { appBuilder.UseStatusCodePagesWithReExecute("/error/{0}"); }); // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(c => c.RouteTemplate = "docs/{documentName}/docs.json"); var rewriteOptions = new RewriteOptions(); // Load IIS url rewrite rules from external file if (File.Exists("IISUrlRewrite.xml")) { using var iisUrlRewriteStreamReader = File.OpenText("IISUrlRewrite.xml"); rewriteOptions.AddIISUrlRewrite(iisUrlRewriteStreamReader); } var requireHttpsOptions = new RequireHttpsOptions(); Configuration.GetSection("VirtoCommerce:RequireHttps").Bind(requireHttpsOptions); if (requireHttpsOptions.Enabled) { rewriteOptions.AddRedirectToHttps(requireHttpsOptions.StatusCode, requireHttpsOptions.Port); } app.UseRewriter(rewriteOptions); // Enable browser XSS protection app.Use(async (context, next) => { context.Response.Headers.XXSSProtection = "1"; await next(); }); var platformEndpointOptions = app.ApplicationServices.GetRequiredService>().Value; var httpsPlatformGraphqlEndpoint = new Uri(platformEndpointOptions.Url, "graphql"); var wssPlatformGraphqlEndpoint = new UriBuilder(httpsPlatformGraphqlEndpoint) { Scheme = httpsPlatformGraphqlEndpoint.Scheme == Uri.UriSchemeHttps ? Uri.UriSchemeWss : Uri.UriSchemeWs }.Uri; app.UseWebSockets(); app.Map("/xapi/graphql", appInner => { appInner.UseWebSocketProxy(_ => wssPlatformGraphqlEndpoint, options => options.AddXForwardedHeaders()); appInner.RunProxy(context => context.ForwardTo(httpsPlatformGraphqlEndpoint) .AddXForwardedHeaders() .Send()); }); app.UseWhen( context => context.Request.Path.Value.EndsWith("/token"), appInner => appInner .RunProxy(context => context .ForwardTo(platformEndpointOptions.Url) .AddXForwardedHeaders() .Send())); app.UseWhen( context => context.Request.Path.StartsWithSegments("/api/files"), appInner => appInner .RunProxy(context => context .ForwardTo(platformEndpointOptions.Url) .AddXForwardedHeaders() .Send())); // It will be good to rewrite endpoint routing as described here, but it's not easy to do: // https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#routing-startup-code app.UseMvc(routes => { routes.MapSlugRoute("{*path}", defaults: new { controller = "Home", action = "Index" }); }); } } } ================================================ FILE: VirtoCommerce.Storefront/Views/Common/Maintenance.cshtml ================================================

Under Maintenance

The server is under maintenance, please try again later.

================================================ FILE: VirtoCommerce.Storefront/Views/Common/NoTheme.cshtml ================================================

Virto Commerce storefront has been successfully deployed

Looks like you're missing a theme :(

@if (Model != null) {

We looked for 'index.liquid' view in the following locations

    @foreach (var searchedLocation in Model.SearchedLocations) {
  • @searchedLocation
  • }
}

It simple to fix: follow our instructions to download and correctly configure theme for your storefront.

Let's start!
================================================ FILE: VirtoCommerce.Storefront/Views/Error/404.cshtml ================================================

404

Page not found

================================================ FILE: VirtoCommerce.Storefront/Views/Error/500.cshtml ================================================

500

Internal server error.

================================================ FILE: VirtoCommerce.Storefront/Views/Error/AccessDenied.cshtml ================================================

Access Denied

You do not have access to the page you request

================================================ FILE: VirtoCommerce.Storefront/Views/Error/Error.cshtml ================================================

Error.

An error occurred while processing your request.

================================================ FILE: VirtoCommerce.Storefront/Views/Error/NoStore.cshtml ================================================

Virto Commerce storefront has been successfully deployed

There's no store yet, but Virto Commerce Manager makes it simple to create a new one!

Let's start!
================================================ FILE: VirtoCommerce.Storefront/Views/Shared/_Layout.cshtml ================================================ @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet @ViewData["Title"] - VirtoCommerce.Storefront @Html.Raw(JavaScriptSnippet.FullScript)
@RenderBody()

© @DateTime.Now.Year - VirtoCommerce.Storefront

@RenderSection("Scripts", required: false) ================================================ FILE: VirtoCommerce.Storefront/Views/Shared/_ValidationScriptsPartial.cshtml ================================================ ================================================ FILE: VirtoCommerce.Storefront/Views/_ViewImports.cshtml ================================================ @using VirtoCommerce.Storefront @using VirtoCommerce.Storefront.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers ================================================ FILE: VirtoCommerce.Storefront/Views/_ViewStart.cshtml ================================================ @{ Layout = "_Layout"; } ================================================ FILE: VirtoCommerce.Storefront/VirtoCommerce.Storefront.csproj ================================================ net8.0 ..\docker-compose.dcproj 0cd403c4-2cd0-42b3-987a-02900f4a683e The storefront implementation of the Virto Commerce platform. https://virtocommerce.com/open-source-license https://github.com/VirtoCommerce/vc-storefront https://github.com/VirtoCommerce/vc-storefront https://virtocommerce.com/themes/assets/logo.jpg 3.1 true 1701;1702;1591;1573;1570 Always all runtime; build; native; contentfiles; analyzers ================================================ FILE: VirtoCommerce.Storefront/appsettings.Development.json ================================================ { "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" } }, "VirtoCommerce": { "Endpoint": { "RequestTimeout": "0:5:00" }, "LiquidThemeEngine": { "RethrowLiquidRenderErrors": true } } } ================================================ FILE: VirtoCommerce.Storefront/appsettings.Production.json ================================================ { "CookieAuthenticationOptions": { "ExpireTimeSpan": "30.00:00:00" } } ================================================ FILE: VirtoCommerce.Storefront/appsettings.json ================================================ { "ConnectionStrings": { "ContentConnectionString": "provider=LocalStorage;rootPath=~/cms-content" // Set this connection string to switch the cache to hybrid mode. The Redis server will keep the local memory cache of multiple instances in a consistent state. //"RedisConnectionString": "127.0.0.1:6379,ssl=False" }, "VirtoCommerce": { "DefaultStore": "B2B-store", "StoreUrls": { // Define mapping of concrete stores with public urls in this section //"{store id}":"{store public url}" }, "CacheEnabled": "true", "CacheSlidingExpiration": "0:10:0", //The setting responds of frequency storefront requests to platform /api/changes/lastmodifieddate to get the latest timestamps of any data changes and use it for the cached data expiration, //any data changes in the platform side will invalidate all data cache in storefront because of hard to implement graceful cache invalidation for dependencies "ChangesPollingInterval": "0:0:15", "Redis": { // The name of the channel. All instances with the same ChannelName will only receive events within their own channel. "ChannelName": "VirtoCommerceStorefrontChannel", "BusRetryCount": 3 }, "PageSizeMaxValue": 100, "Endpoint": { "Url": "https://localhost:5001/", // Use AppId and SecretKey for Platform API authentication (has higher priority than UserName/Password) //"AppId": "27e0d789f12641049bd0e939185b4fd2", //"SecretKey": "34f0a3c12c9dbb59b63b5fece955b7b2b9a3b20f84370cba1524dd5c53503a2e2cb733536ecf7ea1e77319a47084a3a2c9d94d36069a432ecc73b72aeba6ea78", // Use client credential flow for Platform API authentication //"ClientId": "", //"ClientSecret": "", // Use UserName and Password for Platform API authentication "UserName": "admin", "Password": "store", "RequestTimeout": "0:0:30" }, "LiquidThemeEngine": { "RethrowLiquidRenderErrors": false, // The path to the base theme that will be used to discover the theme resources not found by the path of theme for current store. // This parameter can be used for theme inheritance logic. // Example values: Electronics/default_theme -> wwwroot/cms-content/Themes/Electronics/default_theme "BaseThemePath": "", // Set to true if you want to merge current theme settings with base theme settings instead of placement "MergeBaseSettings": false }, "RequireHttps": { "Enabled": false, "StatusCode": "308", "Port": "443" }, "AzureBlobStorage": { "PollForChanges": true, "ChangesPollingInterval": "0:0:15" }, // This option sets how notification is delivered in reset password workflow. Possible values: "Email", "Phone". "ResetPasswordNotificationGateway": "Email", // This option sets how notification is delivered in two factor authentication workflow. Possible values: "Email", "Phone". "TwoFactorAuthenticationNotificationGateway": "Phone" }, "CookieAuthenticationOptions": { "Cookie": { "HttpOnly": true }, "ExpireTimeSpan": "00:30:00", "LoginPath": "/sign-in", "LogoutPath": "/sign-out", "AccessDeniedPath": "/error/accessdenied", "SlidingExpiration": true }, "IdentityOptions": { "Password": { "RequiredLength": 8, "RequireDigit": false, "RequireNonAlphanumeric": false }, "Lockout": { "DefaultLockoutTimeSpan": "0:15:0" } }, "SnapshotCollectorConfiguration": { "IsEnabledInDeveloperMode": false, "ThresholdForSnapshotting": 1, "MaximumSnapshotsRequired": 3, "MaximumCollectionPlanSize": 50, "ReconnectInterval": "00:15:00", "ProblemCounterResetInterval": "1.00:00:00", "SnapshotsPerTenMinutesLimit": 1, "SnapshotsPerDayLimit": 30, "SnapshotInLowPriorityThread": true, "ProvideAnonymousTelemetry": true, "FailedRequestLimit": 3 } } ================================================ FILE: VirtoCommerce.Storefront/bower.json ================================================ { "name": "asp.net", "private": true, "dependencies": { "bootstrap": "3.3.7", "jquery": "2.2.0", "jquery-validation": "1.14.0", "jquery-validation-unobtrusive": "3.2.6" } } ================================================ FILE: VirtoCommerce.Storefront/bundleconfig.json ================================================ // Configure bundling and minification for the project. // More info at https://go.microsoft.com/fwlink/?LinkId=808241 [ { "outputFileName": "wwwroot/css/site.min.css", // An array of relative input file paths. Globbing patterns supported "inputFiles": [ "wwwroot/css/site.css" ] }, { "outputFileName": "wwwroot/js/site.min.js", "inputFiles": [ "wwwroot/js/site.js" ], // Optionally specify minification options "minify": { "enabled": true, "renameLocals": true }, // Optionally generate .map file "sourceMap": false } ] ================================================ FILE: VirtoCommerce.Storefront/bundleconfig.json.bindings ================================================ produceoutput=true ================================================ FILE: VirtoCommerce.Storefront/web.config ================================================ ================================================ FILE: VirtoCommerce.Storefront/wwwroot/countries.json ================================================ { "Canada": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland", "Northwest Territories", "Nova Scotia", "Nunavut", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon" ], "province_labels": { "Alberta": "Alberta", "British Columbia": "British Columbia", "Manitoba": "Manitoba", "New Brunswick": "New Brunswick", "Newfoundland": "Newfoundland", "Northwest Territories": "Northwest Territories", "Nova Scotia": "Nova Scotia", "Nunavut": "Nunavut", "Ontario": "Ontario", "Prince Edward Island": "Prince Edward Island", "Quebec": "Quebec", "Saskatchewan": "Saskatchewan", "Yukon": "Yukon" }, "province_codes": { "Alberta": "AB", "British Columbia": "BC", "Manitoba": "MB", "New Brunswick": "NB", "Newfoundland": "NL", "Northwest Territories": "NT", "Nova Scotia": "NS", "Nunavut": "NU", "Ontario": "ON", "Prince Edward Island": "PE", "Quebec": "QC", "Saskatchewan": "SK", "Yukon": "YT" }, "Code2": "CA", "Code3": "CAN" }, "United States": { "label": "State", "zip_label": "Zip code", "zip_placeholder": "Zip code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": [ "Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Federated States of Micronesia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Marshall Islands", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio", "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "Washington DC", "West Virginia", "Wisconsin", "Wyoming", "Virgin Islands", "Armed Forces Americas", "Armed Forces Europe", "Armed Forces Pacific" ], "province_labels": { "Alabama": "Alabama", "Alaska": "Alaska", "American Samoa": "American Samoa", "Arizona": "Arizona", "Arkansas": "Arkansas", "Armed Forces Americas": "Armed Forces Americas", "Armed Forces Europe": "Armed Forces Europe", "Armed Forces Pacific": "Armed Forces Pacific", "California": "California", "Colorado": "Colorado", "Connecticut": "Connecticut", "Delaware": "Delaware", "Federated States of Micronesia": "Federated States of Micronesia", "Florida": "Florida", "Georgia": "Georgia", "Guam": "Guam", "Hawaii": "Hawaii", "Idaho": "Idaho", "Illinois": "Illinois", "Indiana": "Indiana", "Iowa": "Iowa", "Kansas": "Kansas", "Kentucky": "Kentucky", "Louisiana": "Louisiana", "Maine": "Maine", "Marshall Islands": "Marshall Islands", "Maryland": "Maryland", "Massachusetts": "Massachusetts", "Michigan": "Michigan", "Minnesota": "Minnesota", "Mississippi": "Mississippi", "Missouri": "Missouri", "Montana": "Montana", "Nebraska": "Nebraska", "Nevada": "Nevada", "New Hampshire": "New Hampshire", "New Jersey": "New Jersey", "New Mexico": "New Mexico", "New York": "New York", "North Carolina": "North Carolina", "North Dakota": "North Dakota", "Northern Mariana Islands": "Northern Mariana Islands", "Ohio": "Ohio", "Oklahoma": "Oklahoma", "Oregon": "Oregon", "Palau": "Palau", "Pennsylvania": "Pennsylvania", "Puerto Rico": "Puerto Rico", "Rhode Island": "Rhode Island", "South Carolina": "South Carolina", "South Dakota": "South Dakota", "Tennessee": "Tennessee", "Texas": "Texas", "Utah": "Utah", "Vermont": "Vermont", "Virgin Islands": "Virgin Islands", "Virginia": "Virginia", "Washington": "Washington", "Washington DC": "Washington DC", "West Virginia": "West Virginia", "Wisconsin": "Wisconsin", "Wyoming": "Wyoming" }, "province_codes": { "Alabama": "AL", "Alaska": "AK", "American Samoa": "AS", "Arizona": "AZ", "Arkansas": "AR", "California": "CA", "Colorado": "CO", "Connecticut": "CT", "Delaware": "DE", "Federated States of Micronesia": "FM", "Florida": "FL", "Georgia": "GA", "Guam": "GU", "Hawaii": "HI", "Idaho": "ID", "Illinois": "IL", "Indiana": "IN", "Iowa": "IA", "Kansas": "KS", "Kentucky": "KY", "Louisiana": "LA", "Maine": "ME", "Marshall Islands": "MH", "Maryland": "MD", "Massachusetts": "MA", "Michigan": "MI", "Minnesota": "MN", "Mississippi": "MS", "Missouri": "MO", "Montana": "MT", "Nebraska": "NE", "Nevada": "NV", "New Hampshire": "NH", "New Jersey": "NJ", "New Mexico": "NM", "New York": "NY", "North Carolina": "NC", "North Dakota": "ND", "Northern Mariana Islands": "MP", "Ohio": "OH", "Oklahoma": "OK", "Oregon": "OR", "Palau": "PW", "Pennsylvania": "PA", "Puerto Rico": "PR", "Rhode Island": "RI", "South Carolina": "SC", "South Dakota": "SD", "Tennessee": "TN", "Texas": "TX", "Utah": "UT", "Vermont": "VT", "Virginia": "VA", "Washington": "WA", "Washington DC": "DC", "West Virginia": "WV", "Wisconsin": "WI", "Wyoming": "WY", "Virgin Islands": "VI", "Armed Forces Americas": "AA", "Armed Forces Europe": "AE", "Armed Forces Pacific": "AP" }, "Code2": "US", "Code3": "USA" }, "United Kingdom": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GB", "Code3": "GBR" }, "Albania": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AL", "Code3": "ALB" }, "Algeria": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DZ", "Code3": "DZA" }, "Andorra": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AD", "Code3": "AND" }, "Angola": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AO", "Code3": "AGO" }, "Argentina": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "Buenos Aires City", "Buenos Aires", "Catamarca", "Chaco", "Chobut", "Córdoba", "Corrientes", "Ente Ríos", "Formosa", "Jujuy", "La Pampa", "La Rioja", "Mendoza", "Misiones", "Neuquén", "Río Negro", "Salta", "San Juan", "San Luis", "Santa Cruz", "Santa Fe", "Santiago Del Estero", "Tierra del Fuego", "Tucumán" ], "province_labels": { "Buenos Aires": "Buenos Aires", "Buenos Aires City": "Buenos Aires City", "Catamarca": "Catamarca", "Chaco": "Chaco", "Chobut": "Chobut", "Córdoba": "Córdoba", "Corrientes": "Corrientes", "Ente Ríos": "Ente Ríos", "Formosa": "Formosa", "Jujuy": "Jujuy", "La Pampa": "La Pampa", "La Rioja": "La Rioja", "Mendoza": "Mendoza", "Misiones": "Misiones", "Neuquén": "Neuquén", "Río Negro": "Río Negro", "Salta": "Salta", "San Juan": "San Juan", "San Luis": "San Luis", "Santa Cruz": "Santa Cruz", "Santa Fe": "Santa Fe", "Santiago Del Estero": "Santiago Del Estero", "Tierra del Fuego": "Tierra del Fuego", "Tucumán": "Tucumán" }, "province_codes": { "Buenos Aires City": "C", "Buenos Aires": "B", "Catamarca": "K", "Chaco": "H", "Chobut": "U", "Córdoba": "X", "Corrientes": "W", "Ente Ríos": "E", "Formosa": "P", "Jujuy": "Y", "La Pampa": "L", "La Rioja": "F", "Mendoza": "M", "Misiones": "N", "Neuquén": "Q", "Río Negro": "R", "Salta": "A", "San Juan": "J", "San Luis": "D", "Santa Cruz": "Z", "Santa Fe": "S", "Santiago Del Estero": "G", "Tierra del Fuego": "V", "Tucumán": "T" }, "Code2": "AR", "Code3": "ARG" }, "Armenia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AM", "Code3": "ARM" }, "Aruba": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AW", "Code3": "ABW" }, "Antigua And Barbuda": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AG", "Code3": "ATG" }, "Australia": { "label": "State/Territory", "zip_label": "Postcode", "zip_placeholder": "Postcode", "zip_required": true, "provinces_beta": null, "province_label": "State/Territory", "provinces": [ "Australian Capital Territory", "New South Wales", "Northern Territory", "Queensland", "South Australia", "Tasmania", "Victoria", "Western Australia" ], "province_labels": { "Australian Capital Territory": "Australian Capital Territory", "New South Wales": "New South Wales", "Northern Territory": "Northern Territory", "Queensland": "Queensland", "South Australia": "South Australia", "Tasmania": "Tasmania", "Victoria": "Victoria", "Western Australia": "Western Australia" }, "province_codes": { "Australian Capital Territory": "ACT", "New South Wales": "NSW", "Northern Territory": "NT", "Queensland": "QLD", "South Australia": "SA", "Tasmania": "TAS", "Victoria": "VIC", "Western Australia": "WA" }, "Code2": "AU", "Code3": "AUS" }, "Austria": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AT", "Code3": "AUT" }, "Azerbaijan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AZ", "Code3": "AZE" }, "Bangladesh": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BD", "Code3": "BGD" }, "Bahamas": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BS", "Code3": "BHS" }, "Bahrain": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BH", "Code3": "BHR" }, "Barbados": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BB", "Code3": "BRB" }, "Belarus": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BY", "Code3": "BLR" }, "Belgium": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BE", "Code3": "BEL" }, "Belize": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BZ", "Code3": "BLZ" }, "Bermuda": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BM", "Code3": "BMU" }, "Bhutan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BT", "Code3": "BTN" }, "Bolivia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BO", "Code3": "BOL" }, "Bosnia And Herzegovina": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BA", "Code3": "BIH" }, "Botswana": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BW", "Code3": "BWA" }, "Brazil": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": [ "Acre", "Alagoas", "Amapá", "Amazonas", "Bahia", "Ceará", "Distrito Federal", "Espírito Santo", "Goiás", "Maranhão", "Mato Grosso", "Mato Grosso do Sul", "Minas Gerais", "Pará", "Paraíba", "Paraná", "Pernambuco", "Piauí", "Rio de Janeiro", "Rio Grande do Norte", "Rio Grande do Sul", "Rondônia", "Roraima", "Santa Catarina", "São Paulo", "Sergipe", "Tocantins" ], "province_labels": { "Acre": "Acre", "Alagoas": "Alagoas", "Amapá": "Amapá", "Amazonas": "Amazonas", "Bahia": "Bahia", "Ceará": "Ceará", "Distrito Federal": "Distrito Federal", "Espírito Santo": "Espírito Santo", "Goiás": "Goiás", "Maranhão": "Maranhão", "Mato Grosso": "Mato Grosso", "Mato Grosso do Sul": "Mato Grosso do Sul", "Minas Gerais": "Minas Gerais", "Pará": "Pará", "Paraíba": "Paraíba", "Paraná": "Paraná", "Pernambuco": "Pernambuco", "Piauí": "Piauí", "Rio Grande do Norte": "Rio Grande do Norte", "Rio Grande do Sul": "Rio Grande do Sul", "Rio de Janeiro": "Rio de Janeiro", "Rondônia": "Rondônia", "Roraima": "Roraima", "Santa Catarina": "Santa Catarina", "São Paulo": "São Paulo", "Sergipe": "Sergipe", "Tocantins": "Tocantins" }, "province_codes": { "Acre": "AC", "Alagoas": "AL", "Amapá": "AP", "Amazonas": "AM", "Bahia": "BA", "Ceará": "CE", "Distrito Federal": "DF", "Espírito Santo": "ES", "Goiás": "GO", "Maranhão": "MA", "Mato Grosso": "MT", "Mato Grosso do Sul": "MS", "Minas Gerais": "MG", "Pará": "PA", "Paraíba": "PB", "Paraná": "PR", "Pernambuco": "PE", "Piauí": "PI", "Rio de Janeiro": "RJ", "Rio Grande do Norte": "RN", "Rio Grande do Sul": "RS", "Rondônia": "RO", "Roraima": "RR", "Santa Catarina": "SC", "São Paulo": "SP", "Sergipe": "SE", "Tocantins": "TO" }, "Code2": "BR", "Code3": "BRA" }, "Brunei": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BR", "Code3": "BRN" }, "Bulgaria": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BG", "Code3": "BGR" }, "Cambodia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KH", "Code3": "KHM" }, "Republic of Cameroon": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CM", "Code3": "CMR" }, "Cayman Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KY", "Code3": "CYM" }, "Chile": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CL", "Code3": "CHL" }, "China": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CN", "Code3": "CHN" }, "Colombia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CO", "Code3": "COL" }, "Comoros": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KM", "Code3": "COM" }, "Congo": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CG", "Code3": "COG" }, "Costa Rica": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CR", "Code3": "CRI" }, "Côte d'Ivoire": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CI", "Code3": "CIV" }, "Croatia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HR", "Code3": "HRV" }, "Curaçao": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CW", "Code3": "CUW" }, "Cyprus": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CY", "Code3": "CYP" }, "Czech Republic": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CZ", "Code3": "CZE" }, "Denmark": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DK", "Code3": "DNK" }, "Dominica": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DM", "Code3": "DMA" }, "Dominican Republic": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DO", "Code3": "DOM" }, "Ecuador": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "EC", "Code3": "ECU" }, "Egypt": { "label": "Governorate", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": [ "Dakahlia", "Red Sea", "Beheira", "Faiyum", "Gharbia", "Alexandria", "Ismailia", "Giza", "Monufia", "Minya", "Cairo", "Qalyubia", "Luxor", "New Valley", "Al Sharqia", "6th of October", "Suez", "Aswan", "Asyut", "Beni Suef", "Port Said", "Damietta", "Helwan", "South Sinai", "Kafr el-Sheikh", "Matrouh", "Qena", "North Sinai", "Sohag" ], "province_labels": { "6th of October": "6th of October", "Al Sharqia": "Al Sharqia", "Alexandria": "Alexandria", "Aswan": "Aswan", "Asyut": "Asyut", "Beheira": "Beheira", "Beni Suef": "Beni Suef", "Cairo": "Cairo", "Dakahlia": "Dakahlia", "Damietta": "Damietta", "Faiyum": "Faiyum", "Gharbia": "Gharbia", "Giza": "Giza", "Helwan": "Helwan", "Ismailia": "Ismailia", "Kafr el-Sheikh": "Kafr el-Sheikh", "Luxor": "Luxor", "Matrouh": "Matrouh", "Minya": "Minya", "Monufia": "Monufia", "New Valley": "New Valley", "North Sinai": "North Sinai", "Port Said": "Port Said", "Qalyubia": "Qalyubia", "Qena": "Qena", "Red Sea": "Red Sea", "Sohag": "Sohag", "South Sinai": "South Sinai", "Suez": "Suez" }, "province_codes": { "Dakahlia": "DK", "Red Sea": "BA", "Beheira": "BH", "Faiyum": "FYM", "Gharbia": "GH", "Alexandria": "ALX", "Ismailia": "IS", "Giza": "GZ", "Monufia": "MNF", "Minya": "MN", "Cairo": "C", "Qalyubia": "KB", "Luxor": "LX", "New Valley": "WAD", "Al Sharqia": "SHR", "6th of October": "SU", "Suez": "SUZ", "Aswan": "ASN", "Asyut": "AST", "Beni Suef": "BNS", "Port Said": "PTS", "Damietta": "DT", "Helwan": "HU", "South Sinai": "JS", "Kafr el-Sheikh": "KFS", "Matrouh": "MT", "Qena": "KN", "North Sinai": "SIN", "Sohag": "SHG" }, "Code2": "EG", "Code3": "EGY" }, "El Salvador": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SV", "Code3": "SLV" }, "Estonia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "EE", "Code3": "EST" }, "Ethiopia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ET", "Code3": "ETH" }, "Faroe Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "FO", "Code3": "FRO" }, "Fiji": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "FJ", "Code3": "FJI" }, "Finland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "FI", "Code3": "FIN" }, "France": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "FR", "Code3": "FRA" }, "French Polynesia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PF", "Code3": "PYF" }, "Gambia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GM", "Code3": "GMB" }, "Georgia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GE", "Code3": "GEO" }, "Germany": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DE", "Code3": "DEU" }, "Ghana": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GH", "Code3": "GHA" }, "Gibraltar": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GI", "Code3": "GIB" }, "Greece": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GR", "Code3": "GRC" }, "Greenland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GL", "Code3": "GRL" }, "Grenada": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GD", "Code3": "GRD" }, "Guadeloupe": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GP", "Code3": "GLP" }, "Guatemala": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": [ "Alta Verapaz", "Baja Verapaz", "Chimaltenango", "Chiquimula", "El Progreso", "Escuintla", "Guatemala", "Huehuetenango", "Izabal", "Jalapa", "Jutiapa", "Petén", "Quetzaltenango", "Quiché", "Retalhuleu", "Sacatepéquez", "San Marcos", "Santa Rosa", "Sololá", "Suchitepéquez", "Totonicapán", "Zacapa" ], "province_labels": { "Alta Verapaz": "Alta Verapaz", "Baja Verapaz": "Baja Verapaz", "Chimaltenango": "Chimaltenango", "Chiquimula": "Chiquimula", "El Progreso": "El Progreso", "Escuintla": "Escuintla", "Guatemala": "Guatemala", "Huehuetenango": "Huehuetenango", "Izabal": "Izabal", "Jalapa": "Jalapa", "Jutiapa": "Jutiapa", "Petén": "Petén", "Quetzaltenango": "Quetzaltenango", "Quiché": "Quiché", "Retalhuleu": "Retalhuleu", "Sacatepéquez": "Sacatepéquez", "San Marcos": "San Marcos", "Santa Rosa": "Santa Rosa", "Sololá": "Sololá", "Suchitepéquez": "Suchitepéquez", "Totonicapán": "Totonicapán", "Zacapa": "Zacapa" }, "province_codes": { "Alta Verapaz": "AVE", "Baja Verapaz": "BVE", "Chimaltenango": "CMT", "Chiquimula": "CQM", "El Progreso": "EPR", "Escuintla": "ESC", "Guatemala": "GUA", "Huehuetenango": "HUE", "Izabal": "IZA", "Jalapa": "JAL", "Jutiapa": "JUT", "Petén": "PET", "Quetzaltenango": "QUE", "Quiché": "QUI", "Retalhuleu": "RET", "Sacatepéquez": "SAC", "San Marcos": "SMA", "Santa Rosa": "SRO", "Sololá": "SOL", "Suchitepéquez": "SUC", "Totonicapán": "TOT", "Zacapa": "ZAC" }, "Code2": "GT", "Code3": "GTM" }, "Guernsey": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GG", "Code3": "GGY" }, "Guyana": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GY", "Code3": "GUY" }, "Haiti": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HT", "Code3": "HTI" }, "Honduras": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HN", "Code3": "HND" }, "Hong Kong": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HK", "Code3": "HKG" }, "Hungary": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HU", "Code3": "HUN" }, "Iceland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IS", "Code3": "ISL" }, "India": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": [ "Andaman and Nicobar", "Andhra Pradesh", "Arunachal Pradesh", "Assam", "Bihar", "Chandigarh", "Chattisgarh", "Dadra and Nagar Haveli", "Daman and Diu", "Delhi", "Goa", "Gujarat", "Haryana", "Himachal Pradesh", "Jammu and Kashmir", "Jharkhand", "Karnataka", "Kerala", "Lakshadweep", "Madhya Pradesh", "Maharashtra", "Manipur", "Meghalaya", "Mizoram", "Nagaland", "Orissa", "Puducherry", "Punjab", "Rajasthan", "Sikkim", "Tamil Nadu", "Telangana", "Tripura", "Uttar Pradesh", "Uttarakhand", "West Bengal" ], "province_labels": { "Andaman and Nicobar": "Andaman and Nicobar", "Andhra Pradesh": "Andhra Pradesh", "Arunachal Pradesh": "Arunachal Pradesh", "Assam": "Assam", "Bihar": "Bihar", "Chandigarh": "Chandigarh", "Chattisgarh": "Chattisgarh", "Dadra and Nagar Haveli": "Dadra and Nagar Haveli", "Daman and Diu": "Daman and Diu", "Delhi": "Delhi", "Goa": "Goa", "Gujarat": "Gujarat", "Haryana": "Haryana", "Himachal Pradesh": "Himachal Pradesh", "Jammu and Kashmir": "Jammu and Kashmir", "Jharkhand": "Jharkhand", "Karnataka": "Karnataka", "Kerala": "Kerala", "Lakshadweep": "Lakshadweep", "Madhya Pradesh": "Madhya Pradesh", "Maharashtra": "Maharashtra", "Manipur": "Manipur", "Meghalaya": "Meghalaya", "Mizoram": "Mizoram", "Nagaland": "Nagaland", "Orissa": "Orissa", "Puducherry": "Puducherry", "Punjab": "Punjab", "Rajasthan": "Rajasthan", "Sikkim": "Sikkim", "Tamil Nadu": "Tamil Nadu", "Telangana": "Telangana", "Tripura": "Tripura", "Uttar Pradesh": "Uttar Pradesh", "Uttarakhand": "Uttarakhand", "West Bengal": "West Bengal" }, "province_codes": { "Andaman and Nicobar": "AN", "Andhra Pradesh": "AP", "Arunachal Pradesh": "AR", "Assam": "AS", "Bihar": "BR", "Chandigarh": "CH", "Chattisgarh": "CG", "Dadra and Nagar Haveli": "DN", "Daman and Diu": "DD", "Delhi": "DL", "Goa": "GA", "Gujarat": "GJ", "Haryana": "HR", "Himachal Pradesh": "HP", "Jammu and Kashmir": "JK", "Jharkhand": "JH", "Karnataka": "KA", "Kerala": "KL", "Lakshadweep": "LD", "Madhya Pradesh": "MP", "Maharashtra": "MH", "Manipur": "MN", "Meghalaya": "ML", "Mizoram": "MZ", "Nagaland": "NL", "Orissa": "OR", "Puducherry": "PY", "Punjab": "PB", "Rajasthan": "RJ", "Sikkim": "SK", "Tamil Nadu": "TN", "Telangana": "TS", "Tripura": "TR", "Uttar Pradesh": "UP", "Uttarakhand": "UK", "West Bengal": "WB" }, "Code2": "IN", "Code3": "IND" }, "Indonesia": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "Aceh", "Bali", "Bangka Belitung", "Banten", "Bengkulu", "Gorontalo", "Jakarta", "Jambi", "Jawa Barat", "Jawa Tengah", "Jawa Timur", "Kalimantan Barat", "Kalimantan Selatan", "Kalimantan Tengah", "Kalimantan Timur", "Kalimantan Utara", "Kepulauan Riau", "Lampung", "Maluku", "Maluku Utara", "Nusa Tenggara Barat", "Nusa Tenggara Timur", "Papua", "Papua Barat", "Riau", "Sulawesi Barat", "Sulawesi Selatan", "Sulawesi Tengah", "Sulawesi Tenggara", "Sulawesi Utara", "Sumatra Barat", "Sumatra Selatan", "Sumatra Utara", "Yogyakarta" ], "province_labels": { "Aceh": "Aceh", "Bali": "Bali", "Bangka Belitung": "Bangka Belitung", "Banten": "Banten", "Bengkulu": "Bengkulu", "Gorontalo": "Gorontalo", "Jakarta": "Jakarta", "Jambi": "Jambi", "Jawa Barat": "Jawa Barat", "Jawa Tengah": "Jawa Tengah", "Jawa Timur": "Jawa Timur", "Kalimantan Barat": "Kalimantan Barat", "Kalimantan Selatan": "Kalimantan Selatan", "Kalimantan Tengah": "Kalimantan Tengah", "Kalimantan Timur": "Kalimantan Timur", "Kalimantan Utara": "Kalimantan Utara", "Kepulauan Riau": "Kepulauan Riau", "Lampung": "Lampung", "Maluku": "Maluku", "Maluku Utara": "Maluku Utara", "Nusa Tenggara Barat": "Nusa Tenggara Barat", "Nusa Tenggara Timur": "Nusa Tenggara Timur", "Papua": "Papua", "Papua Barat": "Papua Barat", "Riau": "Riau", "Sulawesi Barat": "Sulawesi Barat", "Sulawesi Selatan": "Sulawesi Selatan", "Sulawesi Tengah": "Sulawesi Tengah", "Sulawesi Tenggara": "Sulawesi Tenggara", "Sulawesi Utara": "Sulawesi Utara", "Sumatra Barat": "Sumatra Barat", "Sumatra Selatan": "Sumatra Selatan", "Sumatra Utara": "Sumatra Utara", "Yogyakarta": "Yogyakarta" }, "province_codes": { "Aceh": "AC", "Bali": "BA", "Bangka Belitung": "BB", "Banten": "BT", "Bengkulu": "BE", "Gorontalo": "GO", "Jakarta": "JK", "Jambi": "JA", "Jawa Barat": "JB", "Jawa Tengah": "JT", "Jawa Timur": "JI", "Kalimantan Barat": "KB", "Kalimantan Selatan": "KS", "Kalimantan Tengah": "KT", "Kalimantan Timur": "KI", "Kalimantan Utara": "KU", "Kepulauan Riau": "KR", "Lampung": "LA", "Maluku": "MA", "Maluku Utara": "MU", "Nusa Tenggara Barat": "NB", "Nusa Tenggara Timur": "NT", "Papua": "PA", "Papua Barat": "PB", "Riau": "RI", "Sulawesi Barat": "SR", "Sulawesi Selatan": "SN", "Sulawesi Tengah": "ST", "Sulawesi Tenggara": "SG", "Sulawesi Utara": "SA", "Sumatra Barat": "SB", "Sumatra Selatan": "SS", "Sumatra Utara": "SU", "Yogyakarta": "YO" }, "Code2": "ID", "Code3": "IDN" }, "Ireland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IE", "Code3": "IRL" }, "Isle Of Man": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IM", "Code3": "IMN" }, "Israel": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IL", "Code3": "ISR" }, "Italy": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "Agrigento", "Alessandria", "Ancona", "Aosta", "Arezzo", "Ascoli Piceno", "Asti", "Avellino", "Bari", "Barletta-Andria-Trani", "Belluno", "Benevento", "Bergamo", "Biella", "Bologna", "Bolzano", "Brescia", "Brindisi", "Cagliari", "Caltanissetta", "Campobasso", "Carbonia-Iglesias", "Caserta", "Catania", "Catanzaro", "Chieti", "Como", "Cosenza", "Cremona", "Crotone", "Cuneo", "Enna", "Fermo", "Ferrara", "Firenze", "Foggia", "Forlì-Cesena", "Frosinone", "Genova", "Gorizia", "Grosseto", "Imperia", "Isernia", "La Spezia", "L'Aquila", "Latina", "Lecce", "Lecco", "Livorno", "Lodi", "Lucca", "Macerata", "Mantova", "Massa-Carrara", "Matera", "Medio Campidano", "Messina", "Milano", "Modena", "Monza e Brianza", "Napoli", "Novara", "Nuoro", "Ogliastra", "Olbia-Tempio", "Oristano", "Padova", "Palermo", "Parma", "Pavia", "Perugia", "Pesaro e Urbino", "Pescara", "Piacenza", "Pisa", "Pistoia", "Pordenone", "Potenza", "Prato", "Ragusa", "Ravenna", "Reggio Calabria", "Reggio Emilia", "Rieti", "Rimini", "Roma", "Rovigo", "Salerno", "Sassari", "Savona", "Siena", "Siracusa", "Sondrio", "Taranto", "Teramo", "Terni", "Torino", "Trapani", "Trento", "Treviso", "Trieste", "Udine", "Varese", "Venezia", "Verbano-Cusio-Ossola", "Vercelli", "Verona", "Vibo Valentia", "Vicenza", "Viterbo" ], "province_labels": { "Agrigento": "Agrigento", "Alessandria": "Alessandria", "Ancona": "Ancona", "Aosta": "Aosta", "Arezzo": "Arezzo", "Ascoli Piceno": "Ascoli Piceno", "Asti": "Asti", "Avellino": "Avellino", "Bari": "Bari", "Barletta-Andria-Trani": "Barletta-Andria-Trani", "Belluno": "Belluno", "Benevento": "Benevento", "Bergamo": "Bergamo", "Biella": "Biella", "Bologna": "Bologna", "Bolzano": "Bolzano", "Brescia": "Brescia", "Brindisi": "Brindisi", "Cagliari": "Cagliari", "Caltanissetta": "Caltanissetta", "Campobasso": "Campobasso", "Carbonia-Iglesias": "Carbonia-Iglesias", "Caserta": "Caserta", "Catania": "Catania", "Catanzaro": "Catanzaro", "Chieti": "Chieti", "Como": "Como", "Cosenza": "Cosenza", "Cremona": "Cremona", "Crotone": "Crotone", "Cuneo": "Cuneo", "Enna": "Enna", "Fermo": "Fermo", "Ferrara": "Ferrara", "Firenze": "Firenze", "Foggia": "Foggia", "Forlì-Cesena": "Forlì-Cesena", "Frosinone": "Frosinone", "Genova": "Genova", "Gorizia": "Gorizia", "Grosseto": "Grosseto", "Imperia": "Imperia", "Isernia": "Isernia", "L'Aquila": "L'Aquila", "La Spezia": "La Spezia", "Latina": "Latina", "Lecce": "Lecce", "Lecco": "Lecco", "Livorno": "Livorno", "Lodi": "Lodi", "Lucca": "Lucca", "Macerata": "Macerata", "Mantova": "Mantova", "Massa-Carrara": "Massa-Carrara", "Matera": "Matera", "Medio Campidano": "Medio Campidano", "Messina": "Messina", "Milano": "Milano", "Modena": "Modena", "Monza e Brianza": "Monza e Brianza", "Napoli": "Napoli", "Novara": "Novara", "Nuoro": "Nuoro", "Ogliastra": "Ogliastra", "Olbia-Tempio": "Olbia-Tempio", "Oristano": "Oristano", "Padova": "Padova", "Palermo": "Palermo", "Parma": "Parma", "Pavia": "Pavia", "Perugia": "Perugia", "Pesaro e Urbino": "Pesaro e Urbino", "Pescara": "Pescara", "Piacenza": "Piacenza", "Pisa": "Pisa", "Pistoia": "Pistoia", "Pordenone": "Pordenone", "Potenza": "Potenza", "Prato": "Prato", "Ragusa": "Ragusa", "Ravenna": "Ravenna", "Reggio Calabria": "Reggio Calabria", "Reggio Emilia": "Reggio Emilia", "Rieti": "Rieti", "Rimini": "Rimini", "Roma": "Roma", "Rovigo": "Rovigo", "Salerno": "Salerno", "Sassari": "Sassari", "Savona": "Savona", "Siena": "Siena", "Siracusa": "Siracusa", "Sondrio": "Sondrio", "Taranto": "Taranto", "Teramo": "Teramo", "Terni": "Terni", "Torino": "Torino", "Trapani": "Trapani", "Trento": "Trento", "Treviso": "Treviso", "Trieste": "Trieste", "Udine": "Udine", "Varese": "Varese", "Venezia": "Venezia", "Verbano-Cusio-Ossola": "Verbano-Cusio-Ossola", "Vercelli": "Vercelli", "Verona": "Verona", "Vibo Valentia": "Vibo Valentia", "Vicenza": "Vicenza", "Viterbo": "Viterbo" }, "province_codes": { "Agrigento": "AG", "Alessandria": "AL", "Ancona": "AN", "Aosta": "AO", "Arezzo": "AR", "Ascoli Piceno": "AP", "Asti": "AT", "Avellino": "AV", "Bari": "BA", "Barletta-Andria-Trani": "BT", "Belluno": "BL", "Benevento": "BN", "Bergamo": "BG", "Biella": "BI", "Bologna": "BO", "Bolzano": "BZ", "Brescia": "BS", "Brindisi": "BR", "Cagliari": "CA", "Caltanissetta": "CL", "Campobasso": "CB", "Carbonia-Iglesias": "CI", "Caserta": "CE", "Catania": "CT", "Catanzaro": "CZ", "Chieti": "CH", "Como": "CO", "Cosenza": "CS", "Cremona": "CR", "Crotone": "KR", "Cuneo": "CN", "Enna": "EN", "Fermo": "FM", "Ferrara": "FE", "Firenze": "FI", "Foggia": "FG", "Forlì-Cesena": "FC", "Frosinone": "FR", "Genova": "GE", "Gorizia": "GO", "Grosseto": "GR", "Imperia": "IM", "Isernia": "IS", "La Spezia": "SP", "L'Aquila": "AQ", "Latina": "LT", "Lecce": "LE", "Lecco": "LC", "Livorno": "LI", "Lodi": "LO", "Lucca": "LU", "Macerata": "MC", "Mantova": "MN", "Massa-Carrara": "MS", "Matera": "MT", "Medio Campidano": "VS", "Messina": "ME", "Milano": "MI", "Modena": "MO", "Monza e Brianza": "MB", "Napoli": "NA", "Novara": "NO", "Nuoro": "NU", "Ogliastra": "OG", "Olbia-Tempio": "OT", "Oristano": "OR", "Padova": "PD", "Palermo": "PA", "Parma": "PR", "Pavia": "PV", "Perugia": "PG", "Pesaro e Urbino": "PU", "Pescara": "PE", "Piacenza": "PC", "Pisa": "PI", "Pistoia": "PT", "Pordenone": "PN", "Potenza": "PZ", "Prato": "PO", "Ragusa": "RG", "Ravenna": "RA", "Reggio Calabria": "RC", "Reggio Emilia": "RE", "Rieti": "RI", "Rimini": "RN", "Roma": "RM", "Rovigo": "RO", "Salerno": "SA", "Sassari": "SS", "Savona": "SV", "Siena": "SI", "Siracusa": "SR", "Sondrio": "SO", "Taranto": "TA", "Teramo": "TE", "Terni": "TR", "Torino": "TO", "Trapani": "TP", "Trento": "TN", "Treviso": "TV", "Trieste": "TS", "Udine": "UD", "Varese": "VA", "Venezia": "VE", "Verbano-Cusio-Ossola": "VB", "Vercelli": "VC", "Verona": "VR", "Vibo Valentia": "VV", "Vicenza": "VI", "Viterbo": "VT" }, "Code2": "IT", "Code3": "ITA" }, "Jamaica": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "JM", "Code3": "JAM" }, "Japan": { "label": "Prefecture", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": "japan_prefectures", "province_label": "Prefecture", "provinces": [ "Aichi", "Akita", "Aomori", "Chiba", "Ehime", "Fukui", "Fukuoka", "Fukushima", "Gifu", "Gunma", "Hiroshima", "Hokkaidō", "Hyōgo", "Ibaraki", "Ishikawa", "Iwate", "Kagawa", "Kagoshima", "Kanagawa", "Kōchi", "Kumamoto", "Kyōto", "Mie", "Miyagi", "Miyazaki", "Nagano", "Nagasaki", "Nara", "Niigata", "Ōita", "Okayama", "Okinawa", "Ōsaka", "Saga", "Saitama", "Shiga", "Shimane", "Shizuoka", "Tochigi", "Tokushima", "Tottori", "Toyama", "Tōkyō", "Wakayama", "Yamagata", "Yamaguchi", "Yamanashi" ], "province_labels": { "Aichi": "Aichi", "Akita": "Akita", "Aomori": "Aomori", "Chiba": "Chiba", "Ehime": "Ehime", "Fukui": "Fukui", "Fukuoka": "Fukuoka", "Fukushima": "Fukushima", "Gifu": "Gifu", "Gunma": "Gunma", "Hiroshima": "Hiroshima", "Hokkaidō": "Hokkaidō", "Hyōgo": "Hyōgo", "Ibaraki": "Ibaraki", "Ishikawa": "Ishikawa", "Iwate": "Iwate", "Kagawa": "Kagawa", "Kagoshima": "Kagoshima", "Kanagawa": "Kanagawa", "Kōchi": "Kōchi", "Kumamoto": "Kumamoto", "Kyōto": "Kyōto", "Mie": "Mie", "Miyagi": "Miyagi", "Miyazaki": "Miyazaki", "Nagano": "Nagano", "Nagasaki": "Nagasaki", "Nara": "Nara", "Niigata": "Niigata", "Ōita": "Ōita", "Okayama": "Okayama", "Okinawa": "Okinawa", "Ōsaka": "Ōsaka", "Saga": "Saga", "Saitama": "Saitama", "Shiga": "Shiga", "Shimane": "Shimane", "Shizuoka": "Shizuoka", "Tochigi": "Tochigi", "Tokushima": "Tokushima", "Tōkyō": "Tōkyō", "Tottori": "Tottori", "Toyama": "Toyama", "Wakayama": "Wakayama", "Yamagata": "Yamagata", "Yamaguchi": "Yamaguchi", "Yamanashi": "Yamanashi" }, "province_codes": { "Aichi": "JP-23", "Akita": "JP-05", "Aomori": "JP-02", "Chiba": "JP-12", "Ehime": "JP-38", "Fukui": "JP-18", "Fukuoka": "JP-40", "Fukushima": "JP-07", "Gifu": "JP-21", "Gunma": "JP-10", "Hiroshima": "JP-34", "Hokkaidō": "JP-01", "Hyōgo": "JP-28", "Ibaraki": "JP-08", "Ishikawa": "JP-17", "Iwate": "JP-03", "Kagawa": "JP-37", "Kagoshima": "JP-46", "Kanagawa": "JP-14", "Kōchi": "JP-39", "Kumamoto": "JP-43", "Kyōto": "JP-26", "Mie": "JP-24", "Miyagi": "JP-04", "Miyazaki": "JP-45", "Nagano": "JP-20", "Nagasaki": "JP-42", "Nara": "JP-29", "Niigata": "JP-15", "Ōita": "JP-44", "Okayama": "JP-33", "Okinawa": "JP-47", "Ōsaka": "JP-27", "Saga": "JP-41", "Saitama": "JP-11", "Shiga": "JP-25", "Shimane": "JP-32", "Shizuoka": "JP-22", "Tochigi": "JP-09", "Tokushima": "JP-36", "Tottori": "JP-31", "Toyama": "JP-16", "Tōkyō": "JP-13", "Wakayama": "JP-30", "Yamagata": "JP-06", "Yamaguchi": "JP-35", "Yamanashi": "JP-19" }, "Code2": "JP", "Code3": "JPN" }, "Jersey": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "JE", "Code3": "JEY" }, "Jordan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "JO", "Code3": "JOR" }, "Kazakhstan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KZ", "Code3": "KAZ" }, "Kenya": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KE", "Code3": "KEN" }, "Kosovo": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "XK", "Code3": "XKX" }, "Kuwait": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KW", "Code3": "KWT" }, "Kyrgyzstan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KG", "Code3": "KGZ" }, "Latvia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LV", "Code3": "LVA" }, "Lebanon": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LB", "Code3": "LBN" }, "Liberia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LR", "Code3": "LBR" }, "Liechtenstein": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LI", "Code3": "LIE" }, "Lithuania": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LT", "Code3": "LTU" }, "Luxembourg": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LU", "Code3": "LUX" }, "Macao": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MO", "Code3": "MAC" }, "Macedonia, Republic Of": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MK", "Code3": "MKD" }, "Madagascar": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MG", "Code3": "MDG" }, "Malaysia": { "label": "State/Territory", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State/Territory", "provinces": [ "Johor", "Kedah", "Kelantan", "Kuala Lumpur", "Labuan", "Melaka", "Negeri Sembilan", "Pahang", "Perak", "Perlis", "Pulau Pinang", "Putrajaya", "Sabah", "Sarawak", "Selangor", "Terengganu" ], "province_labels": { "Johor": "Johor", "Kedah": "Kedah", "Kelantan": "Kelantan", "Kuala Lumpur": "Kuala Lumpur", "Labuan": "Labuan", "Melaka": "Melaka", "Negeri Sembilan": "Negeri Sembilan", "Pahang": "Pahang", "Perak": "Perak", "Perlis": "Perlis", "Pulau Pinang": "Pulau Pinang", "Putrajaya": "Putrajaya", "Sabah": "Sabah", "Sarawak": "Sarawak", "Selangor": "Selangor", "Terengganu": "Terengganu" }, "province_codes": { "Johor": "JHR", "Kedah": "KDH", "Kelantan": "KTN", "Kuala Lumpur": "KUL", "Labuan": "LBN", "Melaka": "MLK", "Negeri Sembilan": "NSN", "Pahang": "PHG", "Perak": "PRK", "Perlis": "PLS", "Pulau Pinang": "PNG", "Putrajaya": "PJY", "Sabah": "SBH", "Sarawak": "SWK", "Selangor": "SGR", "Terengganu": "TRG" }, "Code2": "MY", "Code3": "MYS" }, "Maldives": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MV", "Code3": "MDV" }, "Malta": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MT", "Code3": "MLT" }, "Mauritius": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MU", "Code3": "MUS" }, "Mexico": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": [ "Aguascalientes", "Baja California", "Baja California Sur", "Chihuahua", "Colima", "Campeche", "Coahuila", "Chiapas", "Distrito Federal", "Durango", "Guerrero", "Guanajuato", "Hidalgo", "Jalisco", "Michoacán", "Morelos", "México", "Nayarit", "Nuevo León", "Oaxaca", "Puebla", "Quintana Roo", "Querétaro", "Sinaloa", "San Luis Potosí", "Sonora", "Tabasco", "Tlaxcala", "Tamaulipas", "Veracruz", "Yucatán", "Zacatecas" ], "province_labels": { "Aguascalientes": "Aguascalientes", "Baja California": "Baja California", "Baja California Sur": "Baja California Sur", "Campeche": "Campeche", "Chiapas": "Chiapas", "Chihuahua": "Chihuahua", "Coahuila": "Coahuila", "Colima": "Colima", "Distrito Federal": "Distrito Federal", "Durango": "Durango", "Guanajuato": "Guanajuato", "Guerrero": "Guerrero", "Hidalgo": "Hidalgo", "Jalisco": "Jalisco", "México": "México", "Michoacán": "Michoacán", "Morelos": "Morelos", "Nayarit": "Nayarit", "Nuevo León": "Nuevo León", "Oaxaca": "Oaxaca", "Puebla": "Puebla", "Querétaro": "Querétaro", "Quintana Roo": "Quintana Roo", "San Luis Potosí": "San Luis Potosí", "Sinaloa": "Sinaloa", "Sonora": "Sonora", "Tabasco": "Tabasco", "Tamaulipas": "Tamaulipas", "Tlaxcala": "Tlaxcala", "Veracruz": "Veracruz", "Yucatán": "Yucatán", "Zacatecas": "Zacatecas" }, "province_codes": { "Aguascalientes": "AGS", "Baja California": "BC", "Baja California Sur": "BCS", "Chihuahua": "CHIH", "Colima": "COL", "Campeche": "CAMP", "Coahuila": "COAH", "Chiapas": "CHIS", "Distrito Federal": "DF", "Durango": "DGO", "Guerrero": "GRO", "Guanajuato": "GTO", "Hidalgo": "HGO", "Jalisco": "JAL", "Michoacán": "MICH", "Morelos": "MOR", "México": "MEX", "Nayarit": "NAY", "Nuevo León": "NL", "Oaxaca": "OAx", "Puebla": "PUE", "Quintana Roo": "Q ROO", "Querétaro": "QRO", "Sinaloa": "SIN", "San Luis Potosí": "SLP", "Sonora": "SON", "Tabasco": "TAB", "Tlaxcala": "TLAX", "Tamaulipas": "TAMPS", "Veracruz": "VER", "Yucatán": "YUC", "Zacatecas": "ZAC" }, "Code2": "MX", "Code3": "MEX" }, "Moldova, Republic of": { "label": null, "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MD", "Code3": "MDA" }, "Monaco": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MC", "Code3": "MCO" }, "Mongolia": { "label": null, "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MN", "Code3": "MNG" }, "Montenegro": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ME", "Code3": "MNE" }, "Morocco": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MA", "Code3": "MAR" }, "Mozambique": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MZ", "Code3": "MOZ" }, "Myanmar": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MM", "Code3": "MMR" }, "Namibia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NA", "Code3": "NAM" }, "Nepal": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NP", "Code3": "NPL" }, "Netherlands Antilles": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AN", "Code3": "ANT" }, "Netherlands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NL", "Code3": "NLD" }, "New Zealand": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": [ "Auckland", "Bay of Plenty", "Canterbury", "Gisborne", "Hawke's Bay", "Manawatu-Wanganui", "Marlborough", "Nelson", "Northland", "Otago", "Southland", "Taranaki", "Tasman", "Waikato", "Wellington", "West Coast" ], "province_labels": { "Auckland": "Auckland", "Bay of Plenty": "Bay of Plenty", "Canterbury": "Canterbury", "Gisborne": "Gisborne", "Hawke's Bay": "Hawke's Bay", "Manawatu-Wanganui": "Manawatu-Wanganui", "Marlborough": "Marlborough", "Nelson": "Nelson", "Northland": "Northland", "Otago": "Otago", "Southland": "Southland", "Taranaki": "Taranaki", "Tasman": "Tasman", "Waikato": "Waikato", "Wellington": "Wellington", "West Coast": "West Coast" }, "province_codes": { "Auckland": "AUK", "Bay of Plenty": "BOP", "Canterbury": "CAN", "Gisborne": "GIS", "Hawke's Bay": "HKB", "Manawatu-Wanganui": "MWT", "Marlborough": "MBH", "Nelson": "NSN", "Northland": "NTL", "Otago": "OTA", "Southland": "STL", "Taranaki": "TKI", "Tasman": "TAS", "Waikato": "WKO", "Wellington": "WGN", "West Coast": "WTC" }, "Code2": "NZ", "Code3": "NZL" }, "Nicaragua": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NI", "Code3": "NIC" }, "Niger": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NE", "Code3": "NER" }, "Nigeria": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NG", "Code3": "NGA" }, "Norway": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NO", "Code3": "NOR" }, "Oman": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "OM", "Code3": "OMN" }, "Pakistan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PK", "Code3": "PAK" }, "Palestinian Territory, Occupied": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PS", "Code3": "PSE" }, "Panama": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PA", "Code3": "PAN" }, "Papua New Guinea": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PG", "Code3": "PNG" }, "Paraguay": { "label": null, "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PY", "Code3": "PRY" }, "Peru": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PE", "Code3": "PER" }, "Philippines": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PH", "Code3": "PHL" }, "Poland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PL", "Code3": "POL" }, "Portugal": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": [ "Aveiro", "Beja", "Braga", "Bragança", "Castelo Branco", "Coimbra", "Évora", "Faro", "Guarda", "Leiria", "Lisboa", "Portalegre", "Porto", "Santarém", "Setúbal", "Viana do Castelo", "Vila Real", "Viseu", "Açores", "Madeira" ], "province_labels": { "Açores": "Açores", "Aveiro": "Aveiro", "Beja": "Beja", "Braga": "Braga", "Bragança": "Bragança", "Castelo Branco": "Castelo Branco", "Coimbra": "Coimbra", "Évora": "Évora", "Faro": "Faro", "Guarda": "Guarda", "Leiria": "Leiria", "Lisboa": "Lisboa", "Madeira": "Madeira", "Portalegre": "Portalegre", "Porto": "Porto", "Santarém": "Santarém", "Setúbal": "Setúbal", "Viana do Castelo": "Viana do Castelo", "Vila Real": "Vila Real", "Viseu": "Viseu" }, "province_codes": { "Aveiro": "PT-01", "Beja": "PT-02", "Braga": "PT-03", "Bragança": "PT-04", "Castelo Branco": "PT-05", "Coimbra": "PT-06", "Évora": "PT-07", "Faro": "PT-08", "Guarda": "PT-09", "Leiria": "PT-10", "Lisboa": "PT-11", "Portalegre": "PT-12", "Porto": "PT-13", "Santarém": "PT-14", "Setúbal": "PT-15", "Viana do Castelo": "PT-16", "Vila Real": "PT-17", "Viseu": "PT-18", "Açores": "PT-20", "Madeira": "PT-30" }, "Code2": "PT", "Code3": "PRT" }, "Qatar": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "QA", "Code3": "QAT" }, "Reunion": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "RE", "Code3": "REU" }, "Romania": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "RO", "Code3": "ROU" }, "Russia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": [ "Republic of Adygeya", "Altai Republic", "Altai Krai", "Amur Oblast", "Arkhangelsk Oblast", "Astrakhan Oblast", "Republic of Bashkortostan", "Belgorod Oblast", "Bryansk Oblast", "Republic of Buryatia", "Chechen Republic", "Chelyabinsk Oblast", "Chukotka Autonomous Okrug", "Chuvash Republic", "Republic of Dagestan", "Republic of Ingushetia", "Irkutsk Oblast", "Ivanovo Oblast", "Kamchatka Krai", "Kabardino-Balkarian Republic", "Kaliningrad Oblast", "Republic of Kalmykia", "Kaluga Oblast", "Karachay–Cherkess Republic", "Republic of Karelia", "Kemerovo Oblast", "Khabarovsk Krai", "Republic of Khakassia", "Khanty-Mansi Autonomous Okrug", "Kirov Oblast", "Komi Republic", "Kostroma Oblast", "Krasnodar Krai", "Krasnoyarsk Krai", "Kurgan Oblast", "Kursk Oblast", "Leningrad Oblast", "Lipetsk Oblast", "Magadan Oblast", "Mari El Republic", "Republic of Mordovia", "Moscow Oblast", "Moscow", "Murmansk Oblast", "Nizhny Novgorod Oblast", "Novgorod Oblast", "Novosibirsk Oblast", "Omsk Oblast", "Orenburg Oblast", "Oryol Oblast", "Penza Oblast", "Perm Krai", "Primorsky Krai", "Pskov Oblast", "Rostov Oblast", "Ryazan Oblast", "Sakha Republic (Yakutia)", "Sakhalin Oblast", "Samara Oblast", "Saint Petersburg", "Saratov Oblast", "Republic of North Ossetia–Alania", "Smolensk Oblast", "Stavropol Krai", "Sverdlovsk Oblast", "Tambov Oblast", "Republic of Tatarstan", "Tomsk Oblast", "Tula Oblast", "Tver Oblast", "Tyumen Oblast", "Tyva Republic", "Udmurtia", "Ulyanovsk Oblast", "Vladimir Oblast", "Volgograd Oblast", "Vologda Oblast", "Voronezh Oblast", "Yamalo-Nenets Autonomous Okrug", "Yaroslavl Oblast", "Jewish Autonomous Oblast" ], "province_labels": { "Altai Krai": "Altai Krai", "Altai Republic": "Altai Republic", "Amur Oblast": "Amur Oblast", "Arkhangelsk Oblast": "Arkhangelsk Oblast", "Astrakhan Oblast": "Astrakhan Oblast", "Belgorod Oblast": "Belgorod Oblast", "Bryansk Oblast": "Bryansk Oblast", "Chechen Republic": "Chechen Republic", "Chelyabinsk Oblast": "Chelyabinsk Oblast", "Chukotka Autonomous Okrug": "Chukotka Autonomous Okrug", "Chuvash Republic": "Chuvash Republic", "Irkutsk Oblast": "Irkutsk Oblast", "Ivanovo Oblast": "Ivanovo Oblast", "Jewish Autonomous Oblast": "Jewish Autonomous Oblast", "Kabardino-Balkarian Republic": "Kabardino-Balkarian Republic", "Kaliningrad Oblast": "Kaliningrad Oblast", "Kaluga Oblast": "Kaluga Oblast", "Kamchatka Krai": "Kamchatka Krai", "Karachay–Cherkess Republic": "Karachay–Cherkess Republic", "Kemerovo Oblast": "Kemerovo Oblast", "Khabarovsk Krai": "Khabarovsk Krai", "Khanty-Mansi Autonomous Okrug": "Khanty-Mansi Autonomous Okrug", "Kirov Oblast": "Kirov Oblast", "Komi Republic": "Komi Republic", "Kostroma Oblast": "Kostroma Oblast", "Krasnodar Krai": "Krasnodar Krai", "Krasnoyarsk Krai": "Krasnoyarsk Krai", "Kurgan Oblast": "Kurgan Oblast", "Kursk Oblast": "Kursk Oblast", "Leningrad Oblast": "Leningrad Oblast", "Lipetsk Oblast": "Lipetsk Oblast", "Magadan Oblast": "Magadan Oblast", "Mari El Republic": "Mari El Republic", "Moscow": "Moscow", "Moscow Oblast": "Moscow Oblast", "Murmansk Oblast": "Murmansk Oblast", "Nizhny Novgorod Oblast": "Nizhny Novgorod Oblast", "Novgorod Oblast": "Novgorod Oblast", "Novosibirsk Oblast": "Novosibirsk Oblast", "Omsk Oblast": "Omsk Oblast", "Orenburg Oblast": "Orenburg Oblast", "Oryol Oblast": "Oryol Oblast", "Penza Oblast": "Penza Oblast", "Perm Krai": "Perm Krai", "Primorsky Krai": "Primorsky Krai", "Pskov Oblast": "Pskov Oblast", "Republic of Adygeya": "Republic of Adygeya", "Republic of Bashkortostan": "Republic of Bashkortostan", "Republic of Buryatia": "Republic of Buryatia", "Republic of Dagestan": "Republic of Dagestan", "Republic of Ingushetia": "Republic of Ingushetia", "Republic of Kalmykia": "Republic of Kalmykia", "Republic of Karelia": "Republic of Karelia", "Republic of Khakassia": "Republic of Khakassia", "Republic of Mordovia": "Republic of Mordovia", "Republic of North Ossetia–Alania": "Republic of North Ossetia–Alania", "Republic of Tatarstan": "Republic of Tatarstan", "Rostov Oblast": "Rostov Oblast", "Ryazan Oblast": "Ryazan Oblast", "Saint Petersburg": "Saint Petersburg", "Sakha Republic (Yakutia)": "Sakha Republic (Yakutia)", "Sakhalin Oblast": "Sakhalin Oblast", "Samara Oblast": "Samara Oblast", "Saratov Oblast": "Saratov Oblast", "Smolensk Oblast": "Smolensk Oblast", "Stavropol Krai": "Stavropol Krai", "Sverdlovsk Oblast": "Sverdlovsk Oblast", "Tambov Oblast": "Tambov Oblast", "Tomsk Oblast": "Tomsk Oblast", "Tula Oblast": "Tula Oblast", "Tver Oblast": "Tver Oblast", "Tyumen Oblast": "Tyumen Oblast", "Tyva Republic": "Tyva Republic", "Udmurtia": "Udmurtia", "Ulyanovsk Oblast": "Ulyanovsk Oblast", "Vladimir Oblast": "Vladimir Oblast", "Volgograd Oblast": "Volgograd Oblast", "Vologda Oblast": "Vologda Oblast", "Voronezh Oblast": "Voronezh Oblast", "Yamalo-Nenets Autonomous Okrug": "Yamalo-Nenets Autonomous Okrug", "Yaroslavl Oblast": "Yaroslavl Oblast" }, "province_codes": { "Republic of Adygeya": "AD", "Altai Republic": "AL", "Altai Krai": "ALT", "Amur Oblast": "AMU", "Arkhangelsk Oblast": "ARK", "Astrakhan Oblast": "AST", "Republic of Bashkortostan": "BA", "Belgorod Oblast": "BEL", "Bryansk Oblast": "BRY", "Republic of Buryatia": "BU", "Chechen Republic": "CE", "Chelyabinsk Oblast": "CHE", "Chukotka Autonomous Okrug": "CHU", "Chuvash Republic": "CU", "Republic of Dagestan": "DA", "Republic of Ingushetia": "IN", "Irkutsk Oblast": "IRK", "Ivanovo Oblast": "IVA", "Kamchatka Krai": "KAM", "Kabardino-Balkarian Republic": "KB", "Kaliningrad Oblast": "KGD", "Republic of Kalmykia": "KL", "Kaluga Oblast": "KLU", "Karachay–Cherkess Republic": "KC", "Republic of Karelia": "KR", "Kemerovo Oblast": "KEM", "Khabarovsk Krai": "KHA", "Republic of Khakassia": "KK", "Khanty-Mansi Autonomous Okrug": "KHM", "Kirov Oblast": "KIR", "Komi Republic": "KO", "Kostroma Oblast": "KOS", "Krasnodar Krai": "KDA", "Krasnoyarsk Krai": "KYA", "Kurgan Oblast": "KGN", "Kursk Oblast": "KRS", "Leningrad Oblast": "LEN", "Lipetsk Oblast": "LIP", "Magadan Oblast": "MAG", "Mari El Republic": "ME", "Republic of Mordovia": "MO", "Moscow Oblast": "MOS", "Moscow": "MOW", "Murmansk Oblast": "MUR", "Nizhny Novgorod Oblast": "NIZ", "Novgorod Oblast": "NGR", "Novosibirsk Oblast": "NVS", "Omsk Oblast": "OMS", "Orenburg Oblast": "ORE", "Oryol Oblast": "ORL", "Penza Oblast": "PNZ", "Perm Krai": "PER", "Primorsky Krai": "PRI", "Pskov Oblast": "PSK", "Rostov Oblast": "ROS", "Ryazan Oblast": "RYA", "Sakha Republic (Yakutia)": "SA", "Sakhalin Oblast": "SAK", "Samara Oblast": "SAM", "Saint Petersburg": "SPE", "Saratov Oblast": "SAR", "Republic of North Ossetia–Alania": "SE", "Smolensk Oblast": "SMO", "Stavropol Krai": "STA", "Sverdlovsk Oblast": "SVE", "Tambov Oblast": "TAM", "Republic of Tatarstan": "TA", "Tomsk Oblast": "TOM", "Tula Oblast": "TUL", "Tver Oblast": "TVE", "Tyumen Oblast": "TYU", "Tyva Republic": "TY", "Udmurtia": "UD", "Ulyanovsk Oblast": "ULY", "Vladimir Oblast": "VLA", "Volgograd Oblast": "VGG", "Vologda Oblast": "VLG", "Voronezh Oblast": "VOR", "Yamalo-Nenets Autonomous Okrug": "YAN", "Yaroslavl Oblast": "YAR", "Jewish Autonomous Oblast": "YEV" }, "Code2": "RU", "Code3": "RUS" }, "Rwanda": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "RW", "Code3": "RWA" }, "Saint Kitts And Nevis": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KN", "Code3": "KNA" }, "Saint Lucia": { "label": null, "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LC", "Code3": "LCA" }, "Saint Martin": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MF", "Code3": "MAF" }, "Sao Tome And Principe": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ST", "Code3": "STP" }, "Samoa": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "WS", "Code3": "WSM" }, "Saudi Arabia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SA", "Code3": "SAU" }, "Senegal": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SN", "Code3": "SEN" }, "Serbia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "RS", "Code3": "SRB" }, "Seychelles": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SC", "Code3": "SYC" }, "Singapore": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SG", "Code3": "SGP" }, "Sint Maarten": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SX", "Code3": "SXM" }, "Slovakia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SK", "Code3": "SVK" }, "Slovenia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SI", "Code3": "SVN" }, "South Africa": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "Eastern Cape", "Free State", "Gauteng", "KwaZulu-Natal", "Limpopo", "Mpumalanga", "Northern Cape", "North West", "Western Cape" ], "province_labels": { "Eastern Cape": "Eastern Cape", "Free State": "Free State", "Gauteng": "Gauteng", "KwaZulu-Natal": "KwaZulu-Natal", "Limpopo": "Limpopo", "Mpumalanga": "Mpumalanga", "North West": "North West", "Northern Cape": "Northern Cape", "Western Cape": "Western Cape" }, "province_codes": { "Eastern Cape": "EC", "Free State": "FS", "Gauteng": "GT", "KwaZulu-Natal": "NL", "Limpopo": "LP", "Mpumalanga": "MP", "Northern Cape": "NC", "North West": "NW", "Western Cape": "WC" }, "Code2": "ZA", "Code3": "ZAF" }, "South Korea": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KR", "Code3": "KOR" }, "Spain": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": [ "A Coruña", "Álava", "Albacete", "Alicante", "Almería", "Asturias", "Ávila", "Badajoz", "Balears", "Barcelona", "Burgos", "Cáceres", "Cádiz", "Cantabria", "Castellón", "Ceuta", "Ciudad Real", "Córdoba", "Cuenca", "Girona", "Granada", "Guadalajara", "Guipúzcoa", "Huelva", "Huesca", "Jaén", "La Rioja", "Las Palmas", "León", "Lleida", "Lugo", "Madrid", "Málaga", "Melilla", "Murcia", "Navarra", "Ourense", "Palencia", "Pontevedra", "Salamanca", "Santa Cruz de Tenerife", "Segovia", "Sevilla", "Soria", "Tarragona", "Teruel", "Toledo", "Valencia", "Valladolid", "Vizcaya", "Zamora", "Zaragoza" ], "province_labels": { "A Coruña": "A Coruña", "Álava": "Álava", "Albacete": "Albacete", "Alicante": "Alicante", "Almería": "Almería", "Asturias": "Asturias", "Ávila": "Ávila", "Badajoz": "Badajoz", "Balears": "Balears", "Barcelona": "Barcelona", "Burgos": "Burgos", "Cáceres": "Cáceres", "Cádiz": "Cádiz", "Cantabria": "Cantabria", "Castellón": "Castellón", "Ceuta": "Ceuta", "Ciudad Real": "Ciudad Real", "Córdoba": "Córdoba", "Cuenca": "Cuenca", "Girona": "Girona", "Granada": "Granada", "Guadalajara": "Guadalajara", "Guipúzcoa": "Guipúzcoa", "Huelva": "Huelva", "Huesca": "Huesca", "Jaén": "Jaén", "La Rioja": "La Rioja", "Las Palmas": "Las Palmas", "León": "León", "Lleida": "Lleida", "Lugo": "Lugo", "Madrid": "Madrid", "Málaga": "Málaga", "Melilla": "Melilla", "Murcia": "Murcia", "Navarra": "Navarra", "Ourense": "Ourense", "Palencia": "Palencia", "Pontevedra": "Pontevedra", "Salamanca": "Salamanca", "Santa Cruz de Tenerife": "Santa Cruz de Tenerife", "Segovia": "Segovia", "Sevilla": "Sevilla", "Soria": "Soria", "Tarragona": "Tarragona", "Teruel": "Teruel", "Toledo": "Toledo", "Valencia": "Valencia", "Valladolid": "Valladolid", "Vizcaya": "Vizcaya", "Zamora": "Zamora", "Zaragoza": "Zaragoza" }, "province_codes": { "A Coruña": "C", "Álava": "VI", "Albacete": "AB", "Alicante": "A", "Almería": "AL", "Asturias": "O", "Ávila": "AV", "Badajoz": "BA", "Balears": "PM", "Barcelona": "B", "Burgos": "BU", "Cáceres": "CC", "Cádiz": "CA", "Cantabria": "S", "Castellón": "CS", "Ceuta": "CE", "Ciudad Real": "CR", "Córdoba": "CO", "Cuenca": "CU", "Girona": "GI", "Granada": "GR", "Guadalajara": "GU", "Guipúzcoa": "SS", "Huelva": "H", "Huesca": "HU", "Jaén": "J", "La Rioja": "LO", "Las Palmas": "GC", "León": "LE", "Lleida": "L", "Lugo": "LU", "Madrid": "M", "Málaga": "MA", "Melilla": "ML", "Murcia": "MU", "Navarra": "NA", "Ourense": "OR", "Palencia": "P", "Pontevedra": "PO", "Salamanca": "SA", "Santa Cruz de Tenerife": "TF", "Segovia": "SG", "Sevilla": "SE", "Soria": "SO", "Tarragona": "T", "Teruel": "TE", "Toledo": "TO", "Valencia": "V", "Valladolid": "VA", "Vizcaya": "BI", "Zamora": "ZA", "Zaragoza": "Z" }, "Code2": "ES", "Code3": "ESP" }, "Sri Lanka": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LK", "Code3": "LKA" }, "St. Vincent": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VC", "Code3": "VCT" }, "Suriname": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SR", "Code3": "SUR" }, "Sweden": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SE", "Code3": "SWE" }, "Switzerland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CH", "Code3": "CHE" }, "Syria": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SY", "Code3": "SYR" }, "Taiwan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TW", "Code3": "TWN" }, "Thailand": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TH", "Code3": "THA" }, "Tanzania, United Republic Of": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TZ", "Code3": "TZA" }, "Trinidad and Tobago": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TT", "Code3": "TTO" }, "Tunisia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TN", "Code3": "TUN" }, "Turkey": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TR", "Code3": "TUR" }, "Turkmenistan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TM", "Code3": "TKM" }, "Turks and Caicos Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TC", "Code3": "TCA" }, "Uganda": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "UG", "Code3": "UGA" }, "Ukraine": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "UA", "Code3": "UKR" }, "United Arab Emirates": { "label": "Emirate", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": [ "Abu Dhabi", "Ajman", "Dubai", "Fujairah", "Ras al-Khaimah", "Sharjah", "Umm al-Quwain" ], "province_labels": { "Abu Dhabi": "Abu Dhabi", "Ajman": "Ajman", "Dubai": "Dubai", "Fujairah": "Fujairah", "Ras al-Khaimah": "Ras al-Khaimah", "Sharjah": "Sharjah", "Umm al-Quwain": "Umm al-Quwain" }, "province_codes": { "Abu Dhabi": "AZ", "Ajman": "AJ", "Dubai": "DU", "Fujairah": "FU", "Ras al-Khaimah": "RK", "Sharjah": "SH", "Umm al-Quwain": "UQ" }, "Code2": "AE", "Code3": "ARE" }, "Uruguay": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "UY", "Code3": "URY" }, "Uzbekistan": { "label": "Province", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Province", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "UZ", "Code3": "UZB" }, "Vanuatu": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VU", "Code3": "VUT" }, "Venezuela": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VE", "Code3": "VEN" }, "Vietnam": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VN", "Code3": "VNM" }, "Virgin Islands, British": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VG", "Code3": "VGB" }, "Yemen": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "YE", "Code3": "YEM" }, "Zambia": { "label": null, "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ZM", "Code3": "ZMB" }, "Zimbabwe": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ZW", "Code3": "ZWE" }, "Afghanistan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AF", "Code3": "AFG" }, "Aland Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AL", "Code3": "ALA" }, "Anguilla": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "AI", "Code3": "AIA" }, "Benin": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BJ", "Code3": "BEN" }, "Bouvet Island": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BV", "Code3": "BVT" }, "British Indian Ocean Territory": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IO", "Code3": "IOT" }, "Burkina Faso": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BF", "Code3": "BFA" }, "Burundi": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BI", "Code3": "BDI" }, "Cape Verde": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CP", "Code3": "CPV" }, "Central African Republic": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CF", "Code3": "CAF" }, "Chad": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TD", "Code3": "TCD" }, "Christmas Island": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CX", "Code3": "CXR" }, "Cocos (Keeling) Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CC", "Code3": "CCK" }, "Congo, The Democratic Republic Of The": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CO", "Code3": "COD" }, "Cook Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CK", "Code3": "COK" }, "Cuba": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "CU", "Code3": "CUB" }, "Djibouti": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "DJ", "Code3": "DJI" }, "Equatorial Guinea": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GQ", "Code3": "GNQ" }, "Eritrea": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ER", "Code3": "ERI" }, "Falkland Islands (Malvinas)": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "FK", "Code3": "FLK" }, "French Guiana": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GF", "Code3": "GUF" }, "French Southern Territories": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TF", "Code3": "ATF" }, "Gabon": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GA", "Code3": "GAB" }, "Guinea": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GN", "Code3": "GIN" }, "Guinea Bissau": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GW", "Code3": "GNB" }, "Heard Island And Mcdonald Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "HM", "Code3": "HMD" }, "Holy See (Vatican City State)": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "VA", "Code3": "VAT" }, "Iran, Islamic Republic Of": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IR", "Code3": "IRN" }, "Iraq": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "IQ", "Code3": "IRQ" }, "Kiribati": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KI", "Code3": "KIR" }, "Korea, Democratic People's Republic Of": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "KP", "Code3": "PRK" }, "Lao People's Democratic Republic": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LA", "Code3": "LAO" }, "Lesotho": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LS", "Code3": "LSO" }, "Libyan Arab Jamahiriya": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "LY", "Code3": "LBY" }, "Malawi": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MW", "Code3": "MWI" }, "Mali": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "ML", "Code3": "MLI" }, "Martinique": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MQ", "Code3": "MTQ" }, "Mauritania": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MR", "Code3": "MRT" }, "Mayotte": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "YT", "Code3": "MYT" }, "Montserrat": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "MS", "Code3": "MSR" }, "Nauru": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NR", "Code3": "NRU" }, "New Caledonia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NC", "Code3": "NCL" }, "Niue": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NU", "Code3": "NIU" }, "Norfolk Island": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "NF", "Code3": "NFK" }, "Pitcairn": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PN", "Code3": "PCN" }, "Saint Barthélemy": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "BL", "Code3": "BLM" }, "Saint Helena": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SH", "Code3": "SHN" }, "Saint Pierre And Miquelon": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "PM", "Code3": "SPM" }, "San Marino": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SM", "Code3": "SMR" }, "Sierra Leone": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SL", "Code3": "SLE" }, "Solomon Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SB", "Code3": "SLB" }, "Somalia": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SO", "Code3": "SOM" }, "South Georgia And The South Sandwich Islands": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "GS", "Code3": "SGS" }, "Sudan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SD", "Code3": "SDN" }, "Svalbard And Jan Mayen": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SJ", "Code3": "SJM" }, "Swaziland": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "SZ", "Code3": "SWZ" }, "Tajikistan": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TJ", "Code3": "TJK" }, "Timor Leste": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TL", "Code3": "TLS" }, "Togo": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TG", "Code3": "TGO" }, "Tokelau": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TK", "Code3": "TKL" }, "Tonga": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TO", "Code3": "TON" }, "Tuvalu": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": false, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "TV", "Code3": "TUV" }, "United States Minor Outlying Islands": { "label": "State", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "State", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "UM", "Code3": "UMI" }, "Wallis And Futuna": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "WF", "Code3": "WLF" }, "Western Sahara": { "label": "Region", "zip_label": "Postal code", "zip_placeholder": "Postal code", "zip_required": true, "provinces_beta": null, "province_label": "Region", "provinces": null, "province_labels": null, "province_codes": {}, "Code2": "EH", "Code3": "ESH" } } ================================================ FILE: VirtoCommerce.Storefront/wwwroot/css/site.css ================================================ html { height: 100%; width: 100%; } body { background: #00abec } #feature { width: 960px; margin: 95px auto 0 auto; overflow: auto; } #content { font-family: "Segoe UI", sans-serif; font-weight: normal; font-size: 26px; color: #ffffff; float: left; width: 460px; margin-top: 68px; margin-left: 0px; vertical-align: middle; } #content h1 { font-family: "Segoe UI Light", sans-serif; color: #ffffff; font-weight: normal; font-size: 70px; line-height: 48pt; width: 800px; padding-bottom: 15px; } p a, p a:visited, p a:active, p a:hover { color: #ffffff; } #content a.button { background: #0DBCF2; border: 1px solid #FFFFFF; color: #FFFFFF; display: inline-block; font-family: Segoe UI, sans-serif; font-size: 24px; line-height: 46px; margin-top: 10px; padding: 0 15px 3px; text-decoration: none; } #content a.button img { float: right; padding: 10px 0 0 15px; } #content a.button:hover { background: #1C75BC; } ================================================ FILE: VirtoCommerce.Storefront/wwwroot/js/site.js ================================================ // Write your JavaScript code. ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/.bower.json ================================================ { "name": "bootstrap", "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", "keywords": [ "css", "js", "less", "mobile-first", "responsive", "front-end", "framework", "web" ], "homepage": "http://getbootstrap.com", "license": "MIT", "moduleType": "globals", "main": [ "less/bootstrap.less", "dist/js/bootstrap.js" ], "ignore": [ "/.*", "_config.yml", "CNAME", "composer.json", "CONTRIBUTING.md", "docs", "js/tests", "test-infra" ], "dependencies": { "jquery": "1.9.1 - 3" }, "version": "3.3.7", "_release": "3.3.7", "_resolution": { "type": "version", "tag": "v3.3.7", "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" }, "_source": "https://github.com/twbs/bootstrap.git", "_target": "v3.3.7", "_originalSource": "bootstrap", "_direct": true } ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2011-2016 Twitter, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/dist/css/bootstrap-theme.css ================================================ /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ .btn-default, .btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger { text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); } .btn-default:active, .btn-primary:active, .btn-success:active, .btn-info:active, .btn-warning:active, .btn-danger:active, .btn-default.active, .btn-primary.active, .btn-success.active, .btn-info.active, .btn-warning.active, .btn-danger.active { -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); } .btn-default.disabled, .btn-primary.disabled, .btn-success.disabled, .btn-info.disabled, .btn-warning.disabled, .btn-danger.disabled, .btn-default[disabled], .btn-primary[disabled], .btn-success[disabled], .btn-info[disabled], .btn-warning[disabled], .btn-danger[disabled], fieldset[disabled] .btn-default, fieldset[disabled] .btn-primary, fieldset[disabled] .btn-success, fieldset[disabled] .btn-info, fieldset[disabled] .btn-warning, fieldset[disabled] .btn-danger { -webkit-box-shadow: none; box-shadow: none; } .btn-default .badge, .btn-primary .badge, .btn-success .badge, .btn-info .badge, .btn-warning .badge, .btn-danger .badge { text-shadow: none; } .btn:active, .btn.active { background-image: none; } .btn-default { text-shadow: 0 1px 0 #fff; background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0)); background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #dbdbdb; border-color: #ccc; } .btn-default:hover, .btn-default:focus { background-color: #e0e0e0; background-position: 0 -15px; } .btn-default:active, .btn-default.active { background-color: #e0e0e0; border-color: #dbdbdb; } .btn-default.disabled, .btn-default[disabled], fieldset[disabled] .btn-default, .btn-default.disabled:hover, .btn-default[disabled]:hover, fieldset[disabled] .btn-default:hover, .btn-default.disabled:focus, .btn-default[disabled]:focus, fieldset[disabled] .btn-default:focus, .btn-default.disabled.focus, .btn-default[disabled].focus, fieldset[disabled] .btn-default.focus, .btn-default.disabled:active, .btn-default[disabled]:active, fieldset[disabled] .btn-default:active, .btn-default.disabled.active, .btn-default[disabled].active, fieldset[disabled] .btn-default.active { background-color: #e0e0e0; background-image: none; } .btn-primary { background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88)); background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #245580; } .btn-primary:hover, .btn-primary:focus { background-color: #265a88; background-position: 0 -15px; } .btn-primary:active, .btn-primary.active { background-color: #265a88; border-color: #245580; } .btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary.focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active { background-color: #265a88; background-image: none; } .btn-success { background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641)); background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #3e8f3e; } .btn-success:hover, .btn-success:focus { background-color: #419641; background-position: 0 -15px; } .btn-success:active, .btn-success.active { background-color: #419641; border-color: #3e8f3e; } .btn-success.disabled, .btn-success[disabled], fieldset[disabled] .btn-success, .btn-success.disabled:hover, .btn-success[disabled]:hover, fieldset[disabled] .btn-success:hover, .btn-success.disabled:focus, .btn-success[disabled]:focus, fieldset[disabled] .btn-success:focus, .btn-success.disabled.focus, .btn-success[disabled].focus, fieldset[disabled] .btn-success.focus, .btn-success.disabled:active, .btn-success[disabled]:active, fieldset[disabled] .btn-success:active, .btn-success.disabled.active, .btn-success[disabled].active, fieldset[disabled] .btn-success.active { background-color: #419641; background-image: none; } .btn-info { background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2)); background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #28a4c9; } .btn-info:hover, .btn-info:focus { background-color: #2aabd2; background-position: 0 -15px; } .btn-info:active, .btn-info.active { background-color: #2aabd2; border-color: #28a4c9; } .btn-info.disabled, .btn-info[disabled], fieldset[disabled] .btn-info, .btn-info.disabled:hover, .btn-info[disabled]:hover, fieldset[disabled] .btn-info:hover, .btn-info.disabled:focus, .btn-info[disabled]:focus, fieldset[disabled] .btn-info:focus, .btn-info.disabled.focus, .btn-info[disabled].focus, fieldset[disabled] .btn-info.focus, .btn-info.disabled:active, .btn-info[disabled]:active, fieldset[disabled] .btn-info:active, .btn-info.disabled.active, .btn-info[disabled].active, fieldset[disabled] .btn-info.active { background-color: #2aabd2; background-image: none; } .btn-warning { background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316)); background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #e38d13; } .btn-warning:hover, .btn-warning:focus { background-color: #eb9316; background-position: 0 -15px; } .btn-warning:active, .btn-warning.active { background-color: #eb9316; border-color: #e38d13; } .btn-warning.disabled, .btn-warning[disabled], fieldset[disabled] .btn-warning, .btn-warning.disabled:hover, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning:hover, .btn-warning.disabled:focus, .btn-warning[disabled]:focus, fieldset[disabled] .btn-warning:focus, .btn-warning.disabled.focus, .btn-warning[disabled].focus, fieldset[disabled] .btn-warning.focus, .btn-warning.disabled:active, .btn-warning[disabled]:active, fieldset[disabled] .btn-warning:active, .btn-warning.disabled.active, .btn-warning[disabled].active, fieldset[disabled] .btn-warning.active { background-color: #eb9316; background-image: none; } .btn-danger { background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a)); background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-color: #b92c28; } .btn-danger:hover, .btn-danger:focus { background-color: #c12e2a; background-position: 0 -15px; } .btn-danger:active, .btn-danger.active { background-color: #c12e2a; border-color: #b92c28; } .btn-danger.disabled, .btn-danger[disabled], fieldset[disabled] .btn-danger, .btn-danger.disabled:hover, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger:hover, .btn-danger.disabled:focus, .btn-danger[disabled]:focus, fieldset[disabled] .btn-danger:focus, .btn-danger.disabled.focus, .btn-danger[disabled].focus, fieldset[disabled] .btn-danger.focus, .btn-danger.disabled:active, .btn-danger[disabled]:active, fieldset[disabled] .btn-danger:active, .btn-danger.disabled.active, .btn-danger[disabled].active, fieldset[disabled] .btn-danger.active { background-color: #c12e2a; background-image: none; } .thumbnail, .img-thumbnail { -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); box-shadow: 0 1px 2px rgba(0, 0, 0, .075); } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { background-color: #e8e8e8; background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); background-repeat: repeat-x; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { background-color: #2e6da4; background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); background-repeat: repeat-x; } .navbar-default { background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%); background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8)); background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-radius: 4px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); } .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .active > a { background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2)); background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0); background-repeat: repeat-x; -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); } .navbar-brand, .navbar-nav > li > a { text-shadow: 0 1px 0 rgba(255, 255, 255, .25); } .navbar-inverse { background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%); background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222)); background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); background-repeat: repeat-x; border-radius: 4px; } .navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .active > a { background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%); background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f)); background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0); background-repeat: repeat-x; -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); } .navbar-inverse .navbar-brand, .navbar-inverse .navbar-nav > li > a { text-shadow: 0 -1px 0 rgba(0, 0, 0, .25); } .navbar-static-top, .navbar-fixed-top, .navbar-fixed-bottom { border-radius: 0; } @media (max-width: 767px) { .navbar .navbar-nav .open .dropdown-menu > .active > a, .navbar .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar .navbar-nav .open .dropdown-menu > .active > a:focus { color: #fff; background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); background-repeat: repeat-x; } } .alert { text-shadow: 0 1px 0 rgba(255, 255, 255, .2); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); } .alert-success { background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc)); background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); background-repeat: repeat-x; border-color: #b2dba1; } .alert-info { background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0)); background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); background-repeat: repeat-x; border-color: #9acfea; } .alert-warning { background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0)); background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); background-repeat: repeat-x; border-color: #f5e79e; } .alert-danger { background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3)); background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); background-repeat: repeat-x; border-color: #dca7a7; } .progress { background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5)); background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); background-repeat: repeat-x; } .progress-bar { background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090)); background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0); background-repeat: repeat-x; } .progress-bar-success { background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44)); background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); background-repeat: repeat-x; } .progress-bar-info { background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5)); background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); background-repeat: repeat-x; } .progress-bar-warning { background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f)); background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); background-repeat: repeat-x; } .progress-bar-danger { background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c)); background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); background-repeat: repeat-x; } .progress-bar-striped { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); } .list-group { border-radius: 4px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); box-shadow: 0 1px 2px rgba(0, 0, 0, .075); } .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { text-shadow: 0 -1px 0 #286090; background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a)); background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0); background-repeat: repeat-x; border-color: #2b669a; } .list-group-item.active .badge, .list-group-item.active:hover .badge, .list-group-item.active:focus .badge { text-shadow: none; } .panel { -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); } .panel-default > .panel-heading { background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); background-repeat: repeat-x; } .panel-primary > .panel-heading { background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); background-repeat: repeat-x; } .panel-success > .panel-heading { background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6)); background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); background-repeat: repeat-x; } .panel-info > .panel-heading { background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3)); background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); background-repeat: repeat-x; } .panel-warning > .panel-heading { background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc)); background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); background-repeat: repeat-x; } .panel-danger > .panel-heading { background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc)); background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); background-repeat: repeat-x; } .well { background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5)); background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); background-repeat: repeat-x; border-color: #dcdcdc; -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); } /*# sourceMappingURL=bootstrap-theme.css.map */ ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/dist/css/bootstrap.css ================================================ /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } body { margin: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; } audio, canvas, progress, video { display: inline-block; vertical-align: baseline; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } a { background-color: transparent; } a:active, a:hover { outline: 0; } abbr[title] { border-bottom: 1px dotted; } b, strong { font-weight: bold; } dfn { font-style: italic; } h1 { margin: .67em 0; font-size: 2em; } mark { color: #000; background: #ff0; } small { font-size: 80%; } sub, sup { position: relative; font-size: 75%; line-height: 0; vertical-align: baseline; } sup { top: -.5em; } sub { bottom: -.25em; } img { border: 0; } svg:not(:root) { overflow: hidden; } figure { margin: 1em 40px; } hr { height: 0; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } pre { overflow: auto; } code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em; } button, input, optgroup, select, textarea { margin: 0; font: inherit; color: inherit; } button { overflow: visible; } button, select { text-transform: none; } button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } button[disabled], html input[disabled] { cursor: default; } button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: 0; } input { line-height: normal; } input[type="checkbox"], input[type="radio"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 0; } input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { height: auto; } input[type="search"] { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield; } input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } fieldset { padding: .35em .625em .75em; margin: 0 2px; border: 1px solid #c0c0c0; } legend { padding: 0; border: 0; } textarea { overflow: auto; } optgroup { font-weight: bold; } table { border-spacing: 0; border-collapse: collapse; } td, th { padding: 0; } /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ @media print { *, *:before, *:after { color: #000 !important; text-shadow: none !important; background: transparent !important; -webkit-box-shadow: none !important; box-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } .navbar { display: none; } .btn > .caret, .dropup > .btn > .caret { border-top-color: #000 !important; } .label { border: 1px solid #000; } .table { border-collapse: collapse !important; } .table td, .table th { background-color: #fff !important; } .table-bordered th, .table-bordered td { border: 1px solid #ddd !important; } } @font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } .glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .glyphicon-asterisk:before { content: "\002a"; } .glyphicon-plus:before { content: "\002b"; } .glyphicon-euro:before, .glyphicon-eur:before { content: "\20ac"; } .glyphicon-minus:before { content: "\2212"; } .glyphicon-cloud:before { content: "\2601"; } .glyphicon-envelope:before { content: "\2709"; } .glyphicon-pencil:before { content: "\270f"; } .glyphicon-glass:before { content: "\e001"; } .glyphicon-music:before { content: "\e002"; } .glyphicon-search:before { content: "\e003"; } .glyphicon-heart:before { content: "\e005"; } .glyphicon-star:before { content: "\e006"; } .glyphicon-star-empty:before { content: "\e007"; } .glyphicon-user:before { content: "\e008"; } .glyphicon-film:before { content: "\e009"; } .glyphicon-th-large:before { content: "\e010"; } .glyphicon-th:before { content: "\e011"; } .glyphicon-th-list:before { content: "\e012"; } .glyphicon-ok:before { content: "\e013"; } .glyphicon-remove:before { content: "\e014"; } .glyphicon-zoom-in:before { content: "\e015"; } .glyphicon-zoom-out:before { content: "\e016"; } .glyphicon-off:before { content: "\e017"; } .glyphicon-signal:before { content: "\e018"; } .glyphicon-cog:before { content: "\e019"; } .glyphicon-trash:before { content: "\e020"; } .glyphicon-home:before { content: "\e021"; } .glyphicon-file:before { content: "\e022"; } .glyphicon-time:before { content: "\e023"; } .glyphicon-road:before { content: "\e024"; } .glyphicon-download-alt:before { content: "\e025"; } .glyphicon-download:before { content: "\e026"; } .glyphicon-upload:before { content: "\e027"; } .glyphicon-inbox:before { content: "\e028"; } .glyphicon-play-circle:before { content: "\e029"; } .glyphicon-repeat:before { content: "\e030"; } .glyphicon-refresh:before { content: "\e031"; } .glyphicon-list-alt:before { content: "\e032"; } .glyphicon-lock:before { content: "\e033"; } .glyphicon-flag:before { content: "\e034"; } .glyphicon-headphones:before { content: "\e035"; } .glyphicon-volume-off:before { content: "\e036"; } .glyphicon-volume-down:before { content: "\e037"; } .glyphicon-volume-up:before { content: "\e038"; } .glyphicon-qrcode:before { content: "\e039"; } .glyphicon-barcode:before { content: "\e040"; } .glyphicon-tag:before { content: "\e041"; } .glyphicon-tags:before { content: "\e042"; } .glyphicon-book:before { content: "\e043"; } .glyphicon-bookmark:before { content: "\e044"; } .glyphicon-print:before { content: "\e045"; } .glyphicon-camera:before { content: "\e046"; } .glyphicon-font:before { content: "\e047"; } .glyphicon-bold:before { content: "\e048"; } .glyphicon-italic:before { content: "\e049"; } .glyphicon-text-height:before { content: "\e050"; } .glyphicon-text-width:before { content: "\e051"; } .glyphicon-align-left:before { content: "\e052"; } .glyphicon-align-center:before { content: "\e053"; } .glyphicon-align-right:before { content: "\e054"; } .glyphicon-align-justify:before { content: "\e055"; } .glyphicon-list:before { content: "\e056"; } .glyphicon-indent-left:before { content: "\e057"; } .glyphicon-indent-right:before { content: "\e058"; } .glyphicon-facetime-video:before { content: "\e059"; } .glyphicon-picture:before { content: "\e060"; } .glyphicon-map-marker:before { content: "\e062"; } .glyphicon-adjust:before { content: "\e063"; } .glyphicon-tint:before { content: "\e064"; } .glyphicon-edit:before { content: "\e065"; } .glyphicon-share:before { content: "\e066"; } .glyphicon-check:before { content: "\e067"; } .glyphicon-move:before { content: "\e068"; } .glyphicon-step-backward:before { content: "\e069"; } .glyphicon-fast-backward:before { content: "\e070"; } .glyphicon-backward:before { content: "\e071"; } .glyphicon-play:before { content: "\e072"; } .glyphicon-pause:before { content: "\e073"; } .glyphicon-stop:before { content: "\e074"; } .glyphicon-forward:before { content: "\e075"; } .glyphicon-fast-forward:before { content: "\e076"; } .glyphicon-step-forward:before { content: "\e077"; } .glyphicon-eject:before { content: "\e078"; } .glyphicon-chevron-left:before { content: "\e079"; } .glyphicon-chevron-right:before { content: "\e080"; } .glyphicon-plus-sign:before { content: "\e081"; } .glyphicon-minus-sign:before { content: "\e082"; } .glyphicon-remove-sign:before { content: "\e083"; } .glyphicon-ok-sign:before { content: "\e084"; } .glyphicon-question-sign:before { content: "\e085"; } .glyphicon-info-sign:before { content: "\e086"; } .glyphicon-screenshot:before { content: "\e087"; } .glyphicon-remove-circle:before { content: "\e088"; } .glyphicon-ok-circle:before { content: "\e089"; } .glyphicon-ban-circle:before { content: "\e090"; } .glyphicon-arrow-left:before { content: "\e091"; } .glyphicon-arrow-right:before { content: "\e092"; } .glyphicon-arrow-up:before { content: "\e093"; } .glyphicon-arrow-down:before { content: "\e094"; } .glyphicon-share-alt:before { content: "\e095"; } .glyphicon-resize-full:before { content: "\e096"; } .glyphicon-resize-small:before { content: "\e097"; } .glyphicon-exclamation-sign:before { content: "\e101"; } .glyphicon-gift:before { content: "\e102"; } .glyphicon-leaf:before { content: "\e103"; } .glyphicon-fire:before { content: "\e104"; } .glyphicon-eye-open:before { content: "\e105"; } .glyphicon-eye-close:before { content: "\e106"; } .glyphicon-warning-sign:before { content: "\e107"; } .glyphicon-plane:before { content: "\e108"; } .glyphicon-calendar:before { content: "\e109"; } .glyphicon-random:before { content: "\e110"; } .glyphicon-comment:before { content: "\e111"; } .glyphicon-magnet:before { content: "\e112"; } .glyphicon-chevron-up:before { content: "\e113"; } .glyphicon-chevron-down:before { content: "\e114"; } .glyphicon-retweet:before { content: "\e115"; } .glyphicon-shopping-cart:before { content: "\e116"; } .glyphicon-folder-close:before { content: "\e117"; } .glyphicon-folder-open:before { content: "\e118"; } .glyphicon-resize-vertical:before { content: "\e119"; } .glyphicon-resize-horizontal:before { content: "\e120"; } .glyphicon-hdd:before { content: "\e121"; } .glyphicon-bullhorn:before { content: "\e122"; } .glyphicon-bell:before { content: "\e123"; } .glyphicon-certificate:before { content: "\e124"; } .glyphicon-thumbs-up:before { content: "\e125"; } .glyphicon-thumbs-down:before { content: "\e126"; } .glyphicon-hand-right:before { content: "\e127"; } .glyphicon-hand-left:before { content: "\e128"; } .glyphicon-hand-up:before { content: "\e129"; } .glyphicon-hand-down:before { content: "\e130"; } .glyphicon-circle-arrow-right:before { content: "\e131"; } .glyphicon-circle-arrow-left:before { content: "\e132"; } .glyphicon-circle-arrow-up:before { content: "\e133"; } .glyphicon-circle-arrow-down:before { content: "\e134"; } .glyphicon-globe:before { content: "\e135"; } .glyphicon-wrench:before { content: "\e136"; } .glyphicon-tasks:before { content: "\e137"; } .glyphicon-filter:before { content: "\e138"; } .glyphicon-briefcase:before { content: "\e139"; } .glyphicon-fullscreen:before { content: "\e140"; } .glyphicon-dashboard:before { content: "\e141"; } .glyphicon-paperclip:before { content: "\e142"; } .glyphicon-heart-empty:before { content: "\e143"; } .glyphicon-link:before { content: "\e144"; } .glyphicon-phone:before { content: "\e145"; } .glyphicon-pushpin:before { content: "\e146"; } .glyphicon-usd:before { content: "\e148"; } .glyphicon-gbp:before { content: "\e149"; } .glyphicon-sort:before { content: "\e150"; } .glyphicon-sort-by-alphabet:before { content: "\e151"; } .glyphicon-sort-by-alphabet-alt:before { content: "\e152"; } .glyphicon-sort-by-order:before { content: "\e153"; } .glyphicon-sort-by-order-alt:before { content: "\e154"; } .glyphicon-sort-by-attributes:before { content: "\e155"; } .glyphicon-sort-by-attributes-alt:before { content: "\e156"; } .glyphicon-unchecked:before { content: "\e157"; } .glyphicon-expand:before { content: "\e158"; } .glyphicon-collapse-down:before { content: "\e159"; } .glyphicon-collapse-up:before { content: "\e160"; } .glyphicon-log-in:before { content: "\e161"; } .glyphicon-flash:before { content: "\e162"; } .glyphicon-log-out:before { content: "\e163"; } .glyphicon-new-window:before { content: "\e164"; } .glyphicon-record:before { content: "\e165"; } .glyphicon-save:before { content: "\e166"; } .glyphicon-open:before { content: "\e167"; } .glyphicon-saved:before { content: "\e168"; } .glyphicon-import:before { content: "\e169"; } .glyphicon-export:before { content: "\e170"; } .glyphicon-send:before { content: "\e171"; } .glyphicon-floppy-disk:before { content: "\e172"; } .glyphicon-floppy-saved:before { content: "\e173"; } .glyphicon-floppy-remove:before { content: "\e174"; } .glyphicon-floppy-save:before { content: "\e175"; } .glyphicon-floppy-open:before { content: "\e176"; } .glyphicon-credit-card:before { content: "\e177"; } .glyphicon-transfer:before { content: "\e178"; } .glyphicon-cutlery:before { content: "\e179"; } .glyphicon-header:before { content: "\e180"; } .glyphicon-compressed:before { content: "\e181"; } .glyphicon-earphone:before { content: "\e182"; } .glyphicon-phone-alt:before { content: "\e183"; } .glyphicon-tower:before { content: "\e184"; } .glyphicon-stats:before { content: "\e185"; } .glyphicon-sd-video:before { content: "\e186"; } .glyphicon-hd-video:before { content: "\e187"; } .glyphicon-subtitles:before { content: "\e188"; } .glyphicon-sound-stereo:before { content: "\e189"; } .glyphicon-sound-dolby:before { content: "\e190"; } .glyphicon-sound-5-1:before { content: "\e191"; } .glyphicon-sound-6-1:before { content: "\e192"; } .glyphicon-sound-7-1:before { content: "\e193"; } .glyphicon-copyright-mark:before { content: "\e194"; } .glyphicon-registration-mark:before { content: "\e195"; } .glyphicon-cloud-download:before { content: "\e197"; } .glyphicon-cloud-upload:before { content: "\e198"; } .glyphicon-tree-conifer:before { content: "\e199"; } .glyphicon-tree-deciduous:before { content: "\e200"; } .glyphicon-cd:before { content: "\e201"; } .glyphicon-save-file:before { content: "\e202"; } .glyphicon-open-file:before { content: "\e203"; } .glyphicon-level-up:before { content: "\e204"; } .glyphicon-copy:before { content: "\e205"; } .glyphicon-paste:before { content: "\e206"; } .glyphicon-alert:before { content: "\e209"; } .glyphicon-equalizer:before { content: "\e210"; } .glyphicon-king:before { content: "\e211"; } .glyphicon-queen:before { content: "\e212"; } .glyphicon-pawn:before { content: "\e213"; } .glyphicon-bishop:before { content: "\e214"; } .glyphicon-knight:before { content: "\e215"; } .glyphicon-baby-formula:before { content: "\e216"; } .glyphicon-tent:before { content: "\26fa"; } .glyphicon-blackboard:before { content: "\e218"; } .glyphicon-bed:before { content: "\e219"; } .glyphicon-apple:before { content: "\f8ff"; } .glyphicon-erase:before { content: "\e221"; } .glyphicon-hourglass:before { content: "\231b"; } .glyphicon-lamp:before { content: "\e223"; } .glyphicon-duplicate:before { content: "\e224"; } .glyphicon-piggy-bank:before { content: "\e225"; } .glyphicon-scissors:before { content: "\e226"; } .glyphicon-bitcoin:before { content: "\e227"; } .glyphicon-btc:before { content: "\e227"; } .glyphicon-xbt:before { content: "\e227"; } .glyphicon-yen:before { content: "\00a5"; } .glyphicon-jpy:before { content: "\00a5"; } .glyphicon-ruble:before { content: "\20bd"; } .glyphicon-rub:before { content: "\20bd"; } .glyphicon-scale:before { content: "\e230"; } .glyphicon-ice-lolly:before { content: "\e231"; } .glyphicon-ice-lolly-tasted:before { content: "\e232"; } .glyphicon-education:before { content: "\e233"; } .glyphicon-option-horizontal:before { content: "\e234"; } .glyphicon-option-vertical:before { content: "\e235"; } .glyphicon-menu-hamburger:before { content: "\e236"; } .glyphicon-modal-window:before { content: "\e237"; } .glyphicon-oil:before { content: "\e238"; } .glyphicon-grain:before { content: "\e239"; } .glyphicon-sunglasses:before { content: "\e240"; } .glyphicon-text-size:before { content: "\e241"; } .glyphicon-text-color:before { content: "\e242"; } .glyphicon-text-background:before { content: "\e243"; } .glyphicon-object-align-top:before { content: "\e244"; } .glyphicon-object-align-bottom:before { content: "\e245"; } .glyphicon-object-align-horizontal:before { content: "\e246"; } .glyphicon-object-align-left:before { content: "\e247"; } .glyphicon-object-align-vertical:before { content: "\e248"; } .glyphicon-object-align-right:before { content: "\e249"; } .glyphicon-triangle-right:before { content: "\e250"; } .glyphicon-triangle-left:before { content: "\e251"; } .glyphicon-triangle-bottom:before { content: "\e252"; } .glyphicon-triangle-top:before { content: "\e253"; } .glyphicon-console:before { content: "\e254"; } .glyphicon-superscript:before { content: "\e255"; } .glyphicon-subscript:before { content: "\e256"; } .glyphicon-menu-left:before { content: "\e257"; } .glyphicon-menu-right:before { content: "\e258"; } .glyphicon-menu-down:before { content: "\e259"; } .glyphicon-menu-up:before { content: "\e260"; } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { font-size: 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.42857143; color: #333; background-color: #fff; } input, button, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; } a { color: #337ab7; text-decoration: none; } a:hover, a:focus { color: #23527c; text-decoration: underline; } a:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } figure { margin: 0; } img { vertical-align: middle; } .img-responsive, .thumbnail > img, .thumbnail a > img, .carousel-inner > .item > img, .carousel-inner > .item > a > img { display: block; max-width: 100%; height: auto; } .img-rounded { border-radius: 6px; } .img-thumbnail { display: inline-block; max-width: 100%; height: auto; padding: 4px; line-height: 1.42857143; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: all .2s ease-in-out; -o-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } .img-circle { border-radius: 50%; } hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #eee; } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } .sr-only-focusable:active, .sr-only-focusable:focus { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; } [role="button"] { cursor: pointer; } h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small, h1 .small, h2 .small, h3 .small, h4 .small, h5 .small, h6 .small, .h1 .small, .h2 .small, .h3 .small, .h4 .small, .h5 .small, .h6 .small { font-weight: normal; line-height: 1; color: #777; } h1, .h1, h2, .h2, h3, .h3 { margin-top: 20px; margin-bottom: 10px; } h1 small, .h1 small, h2 small, .h2 small, h3 small, .h3 small, h1 .small, .h1 .small, h2 .small, .h2 .small, h3 .small, .h3 .small { font-size: 65%; } h4, .h4, h5, .h5, h6, .h6 { margin-top: 10px; margin-bottom: 10px; } h4 small, .h4 small, h5 small, .h5 small, h6 small, .h6 small, h4 .small, .h4 .small, h5 .small, .h5 .small, h6 .small, .h6 .small { font-size: 75%; } h1, .h1 { font-size: 36px; } h2, .h2 { font-size: 30px; } h3, .h3 { font-size: 24px; } h4, .h4 { font-size: 18px; } h5, .h5 { font-size: 14px; } h6, .h6 { font-size: 12px; } p { margin: 0 0 10px; } .lead { margin-bottom: 20px; font-size: 16px; font-weight: 300; line-height: 1.4; } @media (min-width: 768px) { .lead { font-size: 21px; } } small, .small { font-size: 85%; } mark, .mark { padding: .2em; background-color: #fcf8e3; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } .text-justify { text-align: justify; } .text-nowrap { white-space: nowrap; } .text-lowercase { text-transform: lowercase; } .text-uppercase { text-transform: uppercase; } .text-capitalize { text-transform: capitalize; } .text-muted { color: #777; } .text-primary { color: #337ab7; } a.text-primary:hover, a.text-primary:focus { color: #286090; } .text-success { color: #3c763d; } a.text-success:hover, a.text-success:focus { color: #2b542c; } .text-info { color: #31708f; } a.text-info:hover, a.text-info:focus { color: #245269; } .text-warning { color: #8a6d3b; } a.text-warning:hover, a.text-warning:focus { color: #66512c; } .text-danger { color: #a94442; } a.text-danger:hover, a.text-danger:focus { color: #843534; } .bg-primary { color: #fff; background-color: #337ab7; } a.bg-primary:hover, a.bg-primary:focus { background-color: #286090; } .bg-success { background-color: #dff0d8; } a.bg-success:hover, a.bg-success:focus { background-color: #c1e2b3; } .bg-info { background-color: #d9edf7; } a.bg-info:hover, a.bg-info:focus { background-color: #afd9ee; } .bg-warning { background-color: #fcf8e3; } a.bg-warning:hover, a.bg-warning:focus { background-color: #f7ecb5; } .bg-danger { background-color: #f2dede; } a.bg-danger:hover, a.bg-danger:focus { background-color: #e4b9b9; } .page-header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eee; } ul, ol { margin-top: 0; margin-bottom: 10px; } ul ul, ol ul, ul ol, ol ol { margin-bottom: 0; } .list-unstyled { padding-left: 0; list-style: none; } .list-inline { padding-left: 0; margin-left: -5px; list-style: none; } .list-inline > li { display: inline-block; padding-right: 5px; padding-left: 5px; } dl { margin-top: 0; margin-bottom: 20px; } dt, dd { line-height: 1.42857143; } dt { font-weight: bold; } dd { margin-left: 0; } @media (min-width: 768px) { .dl-horizontal dt { float: left; width: 160px; overflow: hidden; clear: left; text-align: right; text-overflow: ellipsis; white-space: nowrap; } .dl-horizontal dd { margin-left: 180px; } } abbr[title], abbr[data-original-title] { cursor: help; border-bottom: 1px dotted #777; } .initialism { font-size: 90%; text-transform: uppercase; } blockquote { padding: 10px 20px; margin: 0 0 20px; font-size: 17.5px; border-left: 5px solid #eee; } blockquote p:last-child, blockquote ul:last-child, blockquote ol:last-child { margin-bottom: 0; } blockquote footer, blockquote small, blockquote .small { display: block; font-size: 80%; line-height: 1.42857143; color: #777; } blockquote footer:before, blockquote small:before, blockquote .small:before { content: '\2014 \00A0'; } .blockquote-reverse, blockquote.pull-right { padding-right: 15px; padding-left: 0; text-align: right; border-right: 5px solid #eee; border-left: 0; } .blockquote-reverse footer:before, blockquote.pull-right footer:before, .blockquote-reverse small:before, blockquote.pull-right small:before, .blockquote-reverse .small:before, blockquote.pull-right .small:before { content: ''; } .blockquote-reverse footer:after, blockquote.pull-right footer:after, .blockquote-reverse small:after, blockquote.pull-right small:after, .blockquote-reverse .small:after, blockquote.pull-right .small:after { content: '\00A0 \2014'; } address { margin-bottom: 20px; font-style: normal; line-height: 1.42857143; } code, kbd, pre, samp { font-family: Menlo, Monaco, Consolas, "Courier New", monospace; } code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; } kbd { padding: 2px 4px; font-size: 90%; color: #fff; background-color: #333; border-radius: 3px; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); } kbd kbd { padding: 0; font-size: 100%; font-weight: bold; -webkit-box-shadow: none; box-shadow: none; } pre { display: block; padding: 9.5px; margin: 0 0 10px; font-size: 13px; line-height: 1.42857143; color: #333; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent; border-radius: 0; } .pre-scrollable { max-height: 340px; overflow-y: scroll; } .container { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } @media (min-width: 768px) { .container { width: 750px; } } @media (min-width: 992px) { .container { width: 970px; } } @media (min-width: 1200px) { .container { width: 1170px; } } .container-fluid { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } .row { margin-right: -15px; margin-left: -15px; } .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { position: relative; min-height: 1px; padding-right: 15px; padding-left: 15px; } .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { float: left; } .col-xs-12 { width: 100%; } .col-xs-11 { width: 91.66666667%; } .col-xs-10 { width: 83.33333333%; } .col-xs-9 { width: 75%; } .col-xs-8 { width: 66.66666667%; } .col-xs-7 { width: 58.33333333%; } .col-xs-6 { width: 50%; } .col-xs-5 { width: 41.66666667%; } .col-xs-4 { width: 33.33333333%; } .col-xs-3 { width: 25%; } .col-xs-2 { width: 16.66666667%; } .col-xs-1 { width: 8.33333333%; } .col-xs-pull-12 { right: 100%; } .col-xs-pull-11 { right: 91.66666667%; } .col-xs-pull-10 { right: 83.33333333%; } .col-xs-pull-9 { right: 75%; } .col-xs-pull-8 { right: 66.66666667%; } .col-xs-pull-7 { right: 58.33333333%; } .col-xs-pull-6 { right: 50%; } .col-xs-pull-5 { right: 41.66666667%; } .col-xs-pull-4 { right: 33.33333333%; } .col-xs-pull-3 { right: 25%; } .col-xs-pull-2 { right: 16.66666667%; } .col-xs-pull-1 { right: 8.33333333%; } .col-xs-pull-0 { right: auto; } .col-xs-push-12 { left: 100%; } .col-xs-push-11 { left: 91.66666667%; } .col-xs-push-10 { left: 83.33333333%; } .col-xs-push-9 { left: 75%; } .col-xs-push-8 { left: 66.66666667%; } .col-xs-push-7 { left: 58.33333333%; } .col-xs-push-6 { left: 50%; } .col-xs-push-5 { left: 41.66666667%; } .col-xs-push-4 { left: 33.33333333%; } .col-xs-push-3 { left: 25%; } .col-xs-push-2 { left: 16.66666667%; } .col-xs-push-1 { left: 8.33333333%; } .col-xs-push-0 { left: auto; } .col-xs-offset-12 { margin-left: 100%; } .col-xs-offset-11 { margin-left: 91.66666667%; } .col-xs-offset-10 { margin-left: 83.33333333%; } .col-xs-offset-9 { margin-left: 75%; } .col-xs-offset-8 { margin-left: 66.66666667%; } .col-xs-offset-7 { margin-left: 58.33333333%; } .col-xs-offset-6 { margin-left: 50%; } .col-xs-offset-5 { margin-left: 41.66666667%; } .col-xs-offset-4 { margin-left: 33.33333333%; } .col-xs-offset-3 { margin-left: 25%; } .col-xs-offset-2 { margin-left: 16.66666667%; } .col-xs-offset-1 { margin-left: 8.33333333%; } .col-xs-offset-0 { margin-left: 0; } @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left; } .col-sm-12 { width: 100%; } .col-sm-11 { width: 91.66666667%; } .col-sm-10 { width: 83.33333333%; } .col-sm-9 { width: 75%; } .col-sm-8 { width: 66.66666667%; } .col-sm-7 { width: 58.33333333%; } .col-sm-6 { width: 50%; } .col-sm-5 { width: 41.66666667%; } .col-sm-4 { width: 33.33333333%; } .col-sm-3 { width: 25%; } .col-sm-2 { width: 16.66666667%; } .col-sm-1 { width: 8.33333333%; } .col-sm-pull-12 { right: 100%; } .col-sm-pull-11 { right: 91.66666667%; } .col-sm-pull-10 { right: 83.33333333%; } .col-sm-pull-9 { right: 75%; } .col-sm-pull-8 { right: 66.66666667%; } .col-sm-pull-7 { right: 58.33333333%; } .col-sm-pull-6 { right: 50%; } .col-sm-pull-5 { right: 41.66666667%; } .col-sm-pull-4 { right: 33.33333333%; } .col-sm-pull-3 { right: 25%; } .col-sm-pull-2 { right: 16.66666667%; } .col-sm-pull-1 { right: 8.33333333%; } .col-sm-pull-0 { right: auto; } .col-sm-push-12 { left: 100%; } .col-sm-push-11 { left: 91.66666667%; } .col-sm-push-10 { left: 83.33333333%; } .col-sm-push-9 { left: 75%; } .col-sm-push-8 { left: 66.66666667%; } .col-sm-push-7 { left: 58.33333333%; } .col-sm-push-6 { left: 50%; } .col-sm-push-5 { left: 41.66666667%; } .col-sm-push-4 { left: 33.33333333%; } .col-sm-push-3 { left: 25%; } .col-sm-push-2 { left: 16.66666667%; } .col-sm-push-1 { left: 8.33333333%; } .col-sm-push-0 { left: auto; } .col-sm-offset-12 { margin-left: 100%; } .col-sm-offset-11 { margin-left: 91.66666667%; } .col-sm-offset-10 { margin-left: 83.33333333%; } .col-sm-offset-9 { margin-left: 75%; } .col-sm-offset-8 { margin-left: 66.66666667%; } .col-sm-offset-7 { margin-left: 58.33333333%; } .col-sm-offset-6 { margin-left: 50%; } .col-sm-offset-5 { margin-left: 41.66666667%; } .col-sm-offset-4 { margin-left: 33.33333333%; } .col-sm-offset-3 { margin-left: 25%; } .col-sm-offset-2 { margin-left: 16.66666667%; } .col-sm-offset-1 { margin-left: 8.33333333%; } .col-sm-offset-0 { margin-left: 0; } } @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } .col-md-12 { width: 100%; } .col-md-11 { width: 91.66666667%; } .col-md-10 { width: 83.33333333%; } .col-md-9 { width: 75%; } .col-md-8 { width: 66.66666667%; } .col-md-7 { width: 58.33333333%; } .col-md-6 { width: 50%; } .col-md-5 { width: 41.66666667%; } .col-md-4 { width: 33.33333333%; } .col-md-3 { width: 25%; } .col-md-2 { width: 16.66666667%; } .col-md-1 { width: 8.33333333%; } .col-md-pull-12 { right: 100%; } .col-md-pull-11 { right: 91.66666667%; } .col-md-pull-10 { right: 83.33333333%; } .col-md-pull-9 { right: 75%; } .col-md-pull-8 { right: 66.66666667%; } .col-md-pull-7 { right: 58.33333333%; } .col-md-pull-6 { right: 50%; } .col-md-pull-5 { right: 41.66666667%; } .col-md-pull-4 { right: 33.33333333%; } .col-md-pull-3 { right: 25%; } .col-md-pull-2 { right: 16.66666667%; } .col-md-pull-1 { right: 8.33333333%; } .col-md-pull-0 { right: auto; } .col-md-push-12 { left: 100%; } .col-md-push-11 { left: 91.66666667%; } .col-md-push-10 { left: 83.33333333%; } .col-md-push-9 { left: 75%; } .col-md-push-8 { left: 66.66666667%; } .col-md-push-7 { left: 58.33333333%; } .col-md-push-6 { left: 50%; } .col-md-push-5 { left: 41.66666667%; } .col-md-push-4 { left: 33.33333333%; } .col-md-push-3 { left: 25%; } .col-md-push-2 { left: 16.66666667%; } .col-md-push-1 { left: 8.33333333%; } .col-md-push-0 { left: auto; } .col-md-offset-12 { margin-left: 100%; } .col-md-offset-11 { margin-left: 91.66666667%; } .col-md-offset-10 { margin-left: 83.33333333%; } .col-md-offset-9 { margin-left: 75%; } .col-md-offset-8 { margin-left: 66.66666667%; } .col-md-offset-7 { margin-left: 58.33333333%; } .col-md-offset-6 { margin-left: 50%; } .col-md-offset-5 { margin-left: 41.66666667%; } .col-md-offset-4 { margin-left: 33.33333333%; } .col-md-offset-3 { margin-left: 25%; } .col-md-offset-2 { margin-left: 16.66666667%; } .col-md-offset-1 { margin-left: 8.33333333%; } .col-md-offset-0 { margin-left: 0; } } @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } .col-lg-12 { width: 100%; } .col-lg-11 { width: 91.66666667%; } .col-lg-10 { width: 83.33333333%; } .col-lg-9 { width: 75%; } .col-lg-8 { width: 66.66666667%; } .col-lg-7 { width: 58.33333333%; } .col-lg-6 { width: 50%; } .col-lg-5 { width: 41.66666667%; } .col-lg-4 { width: 33.33333333%; } .col-lg-3 { width: 25%; } .col-lg-2 { width: 16.66666667%; } .col-lg-1 { width: 8.33333333%; } .col-lg-pull-12 { right: 100%; } .col-lg-pull-11 { right: 91.66666667%; } .col-lg-pull-10 { right: 83.33333333%; } .col-lg-pull-9 { right: 75%; } .col-lg-pull-8 { right: 66.66666667%; } .col-lg-pull-7 { right: 58.33333333%; } .col-lg-pull-6 { right: 50%; } .col-lg-pull-5 { right: 41.66666667%; } .col-lg-pull-4 { right: 33.33333333%; } .col-lg-pull-3 { right: 25%; } .col-lg-pull-2 { right: 16.66666667%; } .col-lg-pull-1 { right: 8.33333333%; } .col-lg-pull-0 { right: auto; } .col-lg-push-12 { left: 100%; } .col-lg-push-11 { left: 91.66666667%; } .col-lg-push-10 { left: 83.33333333%; } .col-lg-push-9 { left: 75%; } .col-lg-push-8 { left: 66.66666667%; } .col-lg-push-7 { left: 58.33333333%; } .col-lg-push-6 { left: 50%; } .col-lg-push-5 { left: 41.66666667%; } .col-lg-push-4 { left: 33.33333333%; } .col-lg-push-3 { left: 25%; } .col-lg-push-2 { left: 16.66666667%; } .col-lg-push-1 { left: 8.33333333%; } .col-lg-push-0 { left: auto; } .col-lg-offset-12 { margin-left: 100%; } .col-lg-offset-11 { margin-left: 91.66666667%; } .col-lg-offset-10 { margin-left: 83.33333333%; } .col-lg-offset-9 { margin-left: 75%; } .col-lg-offset-8 { margin-left: 66.66666667%; } .col-lg-offset-7 { margin-left: 58.33333333%; } .col-lg-offset-6 { margin-left: 50%; } .col-lg-offset-5 { margin-left: 41.66666667%; } .col-lg-offset-4 { margin-left: 33.33333333%; } .col-lg-offset-3 { margin-left: 25%; } .col-lg-offset-2 { margin-left: 16.66666667%; } .col-lg-offset-1 { margin-left: 8.33333333%; } .col-lg-offset-0 { margin-left: 0; } } table { background-color: transparent; } caption { padding-top: 8px; padding-bottom: 8px; color: #777; text-align: left; } th { text-align: left; } .table { width: 100%; max-width: 100%; margin-bottom: 20px; } .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { padding: 8px; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd; } .table > thead > tr > th { vertical-align: bottom; border-bottom: 2px solid #ddd; } .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td { border-top: 0; } .table > tbody + tbody { border-top: 2px solid #ddd; } .table .table { background-color: #fff; } .table-condensed > thead > tr > th, .table-condensed > tbody > tr > th, .table-condensed > tfoot > tr > th, .table-condensed > thead > tr > td, .table-condensed > tbody > tr > td, .table-condensed > tfoot > tr > td { padding: 5px; } .table-bordered { border: 1px solid #ddd; } .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td { border: 1px solid #ddd; } .table-bordered > thead > tr > th, .table-bordered > thead > tr > td { border-bottom-width: 2px; } .table-striped > tbody > tr:nth-of-type(odd) { background-color: #f9f9f9; } .table-hover > tbody > tr:hover { background-color: #f5f5f5; } table col[class*="col-"] { position: static; display: table-column; float: none; } table td[class*="col-"], table th[class*="col-"] { position: static; display: table-cell; float: none; } .table > thead > tr > td.active, .table > tbody > tr > td.active, .table > tfoot > tr > td.active, .table > thead > tr > th.active, .table > tbody > tr > th.active, .table > tfoot > tr > th.active, .table > thead > tr.active > td, .table > tbody > tr.active > td, .table > tfoot > tr.active > td, .table > thead > tr.active > th, .table > tbody > tr.active > th, .table > tfoot > tr.active > th { background-color: #f5f5f5; } .table-hover > tbody > tr > td.active:hover, .table-hover > tbody > tr > th.active:hover, .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr:hover > .active, .table-hover > tbody > tr.active:hover > th { background-color: #e8e8e8; } .table > thead > tr > td.success, .table > tbody > tr > td.success, .table > tfoot > tr > td.success, .table > thead > tr > th.success, .table > tbody > tr > th.success, .table > tfoot > tr > th.success, .table > thead > tr.success > td, .table > tbody > tr.success > td, .table > tfoot > tr.success > td, .table > thead > tr.success > th, .table > tbody > tr.success > th, .table > tfoot > tr.success > th { background-color: #dff0d8; } .table-hover > tbody > tr > td.success:hover, .table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr:hover > .success, .table-hover > tbody > tr.success:hover > th { background-color: #d0e9c6; } .table > thead > tr > td.info, .table > tbody > tr > td.info, .table > tfoot > tr > td.info, .table > thead > tr > th.info, .table > tbody > tr > th.info, .table > tfoot > tr > th.info, .table > thead > tr.info > td, .table > tbody > tr.info > td, .table > tfoot > tr.info > td, .table > thead > tr.info > th, .table > tbody > tr.info > th, .table > tfoot > tr.info > th { background-color: #d9edf7; } .table-hover > tbody > tr > td.info:hover, .table-hover > tbody > tr > th.info:hover, .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr:hover > .info, .table-hover > tbody > tr.info:hover > th { background-color: #c4e3f3; } .table > thead > tr > td.warning, .table > tbody > tr > td.warning, .table > tfoot > tr > td.warning, .table > thead > tr > th.warning, .table > tbody > tr > th.warning, .table > tfoot > tr > th.warning, .table > thead > tr.warning > td, .table > tbody > tr.warning > td, .table > tfoot > tr.warning > td, .table > thead > tr.warning > th, .table > tbody > tr.warning > th, .table > tfoot > tr.warning > th { background-color: #fcf8e3; } .table-hover > tbody > tr > td.warning:hover, .table-hover > tbody > tr > th.warning:hover, .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr:hover > .warning, .table-hover > tbody > tr.warning:hover > th { background-color: #faf2cc; } .table > thead > tr > td.danger, .table > tbody > tr > td.danger, .table > tfoot > tr > td.danger, .table > thead > tr > th.danger, .table > tbody > tr > th.danger, .table > tfoot > tr > th.danger, .table > thead > tr.danger > td, .table > tbody > tr.danger > td, .table > tfoot > tr.danger > td, .table > thead > tr.danger > th, .table > tbody > tr.danger > th, .table > tfoot > tr.danger > th { background-color: #f2dede; } .table-hover > tbody > tr > td.danger:hover, .table-hover > tbody > tr > th.danger:hover, .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr:hover > .danger, .table-hover > tbody > tr.danger:hover > th { background-color: #ebcccc; } .table-responsive { min-height: .01%; overflow-x: auto; } @media screen and (max-width: 767px) { .table-responsive { width: 100%; margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; border: 1px solid #ddd; } .table-responsive > .table { margin-bottom: 0; } .table-responsive > .table > thead > tr > th, .table-responsive > .table > tbody > tr > th, .table-responsive > .table > tfoot > tr > th, .table-responsive > .table > thead > tr > td, .table-responsive > .table > tbody > tr > td, .table-responsive > .table > tfoot > tr > td { white-space: nowrap; } .table-responsive > .table-bordered { border: 0; } .table-responsive > .table-bordered > thead > tr > th:first-child, .table-responsive > .table-bordered > tbody > tr > th:first-child, .table-responsive > .table-bordered > tfoot > tr > th:first-child, .table-responsive > .table-bordered > thead > tr > td:first-child, .table-responsive > .table-bordered > tbody > tr > td:first-child, .table-responsive > .table-bordered > tfoot > tr > td:first-child { border-left: 0; } .table-responsive > .table-bordered > thead > tr > th:last-child, .table-responsive > .table-bordered > tbody > tr > th:last-child, .table-responsive > .table-bordered > tfoot > tr > th:last-child, .table-responsive > .table-bordered > thead > tr > td:last-child, .table-responsive > .table-bordered > tbody > tr > td:last-child, .table-responsive > .table-bordered > tfoot > tr > td:last-child { border-right: 0; } .table-responsive > .table-bordered > tbody > tr:last-child > th, .table-responsive > .table-bordered > tfoot > tr:last-child > th, .table-responsive > .table-bordered > tbody > tr:last-child > td, .table-responsive > .table-bordered > tfoot > tr:last-child > td { border-bottom: 0; } } fieldset { min-width: 0; padding: 0; margin: 0; border: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: 20px; font-size: 21px; line-height: inherit; color: #333; border: 0; border-bottom: 1px solid #e5e5e5; } label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: bold; } input[type="search"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; line-height: normal; } input[type="file"] { display: block; } input[type="range"] { display: block; width: 100%; } select[multiple], select[size] { height: auto; } input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } output { display: block; padding-top: 7px; font-size: 14px; line-height: 1.42857143; color: #555; } .form-control { display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } .form-control:focus { border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); } .form-control::-moz-placeholder { color: #999; opacity: 1; } .form-control:-ms-input-placeholder { color: #999; } .form-control::-webkit-input-placeholder { color: #999; } .form-control::-ms-expand { background-color: transparent; border: 0; } .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: #eee; opacity: 1; } .form-control[disabled], fieldset[disabled] .form-control { cursor: not-allowed; } textarea.form-control { height: auto; } input[type="search"] { -webkit-appearance: none; } @media screen and (-webkit-min-device-pixel-ratio: 0) { input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control, input[type="month"].form-control { line-height: 34px; } input[type="date"].input-sm, input[type="time"].input-sm, input[type="datetime-local"].input-sm, input[type="month"].input-sm, .input-group-sm input[type="date"], .input-group-sm input[type="time"], .input-group-sm input[type="datetime-local"], .input-group-sm input[type="month"] { line-height: 30px; } input[type="date"].input-lg, input[type="time"].input-lg, input[type="datetime-local"].input-lg, input[type="month"].input-lg, .input-group-lg input[type="date"], .input-group-lg input[type="time"], .input-group-lg input[type="datetime-local"], .input-group-lg input[type="month"] { line-height: 46px; } } .form-group { margin-bottom: 15px; } .radio, .checkbox { position: relative; display: block; margin-top: 10px; margin-bottom: 10px; } .radio label, .checkbox label { min-height: 20px; padding-left: 20px; margin-bottom: 0; font-weight: normal; cursor: pointer; } .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] { position: absolute; margin-top: 4px \9; margin-left: -20px; } .radio + .radio, .checkbox + .checkbox { margin-top: -5px; } .radio-inline, .checkbox-inline { position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; font-weight: normal; vertical-align: middle; cursor: pointer; } .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline { margin-top: 0; margin-left: 10px; } input[type="radio"][disabled], input[type="checkbox"][disabled], input[type="radio"].disabled, input[type="checkbox"].disabled, fieldset[disabled] input[type="radio"], fieldset[disabled] input[type="checkbox"] { cursor: not-allowed; } .radio-inline.disabled, .checkbox-inline.disabled, fieldset[disabled] .radio-inline, fieldset[disabled] .checkbox-inline { cursor: not-allowed; } .radio.disabled label, .checkbox.disabled label, fieldset[disabled] .radio label, fieldset[disabled] .checkbox label { cursor: not-allowed; } .form-control-static { min-height: 34px; padding-top: 7px; padding-bottom: 7px; margin-bottom: 0; } .form-control-static.input-lg, .form-control-static.input-sm { padding-right: 0; padding-left: 0; } .input-sm { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } select.input-sm { height: 30px; line-height: 30px; } textarea.input-sm, select[multiple].input-sm { height: auto; } .form-group-sm .form-control { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .form-group-sm select.form-control { height: 30px; line-height: 30px; } .form-group-sm textarea.form-control, .form-group-sm select[multiple].form-control { height: auto; } .form-group-sm .form-control-static { height: 30px; min-height: 32px; padding: 6px 10px; font-size: 12px; line-height: 1.5; } .input-lg { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px; } select.input-lg { height: 46px; line-height: 46px; } textarea.input-lg, select[multiple].input-lg { height: auto; } .form-group-lg .form-control { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px; } .form-group-lg select.form-control { height: 46px; line-height: 46px; } .form-group-lg textarea.form-control, .form-group-lg select[multiple].form-control { height: auto; } .form-group-lg .form-control-static { height: 46px; min-height: 38px; padding: 11px 16px; font-size: 18px; line-height: 1.3333333; } .has-feedback { position: relative; } .has-feedback .form-control { padding-right: 42.5px; } .form-control-feedback { position: absolute; top: 0; right: 0; z-index: 2; display: block; width: 34px; height: 34px; line-height: 34px; text-align: center; pointer-events: none; } .input-lg + .form-control-feedback, .input-group-lg + .form-control-feedback, .form-group-lg .form-control + .form-control-feedback { width: 46px; height: 46px; line-height: 46px; } .input-sm + .form-control-feedback, .input-group-sm + .form-control-feedback, .form-group-sm .form-control + .form-control-feedback { width: 30px; height: 30px; line-height: 30px; } .has-success .help-block, .has-success .control-label, .has-success .radio, .has-success .checkbox, .has-success .radio-inline, .has-success .checkbox-inline, .has-success.radio label, .has-success.checkbox label, .has-success.radio-inline label, .has-success.checkbox-inline label { color: #3c763d; } .has-success .form-control { border-color: #3c763d; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); } .has-success .form-control:focus { border-color: #2b542c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; } .has-success .input-group-addon { color: #3c763d; background-color: #dff0d8; border-color: #3c763d; } .has-success .form-control-feedback { color: #3c763d; } .has-warning .help-block, .has-warning .control-label, .has-warning .radio, .has-warning .checkbox, .has-warning .radio-inline, .has-warning .checkbox-inline, .has-warning.radio label, .has-warning.checkbox label, .has-warning.radio-inline label, .has-warning.checkbox-inline label { color: #8a6d3b; } .has-warning .form-control { border-color: #8a6d3b; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); } .has-warning .form-control:focus { border-color: #66512c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; } .has-warning .input-group-addon { color: #8a6d3b; background-color: #fcf8e3; border-color: #8a6d3b; } .has-warning .form-control-feedback { color: #8a6d3b; } .has-error .help-block, .has-error .control-label, .has-error .radio, .has-error .checkbox, .has-error .radio-inline, .has-error .checkbox-inline, .has-error.radio label, .has-error.checkbox label, .has-error.radio-inline label, .has-error.checkbox-inline label { color: #a94442; } .has-error .form-control { border-color: #a94442; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); } .has-error .form-control:focus { border-color: #843534; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; } .has-error .input-group-addon { color: #a94442; background-color: #f2dede; border-color: #a94442; } .has-error .form-control-feedback { color: #a94442; } .has-feedback label ~ .form-control-feedback { top: 25px; } .has-feedback label.sr-only ~ .form-control-feedback { top: 0; } .help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #737373; } @media (min-width: 768px) { .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } .form-inline .form-control { display: inline-block; width: auto; vertical-align: middle; } .form-inline .form-control-static { display: inline-block; } .form-inline .input-group { display: inline-table; vertical-align: middle; } .form-inline .input-group .input-group-addon, .form-inline .input-group .input-group-btn, .form-inline .input-group .form-control { width: auto; } .form-inline .input-group > .form-control { width: 100%; } .form-inline .control-label { margin-bottom: 0; vertical-align: middle; } .form-inline .radio, .form-inline .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle; } .form-inline .radio label, .form-inline .checkbox label { padding-left: 0; } .form-inline .radio input[type="radio"], .form-inline .checkbox input[type="checkbox"] { position: relative; margin-left: 0; } .form-inline .has-feedback .form-control-feedback { top: 0; } } .form-horizontal .radio, .form-horizontal .checkbox, .form-horizontal .radio-inline, .form-horizontal .checkbox-inline { padding-top: 7px; margin-top: 0; margin-bottom: 0; } .form-horizontal .radio, .form-horizontal .checkbox { min-height: 27px; } .form-horizontal .form-group { margin-right: -15px; margin-left: -15px; } @media (min-width: 768px) { .form-horizontal .control-label { padding-top: 7px; margin-bottom: 0; text-align: right; } } .form-horizontal .has-feedback .form-control-feedback { right: 15px; } @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { padding-top: 11px; font-size: 18px; } } @media (min-width: 768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; font-size: 12px; } } .btn { display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: normal; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-image: none; border: 1px solid transparent; border-radius: 4px; } .btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn.active.focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .btn:hover, .btn:focus, .btn.focus { color: #333; text-decoration: none; } .btn:active, .btn.active { background-image: none; outline: 0; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); } .btn.disabled, .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: none; opacity: .65; } a.btn.disabled, fieldset[disabled] a.btn { pointer-events: none; } .btn-default { color: #333; background-color: #fff; border-color: #ccc; } .btn-default:focus, .btn-default.focus { color: #333; background-color: #e6e6e6; border-color: #8c8c8c; } .btn-default:hover { color: #333; background-color: #e6e6e6; border-color: #adadad; } .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { color: #333; background-color: #e6e6e6; border-color: #adadad; } .btn-default:active:hover, .btn-default.active:hover, .open > .dropdown-toggle.btn-default:hover, .btn-default:active:focus, .btn-default.active:focus, .open > .dropdown-toggle.btn-default:focus, .btn-default:active.focus, .btn-default.active.focus, .open > .dropdown-toggle.btn-default.focus { color: #333; background-color: #d4d4d4; border-color: #8c8c8c; } .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { background-image: none; } .btn-default.disabled:hover, .btn-default[disabled]:hover, fieldset[disabled] .btn-default:hover, .btn-default.disabled:focus, .btn-default[disabled]:focus, fieldset[disabled] .btn-default:focus, .btn-default.disabled.focus, .btn-default[disabled].focus, fieldset[disabled] .btn-default.focus { background-color: #fff; border-color: #ccc; } .btn-default .badge { color: #fff; background-color: #333; } .btn-primary { color: #fff; background-color: #337ab7; border-color: #2e6da4; } .btn-primary:focus, .btn-primary.focus { color: #fff; background-color: #286090; border-color: #122b40; } .btn-primary:hover { color: #fff; background-color: #286090; border-color: #204d74; } .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { color: #fff; background-color: #286090; border-color: #204d74; } .btn-primary:active:hover, .btn-primary.active:hover, .open > .dropdown-toggle.btn-primary:hover, .btn-primary:active:focus, .btn-primary.active:focus, .open > .dropdown-toggle.btn-primary:focus, .btn-primary:active.focus, .btn-primary.active.focus, .open > .dropdown-toggle.btn-primary.focus { color: #fff; background-color: #204d74; border-color: #122b40; } .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { background-image: none; } .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary.focus { background-color: #337ab7; border-color: #2e6da4; } .btn-primary .badge { color: #337ab7; background-color: #fff; } .btn-success { color: #fff; background-color: #5cb85c; border-color: #4cae4c; } .btn-success:focus, .btn-success.focus { color: #fff; background-color: #449d44; border-color: #255625; } .btn-success:hover { color: #fff; background-color: #449d44; border-color: #398439; } .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { color: #fff; background-color: #449d44; border-color: #398439; } .btn-success:active:hover, .btn-success.active:hover, .open > .dropdown-toggle.btn-success:hover, .btn-success:active:focus, .btn-success.active:focus, .open > .dropdown-toggle.btn-success:focus, .btn-success:active.focus, .btn-success.active.focus, .open > .dropdown-toggle.btn-success.focus { color: #fff; background-color: #398439; border-color: #255625; } .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { background-image: none; } .btn-success.disabled:hover, .btn-success[disabled]:hover, fieldset[disabled] .btn-success:hover, .btn-success.disabled:focus, .btn-success[disabled]:focus, fieldset[disabled] .btn-success:focus, .btn-success.disabled.focus, .btn-success[disabled].focus, fieldset[disabled] .btn-success.focus { background-color: #5cb85c; border-color: #4cae4c; } .btn-success .badge { color: #5cb85c; background-color: #fff; } .btn-info { color: #fff; background-color: #5bc0de; border-color: #46b8da; } .btn-info:focus, .btn-info.focus { color: #fff; background-color: #31b0d5; border-color: #1b6d85; } .btn-info:hover { color: #fff; background-color: #31b0d5; border-color: #269abc; } .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { color: #fff; background-color: #31b0d5; border-color: #269abc; } .btn-info:active:hover, .btn-info.active:hover, .open > .dropdown-toggle.btn-info:hover, .btn-info:active:focus, .btn-info.active:focus, .open > .dropdown-toggle.btn-info:focus, .btn-info:active.focus, .btn-info.active.focus, .open > .dropdown-toggle.btn-info.focus { color: #fff; background-color: #269abc; border-color: #1b6d85; } .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { background-image: none; } .btn-info.disabled:hover, .btn-info[disabled]:hover, fieldset[disabled] .btn-info:hover, .btn-info.disabled:focus, .btn-info[disabled]:focus, fieldset[disabled] .btn-info:focus, .btn-info.disabled.focus, .btn-info[disabled].focus, fieldset[disabled] .btn-info.focus { background-color: #5bc0de; border-color: #46b8da; } .btn-info .badge { color: #5bc0de; background-color: #fff; } .btn-warning { color: #fff; background-color: #f0ad4e; border-color: #eea236; } .btn-warning:focus, .btn-warning.focus { color: #fff; background-color: #ec971f; border-color: #985f0d; } .btn-warning:hover { color: #fff; background-color: #ec971f; border-color: #d58512; } .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { color: #fff; background-color: #ec971f; border-color: #d58512; } .btn-warning:active:hover, .btn-warning.active:hover, .open > .dropdown-toggle.btn-warning:hover, .btn-warning:active:focus, .btn-warning.active:focus, .open > .dropdown-toggle.btn-warning:focus, .btn-warning:active.focus, .btn-warning.active.focus, .open > .dropdown-toggle.btn-warning.focus { color: #fff; background-color: #d58512; border-color: #985f0d; } .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { background-image: none; } .btn-warning.disabled:hover, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning:hover, .btn-warning.disabled:focus, .btn-warning[disabled]:focus, fieldset[disabled] .btn-warning:focus, .btn-warning.disabled.focus, .btn-warning[disabled].focus, fieldset[disabled] .btn-warning.focus { background-color: #f0ad4e; border-color: #eea236; } .btn-warning .badge { color: #f0ad4e; background-color: #fff; } .btn-danger { color: #fff; background-color: #d9534f; border-color: #d43f3a; } .btn-danger:focus, .btn-danger.focus { color: #fff; background-color: #c9302c; border-color: #761c19; } .btn-danger:hover { color: #fff; background-color: #c9302c; border-color: #ac2925; } .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { color: #fff; background-color: #c9302c; border-color: #ac2925; } .btn-danger:active:hover, .btn-danger.active:hover, .open > .dropdown-toggle.btn-danger:hover, .btn-danger:active:focus, .btn-danger.active:focus, .open > .dropdown-toggle.btn-danger:focus, .btn-danger:active.focus, .btn-danger.active.focus, .open > .dropdown-toggle.btn-danger.focus { color: #fff; background-color: #ac2925; border-color: #761c19; } .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { background-image: none; } .btn-danger.disabled:hover, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger:hover, .btn-danger.disabled:focus, .btn-danger[disabled]:focus, fieldset[disabled] .btn-danger:focus, .btn-danger.disabled.focus, .btn-danger[disabled].focus, fieldset[disabled] .btn-danger.focus { background-color: #d9534f; border-color: #d43f3a; } .btn-danger .badge { color: #d9534f; background-color: #fff; } .btn-link { font-weight: normal; color: #337ab7; border-radius: 0; } .btn-link, .btn-link:active, .btn-link.active, .btn-link[disabled], fieldset[disabled] .btn-link { background-color: transparent; -webkit-box-shadow: none; box-shadow: none; } .btn-link, .btn-link:hover, .btn-link:focus, .btn-link:active { border-color: transparent; } .btn-link:hover, .btn-link:focus { color: #23527c; text-decoration: underline; background-color: transparent; } .btn-link[disabled]:hover, fieldset[disabled] .btn-link:hover, .btn-link[disabled]:focus, fieldset[disabled] .btn-link:focus { color: #777; text-decoration: none; } .btn-lg, .btn-group-lg > .btn { padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px; } .btn-sm, .btn-group-sm > .btn { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .btn-xs, .btn-group-xs > .btn { padding: 1px 5px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .btn-block { display: block; width: 100%; } .btn-block + .btn-block { margin-top: 5px; } input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="button"].btn-block { width: 100%; } .fade { opacity: 0; -webkit-transition: opacity .15s linear; -o-transition: opacity .15s linear; transition: opacity .15s linear; } .fade.in { opacity: 1; } .collapse { display: none; } .collapse.in { display: block; } tr.collapse.in { display: table-row; } tbody.collapse.in { display: table-row-group; } .collapsing { position: relative; height: 0; overflow: hidden; -webkit-transition-timing-function: ease; -o-transition-timing-function: ease; transition-timing-function: ease; -webkit-transition-duration: .35s; -o-transition-duration: .35s; transition-duration: .35s; -webkit-transition-property: height, visibility; -o-transition-property: height, visibility; transition-property: height, visibility; } .caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px dashed; border-top: 4px solid \9; border-right: 4px solid transparent; border-left: 4px solid transparent; } .dropup, .dropdown { position: relative; } .dropdown-toggle:focus { outline: 0; } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; text-align: left; list-style: none; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); box-shadow: 0 6px 12px rgba(0, 0, 0, .175); } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.42857143; color: #333; white-space: nowrap; } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { color: #262626; text-decoration: none; background-color: #f5f5f5; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { color: #fff; text-decoration: none; background-color: #337ab7; outline: 0; } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #777; } .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; cursor: not-allowed; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .open > .dropdown-menu { display: block; } .open > a { outline: 0; } .dropdown-menu-right { right: 0; left: auto; } .dropdown-menu-left { right: auto; left: 0; } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.42857143; color: #777; white-space: nowrap; } .dropdown-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 990; } .pull-right > .dropdown-menu { right: 0; left: auto; } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { content: ""; border-top: 0; border-bottom: 4px dashed; border-bottom: 4px solid \9; } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 2px; } @media (min-width: 768px) { .navbar-right .dropdown-menu { right: 0; left: auto; } .navbar-right .dropdown-menu-left { right: auto; left: 0; } } .btn-group, .btn-group-vertical { position: relative; display: inline-block; vertical-align: middle; } .btn-group > .btn, .btn-group-vertical > .btn { position: relative; float: left; } .btn-group > .btn:hover, .btn-group-vertical > .btn:hover, .btn-group > .btn:focus, .btn-group-vertical > .btn:focus, .btn-group > .btn:active, .btn-group-vertical > .btn:active, .btn-group > .btn.active, .btn-group-vertical > .btn.active { z-index: 2; } .btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group { margin-left: -1px; } .btn-toolbar { margin-left: -5px; } .btn-toolbar .btn, .btn-toolbar .btn-group, .btn-toolbar .input-group { float: left; } .btn-toolbar > .btn, .btn-toolbar > .btn-group, .btn-toolbar > .input-group { margin-left: 5px; } .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { border-radius: 0; } .btn-group > .btn:first-child { margin-left: 0; } .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { border-top-right-radius: 0; border-bottom-right-radius: 0; } .btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; } .btn-group > .btn-group { float: left; } .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0; } .btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-top-right-radius: 0; border-bottom-right-radius: 0; } .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { border-top-left-radius: 0; border-bottom-left-radius: 0; } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0; } .btn-group > .btn + .dropdown-toggle { padding-right: 8px; padding-left: 8px; } .btn-group > .btn-lg + .dropdown-toggle { padding-right: 12px; padding-left: 12px; } .btn-group.open .dropdown-toggle { -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); } .btn-group.open .dropdown-toggle.btn-link { -webkit-box-shadow: none; box-shadow: none; } .btn .caret { margin-left: 0; } .btn-lg .caret { border-width: 5px 5px 0; border-bottom-width: 0; } .dropup .btn-lg .caret { border-width: 0 5px 5px; } .btn-group-vertical > .btn, .btn-group-vertical > .btn-group, .btn-group-vertical > .btn-group > .btn { display: block; float: none; width: 100%; max-width: 100%; } .btn-group-vertical > .btn-group > .btn { float: none; } .btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, .btn-group-vertical > .btn-group + .btn-group { margin-top: -1px; margin-left: 0; } .btn-group-vertical > .btn:not(:first-child):not(:last-child) { border-radius: 0; } .btn-group-vertical > .btn:first-child:not(:last-child) { border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn:last-child:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0; } .btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { border-top-left-radius: 0; border-top-right-radius: 0; } .btn-group-justified { display: table; width: 100%; table-layout: fixed; border-collapse: separate; } .btn-group-justified > .btn, .btn-group-justified > .btn-group { display: table-cell; float: none; width: 1%; } .btn-group-justified > .btn-group .btn { width: 100%; } .btn-group-justified > .btn-group .dropdown-menu { left: auto; } [data-toggle="buttons"] > .btn input[type="radio"], [data-toggle="buttons"] > .btn-group > .btn input[type="radio"], [data-toggle="buttons"] > .btn input[type="checkbox"], [data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; } .input-group { position: relative; display: table; border-collapse: separate; } .input-group[class*="col-"] { float: none; padding-right: 0; padding-left: 0; } .input-group .form-control { position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0; } .input-group .form-control:focus { z-index: 3; } .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px; } select.input-group-lg > .form-control, select.input-group-lg > .input-group-addon, select.input-group-lg > .input-group-btn > .btn { height: 46px; line-height: 46px; } textarea.input-group-lg > .form-control, textarea.input-group-lg > .input-group-addon, textarea.input-group-lg > .input-group-btn > .btn, select[multiple].input-group-lg > .form-control, select[multiple].input-group-lg > .input-group-addon, select[multiple].input-group-lg > .input-group-btn > .btn { height: auto; } .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } select.input-group-sm > .form-control, select.input-group-sm > .input-group-addon, select.input-group-sm > .input-group-btn > .btn { height: 30px; line-height: 30px; } textarea.input-group-sm > .form-control, textarea.input-group-sm > .input-group-addon, textarea.input-group-sm > .input-group-btn > .btn, select[multiple].input-group-sm > .form-control, select[multiple].input-group-sm > .input-group-addon, select[multiple].input-group-sm > .input-group-btn > .btn { height: auto; } .input-group-addon, .input-group-btn, .input-group .form-control { display: table-cell; } .input-group-addon:not(:first-child):not(:last-child), .input-group-btn:not(:first-child):not(:last-child), .input-group .form-control:not(:first-child):not(:last-child) { border-radius: 0; } .input-group-addon, .input-group-btn { width: 1%; white-space: nowrap; vertical-align: middle; } .input-group-addon { padding: 6px 12px; font-size: 14px; font-weight: normal; line-height: 1; color: #555; text-align: center; background-color: #eee; border: 1px solid #ccc; border-radius: 4px; } .input-group-addon.input-sm { padding: 5px 10px; font-size: 12px; border-radius: 3px; } .input-group-addon.input-lg { padding: 10px 16px; font-size: 18px; border-radius: 6px; } .input-group-addon input[type="radio"], .input-group-addon input[type="checkbox"] { margin-top: 0; } .input-group .form-control:first-child, .input-group-addon:first-child, .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group > .btn, .input-group-btn:first-child > .dropdown-toggle, .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), .input-group-btn:last-child > .btn-group:not(:last-child) > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; } .input-group-addon:first-child { border-right: 0; } .input-group .form-control:last-child, .input-group-addon:last-child, .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group > .btn, .input-group-btn:last-child > .dropdown-toggle, .input-group-btn:first-child > .btn:not(:first-child), .input-group-btn:first-child > .btn-group:not(:first-child) > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; } .input-group-addon:last-child { border-left: 0; } .input-group-btn { position: relative; font-size: 0; white-space: nowrap; } .input-group-btn > .btn { position: relative; } .input-group-btn > .btn + .btn { margin-left: -1px; } .input-group-btn > .btn:hover, .input-group-btn > .btn:focus, .input-group-btn > .btn:active { z-index: 2; } .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group { margin-right: -1px; } .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group { z-index: 2; margin-left: -1px; } .nav { padding-left: 0; margin-bottom: 0; list-style: none; } .nav > li { position: relative; display: block; } .nav > li > a { position: relative; display: block; padding: 10px 15px; } .nav > li > a:hover, .nav > li > a:focus { text-decoration: none; background-color: #eee; } .nav > li.disabled > a { color: #777; } .nav > li.disabled > a:hover, .nav > li.disabled > a:focus { color: #777; text-decoration: none; cursor: not-allowed; background-color: transparent; } .nav .open > a, .nav .open > a:hover, .nav .open > a:focus { background-color: #eee; border-color: #337ab7; } .nav .nav-divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } .nav > li > a > img { max-width: none; } .nav-tabs { border-bottom: 1px solid #ddd; } .nav-tabs > li { float: left; margin-bottom: -1px; } .nav-tabs > li > a { margin-right: 2px; line-height: 1.42857143; border: 1px solid transparent; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover { border-color: #eee #eee #ddd; } .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { color: #555; cursor: default; background-color: #fff; border: 1px solid #ddd; border-bottom-color: transparent; } .nav-tabs.nav-justified { width: 100%; border-bottom: 0; } .nav-tabs.nav-justified > li { float: none; } .nav-tabs.nav-justified > li > a { margin-bottom: 5px; text-align: center; } .nav-tabs.nav-justified > .dropdown .dropdown-menu { top: auto; left: auto; } @media (min-width: 768px) { .nav-tabs.nav-justified > li { display: table-cell; width: 1%; } .nav-tabs.nav-justified > li > a { margin-bottom: 0; } } .nav-tabs.nav-justified > li > a { margin-right: 0; border-radius: 4px; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { border: 1px solid #ddd; } @media (min-width: 768px) { .nav-tabs.nav-justified > li > a { border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { border-bottom-color: #fff; } } .nav-pills > li { float: left; } .nav-pills > li > a { border-radius: 4px; } .nav-pills > li + li { margin-left: 2px; } .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { color: #fff; background-color: #337ab7; } .nav-stacked > li { float: none; } .nav-stacked > li + li { margin-top: 2px; margin-left: 0; } .nav-justified { width: 100%; } .nav-justified > li { float: none; } .nav-justified > li > a { margin-bottom: 5px; text-align: center; } .nav-justified > .dropdown .dropdown-menu { top: auto; left: auto; } @media (min-width: 768px) { .nav-justified > li { display: table-cell; width: 1%; } .nav-justified > li > a { margin-bottom: 0; } } .nav-tabs-justified { border-bottom: 0; } .nav-tabs-justified > li > a { margin-right: 0; border-radius: 4px; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { border: 1px solid #ddd; } @media (min-width: 768px) { .nav-tabs-justified > li > a { border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { border-bottom-color: #fff; } } .tab-content > .tab-pane { display: none; } .tab-content > .active { display: block; } .nav-tabs .dropdown-menu { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; } .navbar { position: relative; min-height: 50px; margin-bottom: 20px; border: 1px solid transparent; } @media (min-width: 768px) { .navbar { border-radius: 4px; } } @media (min-width: 768px) { .navbar-header { float: left; } } .navbar-collapse { padding-right: 15px; padding-left: 15px; overflow-x: visible; -webkit-overflow-scrolling: touch; border-top: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); } .navbar-collapse.in { overflow-y: auto; } @media (min-width: 768px) { .navbar-collapse { width: auto; border-top: 0; -webkit-box-shadow: none; box-shadow: none; } .navbar-collapse.collapse { display: block !important; height: auto !important; padding-bottom: 0; overflow: visible !important; } .navbar-collapse.in { overflow-y: visible; } .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { padding-right: 0; padding-left: 0; } } .navbar-fixed-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { max-height: 340px; } @media (max-device-width: 480px) and (orientation: landscape) { .navbar-fixed-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { max-height: 200px; } } .container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse { margin-right: -15px; margin-left: -15px; } @media (min-width: 768px) { .container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse { margin-right: 0; margin-left: 0; } } .navbar-static-top { z-index: 1000; border-width: 0 0 1px; } @media (min-width: 768px) { .navbar-static-top { border-radius: 0; } } .navbar-fixed-top, .navbar-fixed-bottom { position: fixed; right: 0; left: 0; z-index: 1030; } @media (min-width: 768px) { .navbar-fixed-top, .navbar-fixed-bottom { border-radius: 0; } } .navbar-fixed-top { top: 0; border-width: 0 0 1px; } .navbar-fixed-bottom { bottom: 0; margin-bottom: 0; border-width: 1px 0 0; } .navbar-brand { float: left; height: 50px; padding: 15px 15px; font-size: 18px; line-height: 20px; } .navbar-brand:hover, .navbar-brand:focus { text-decoration: none; } .navbar-brand > img { display: block; } @media (min-width: 768px) { .navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand { margin-left: -15px; } } .navbar-toggle { position: relative; float: right; padding: 9px 10px; margin-top: 8px; margin-right: 15px; margin-bottom: 8px; background-color: transparent; background-image: none; border: 1px solid transparent; border-radius: 4px; } .navbar-toggle:focus { outline: 0; } .navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; border-radius: 1px; } .navbar-toggle .icon-bar + .icon-bar { margin-top: 4px; } @media (min-width: 768px) { .navbar-toggle { display: none; } } .navbar-nav { margin: 7.5px -15px; } .navbar-nav > li > a { padding-top: 10px; padding-bottom: 10px; line-height: 20px; } @media (max-width: 767px) { .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; -webkit-box-shadow: none; box-shadow: none; } .navbar-nav .open .dropdown-menu > li > a, .navbar-nav .open .dropdown-menu .dropdown-header { padding: 5px 15px 5px 25px; } .navbar-nav .open .dropdown-menu > li > a { line-height: 20px; } .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-nav .open .dropdown-menu > li > a:focus { background-image: none; } } @media (min-width: 768px) { .navbar-nav { float: left; margin: 0; } .navbar-nav > li { float: left; } .navbar-nav > li > a { padding-top: 15px; padding-bottom: 15px; } } .navbar-form { padding: 10px 15px; margin-top: 8px; margin-right: -15px; margin-bottom: 8px; margin-left: -15px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); } @media (min-width: 768px) { .navbar-form .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } .navbar-form .form-control { display: inline-block; width: auto; vertical-align: middle; } .navbar-form .form-control-static { display: inline-block; } .navbar-form .input-group { display: inline-table; vertical-align: middle; } .navbar-form .input-group .input-group-addon, .navbar-form .input-group .input-group-btn, .navbar-form .input-group .form-control { width: auto; } .navbar-form .input-group > .form-control { width: 100%; } .navbar-form .control-label { margin-bottom: 0; vertical-align: middle; } .navbar-form .radio, .navbar-form .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle; } .navbar-form .radio label, .navbar-form .checkbox label { padding-left: 0; } .navbar-form .radio input[type="radio"], .navbar-form .checkbox input[type="checkbox"] { position: relative; margin-left: 0; } .navbar-form .has-feedback .form-control-feedback { top: 0; } } @media (max-width: 767px) { .navbar-form .form-group { margin-bottom: 5px; } .navbar-form .form-group:last-child { margin-bottom: 0; } } @media (min-width: 768px) { .navbar-form { width: auto; padding-top: 0; padding-bottom: 0; margin-right: 0; margin-left: 0; border: 0; -webkit-box-shadow: none; box-shadow: none; } } .navbar-nav > li > .dropdown-menu { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; } .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { margin-bottom: 0; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .navbar-btn { margin-top: 8px; margin-bottom: 8px; } .navbar-btn.btn-sm { margin-top: 10px; margin-bottom: 10px; } .navbar-btn.btn-xs { margin-top: 14px; margin-bottom: 14px; } .navbar-text { margin-top: 15px; margin-bottom: 15px; } @media (min-width: 768px) { .navbar-text { float: left; margin-right: 15px; margin-left: 15px; } } @media (min-width: 768px) { .navbar-left { float: left !important; } .navbar-right { float: right !important; margin-right: -15px; } .navbar-right ~ .navbar-right { margin-right: 0; } } .navbar-default { background-color: #f8f8f8; border-color: #e7e7e7; } .navbar-default .navbar-brand { color: #777; } .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { color: #5e5e5e; background-color: transparent; } .navbar-default .navbar-text { color: #777; } .navbar-default .navbar-nav > li > a { color: #777; } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { color: #333; background-color: transparent; } .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { color: #555; background-color: #e7e7e7; } .navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:hover, .navbar-default .navbar-nav > .disabled > a:focus { color: #ccc; background-color: transparent; } .navbar-default .navbar-toggle { border-color: #ddd; } .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { background-color: #ddd; } .navbar-default .navbar-toggle .icon-bar { background-color: #888; } .navbar-default .navbar-collapse, .navbar-default .navbar-form { border-color: #e7e7e7; } .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus { color: #555; background-color: #e7e7e7; } @media (max-width: 767px) { .navbar-default .navbar-nav .open .dropdown-menu > li > a { color: #777; } .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { color: #333; background-color: transparent; } .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { color: #555; background-color: #e7e7e7; } .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { color: #ccc; background-color: transparent; } } .navbar-default .navbar-link { color: #777; } .navbar-default .navbar-link:hover { color: #333; } .navbar-default .btn-link { color: #777; } .navbar-default .btn-link:hover, .navbar-default .btn-link:focus { color: #333; } .navbar-default .btn-link[disabled]:hover, fieldset[disabled] .navbar-default .btn-link:hover, .navbar-default .btn-link[disabled]:focus, fieldset[disabled] .navbar-default .btn-link:focus { color: #ccc; } .navbar-inverse { background-color: #222; border-color: #080808; } .navbar-inverse .navbar-brand { color: #9d9d9d; } .navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand:focus { color: #fff; background-color: transparent; } .navbar-inverse .navbar-text { color: #9d9d9d; } .navbar-inverse .navbar-nav > li > a { color: #9d9d9d; } .navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus { color: #fff; background-color: transparent; } .navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus { color: #fff; background-color: #080808; } .navbar-inverse .navbar-nav > .disabled > a, .navbar-inverse .navbar-nav > .disabled > a:hover, .navbar-inverse .navbar-nav > .disabled > a:focus { color: #444; background-color: transparent; } .navbar-inverse .navbar-toggle { border-color: #333; } .navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus { background-color: #333; } .navbar-inverse .navbar-toggle .icon-bar { background-color: #fff; } .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { border-color: #101010; } .navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus { color: #fff; background-color: #080808; } @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { border-color: #080808; } .navbar-inverse .navbar-nav .open .dropdown-menu .divider { background-color: #080808; } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { color: #9d9d9d; } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { color: #fff; background-color: transparent; } .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { color: #fff; background-color: #080808; } .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { color: #444; background-color: transparent; } } .navbar-inverse .navbar-link { color: #9d9d9d; } .navbar-inverse .navbar-link:hover { color: #fff; } .navbar-inverse .btn-link { color: #9d9d9d; } .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link:focus { color: #fff; } .navbar-inverse .btn-link[disabled]:hover, fieldset[disabled] .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link[disabled]:focus, fieldset[disabled] .navbar-inverse .btn-link:focus { color: #444; } .breadcrumb { padding: 8px 15px; margin-bottom: 20px; list-style: none; background-color: #f5f5f5; border-radius: 4px; } .breadcrumb > li { display: inline-block; } .breadcrumb > li + li:before { padding: 0 5px; color: #ccc; content: "/\00a0"; } .breadcrumb > .active { color: #777; } .pagination { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px; } .pagination > li { display: inline; } .pagination > li > a, .pagination > li > span { position: relative; float: left; padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; color: #337ab7; text-decoration: none; background-color: #fff; border: 1px solid #ddd; } .pagination > li:first-child > a, .pagination > li:first-child > span { margin-left: 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px; } .pagination > li:last-child > a, .pagination > li:last-child > span { border-top-right-radius: 4px; border-bottom-right-radius: 4px; } .pagination > li > a:hover, .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { z-index: 2; color: #23527c; background-color: #eee; border-color: #ddd; } .pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { z-index: 3; color: #fff; cursor: default; background-color: #337ab7; border-color: #337ab7; } .pagination > .disabled > span, .pagination > .disabled > span:hover, .pagination > .disabled > span:focus, .pagination > .disabled > a, .pagination > .disabled > a:hover, .pagination > .disabled > a:focus { color: #777; cursor: not-allowed; background-color: #fff; border-color: #ddd; } .pagination-lg > li > a, .pagination-lg > li > span { padding: 10px 16px; font-size: 18px; line-height: 1.3333333; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-top-right-radius: 6px; border-bottom-right-radius: 6px; } .pagination-sm > li > a, .pagination-sm > li > span { padding: 5px 10px; font-size: 12px; line-height: 1.5; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-top-left-radius: 3px; border-bottom-left-radius: 3px; } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-top-right-radius: 3px; border-bottom-right-radius: 3px; } .pager { padding-left: 0; margin: 20px 0; text-align: center; list-style: none; } .pager li { display: inline; } .pager li > a, .pager li > span { display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; border-radius: 15px; } .pager li > a:hover, .pager li > a:focus { text-decoration: none; background-color: #eee; } .pager .next > a, .pager .next > span { float: right; } .pager .previous > a, .pager .previous > span { float: left; } .pager .disabled > a, .pager .disabled > a:hover, .pager .disabled > a:focus, .pager .disabled > span { color: #777; cursor: not-allowed; background-color: #fff; } .label { display: inline; padding: .2em .6em .3em; font-size: 75%; font-weight: bold; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25em; } a.label:hover, a.label:focus { color: #fff; text-decoration: none; cursor: pointer; } .label:empty { display: none; } .btn .label { position: relative; top: -1px; } .label-default { background-color: #777; } .label-default[href]:hover, .label-default[href]:focus { background-color: #5e5e5e; } .label-primary { background-color: #337ab7; } .label-primary[href]:hover, .label-primary[href]:focus { background-color: #286090; } .label-success { background-color: #5cb85c; } .label-success[href]:hover, .label-success[href]:focus { background-color: #449d44; } .label-info { background-color: #5bc0de; } .label-info[href]:hover, .label-info[href]:focus { background-color: #31b0d5; } .label-warning { background-color: #f0ad4e; } .label-warning[href]:hover, .label-warning[href]:focus { background-color: #ec971f; } .label-danger { background-color: #d9534f; } .label-danger[href]:hover, .label-danger[href]:focus { background-color: #c9302c; } .badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 12px; font-weight: bold; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: middle; background-color: #777; border-radius: 10px; } .badge:empty { display: none; } .btn .badge { position: relative; top: -1px; } .btn-xs .badge, .btn-group-xs > .btn .badge { top: 0; padding: 1px 5px; } a.badge:hover, a.badge:focus { color: #fff; text-decoration: none; cursor: pointer; } .list-group-item.active > .badge, .nav-pills > .active > a > .badge { color: #337ab7; background-color: #fff; } .list-group-item > .badge { float: right; } .list-group-item > .badge + .badge { margin-right: 5px; } .nav-pills > li > a > .badge { margin-left: 3px; } .jumbotron { padding-top: 30px; padding-bottom: 30px; margin-bottom: 30px; color: inherit; background-color: #eee; } .jumbotron h1, .jumbotron .h1 { color: inherit; } .jumbotron p { margin-bottom: 15px; font-size: 21px; font-weight: 200; } .jumbotron > hr { border-top-color: #d5d5d5; } .container .jumbotron, .container-fluid .jumbotron { padding-right: 15px; padding-left: 15px; border-radius: 6px; } .jumbotron .container { max-width: 100%; } @media screen and (min-width: 768px) { .jumbotron { padding-top: 48px; padding-bottom: 48px; } .container .jumbotron, .container-fluid .jumbotron { padding-right: 60px; padding-left: 60px; } .jumbotron h1, .jumbotron .h1 { font-size: 63px; } } .thumbnail { display: block; padding: 4px; margin-bottom: 20px; line-height: 1.42857143; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: border .2s ease-in-out; -o-transition: border .2s ease-in-out; transition: border .2s ease-in-out; } .thumbnail > img, .thumbnail a > img { margin-right: auto; margin-left: auto; } a.thumbnail:hover, a.thumbnail:focus, a.thumbnail.active { border-color: #337ab7; } .thumbnail .caption { padding: 9px; color: #333; } .alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; } .alert h4 { margin-top: 0; color: inherit; } .alert .alert-link { font-weight: bold; } .alert > p, .alert > ul { margin-bottom: 0; } .alert > p + p { margin-top: 5px; } .alert-dismissable, .alert-dismissible { padding-right: 35px; } .alert-dismissable .close, .alert-dismissible .close { position: relative; top: -2px; right: -21px; color: inherit; } .alert-success { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; } .alert-success hr { border-top-color: #c9e2b3; } .alert-success .alert-link { color: #2b542c; } .alert-info { color: #31708f; background-color: #d9edf7; border-color: #bce8f1; } .alert-info hr { border-top-color: #a6e1ec; } .alert-info .alert-link { color: #245269; } .alert-warning { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; } .alert-warning hr { border-top-color: #f7e1b5; } .alert-warning .alert-link { color: #66512c; } .alert-danger { color: #a94442; background-color: #f2dede; border-color: #ebccd1; } .alert-danger hr { border-top-color: #e4b9c0; } .alert-danger .alert-link { color: #843534; } @-webkit-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-o-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } .progress { height: 20px; margin-bottom: 20px; overflow: hidden; background-color: #f5f5f5; border-radius: 4px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); } .progress-bar { float: left; width: 0; height: 100%; font-size: 12px; line-height: 20px; color: #fff; text-align: center; background-color: #337ab7; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); -webkit-transition: width .6s ease; -o-transition: width .6s ease; transition: width .6s ease; } .progress-striped .progress-bar, .progress-bar-striped { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; background-size: 40px 40px; } .progress.active .progress-bar, .progress-bar.active { -webkit-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite; } .progress-bar-success { background-color: #5cb85c; } .progress-striped .progress-bar-success { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); } .progress-bar-info { background-color: #5bc0de; } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); } .progress-bar-warning { background-color: #f0ad4e; } .progress-striped .progress-bar-warning { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); } .progress-bar-danger { background-color: #d9534f; } .progress-striped .progress-bar-danger { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); } .media { margin-top: 15px; } .media:first-child { margin-top: 0; } .media, .media-body { overflow: hidden; zoom: 1; } .media-body { width: 10000px; } .media-object { display: block; } .media-object.img-thumbnail { max-width: none; } .media-right, .media > .pull-right { padding-left: 10px; } .media-left, .media > .pull-left { padding-right: 10px; } .media-left, .media-right, .media-body { display: table-cell; vertical-align: top; } .media-middle { vertical-align: middle; } .media-bottom { vertical-align: bottom; } .media-heading { margin-top: 0; margin-bottom: 5px; } .media-list { padding-left: 0; list-style: none; } .list-group { padding-left: 0; margin-bottom: 20px; } .list-group-item { position: relative; display: block; padding: 10px 15px; margin-bottom: -1px; background-color: #fff; border: 1px solid #ddd; } .list-group-item:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px; } .list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } a.list-group-item, button.list-group-item { color: #555; } a.list-group-item .list-group-item-heading, button.list-group-item .list-group-item-heading { color: #333; } a.list-group-item:hover, button.list-group-item:hover, a.list-group-item:focus, button.list-group-item:focus { color: #555; text-decoration: none; background-color: #f5f5f5; } button.list-group-item { width: 100%; text-align: left; } .list-group-item.disabled, .list-group-item.disabled:hover, .list-group-item.disabled:focus { color: #777; cursor: not-allowed; background-color: #eee; } .list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading { color: inherit; } .list-group-item.disabled .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text { color: #777; } .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { z-index: 2; color: #fff; background-color: #337ab7; border-color: #337ab7; } .list-group-item.active .list-group-item-heading, .list-group-item.active:hover .list-group-item-heading, .list-group-item.active:focus .list-group-item-heading, .list-group-item.active .list-group-item-heading > small, .list-group-item.active:hover .list-group-item-heading > small, .list-group-item.active:focus .list-group-item-heading > small, .list-group-item.active .list-group-item-heading > .small, .list-group-item.active:hover .list-group-item-heading > .small, .list-group-item.active:focus .list-group-item-heading > .small { color: inherit; } .list-group-item.active .list-group-item-text, .list-group-item.active:hover .list-group-item-text, .list-group-item.active:focus .list-group-item-text { color: #c7ddef; } .list-group-item-success { color: #3c763d; background-color: #dff0d8; } a.list-group-item-success, button.list-group-item-success { color: #3c763d; } a.list-group-item-success .list-group-item-heading, button.list-group-item-success .list-group-item-heading { color: inherit; } a.list-group-item-success:hover, button.list-group-item-success:hover, a.list-group-item-success:focus, button.list-group-item-success:focus { color: #3c763d; background-color: #d0e9c6; } a.list-group-item-success.active, button.list-group-item-success.active, a.list-group-item-success.active:hover, button.list-group-item-success.active:hover, a.list-group-item-success.active:focus, button.list-group-item-success.active:focus { color: #fff; background-color: #3c763d; border-color: #3c763d; } .list-group-item-info { color: #31708f; background-color: #d9edf7; } a.list-group-item-info, button.list-group-item-info { color: #31708f; } a.list-group-item-info .list-group-item-heading, button.list-group-item-info .list-group-item-heading { color: inherit; } a.list-group-item-info:hover, button.list-group-item-info:hover, a.list-group-item-info:focus, button.list-group-item-info:focus { color: #31708f; background-color: #c4e3f3; } a.list-group-item-info.active, button.list-group-item-info.active, a.list-group-item-info.active:hover, button.list-group-item-info.active:hover, a.list-group-item-info.active:focus, button.list-group-item-info.active:focus { color: #fff; background-color: #31708f; border-color: #31708f; } .list-group-item-warning { color: #8a6d3b; background-color: #fcf8e3; } a.list-group-item-warning, button.list-group-item-warning { color: #8a6d3b; } a.list-group-item-warning .list-group-item-heading, button.list-group-item-warning .list-group-item-heading { color: inherit; } a.list-group-item-warning:hover, button.list-group-item-warning:hover, a.list-group-item-warning:focus, button.list-group-item-warning:focus { color: #8a6d3b; background-color: #faf2cc; } a.list-group-item-warning.active, button.list-group-item-warning.active, a.list-group-item-warning.active:hover, button.list-group-item-warning.active:hover, a.list-group-item-warning.active:focus, button.list-group-item-warning.active:focus { color: #fff; background-color: #8a6d3b; border-color: #8a6d3b; } .list-group-item-danger { color: #a94442; background-color: #f2dede; } a.list-group-item-danger, button.list-group-item-danger { color: #a94442; } a.list-group-item-danger .list-group-item-heading, button.list-group-item-danger .list-group-item-heading { color: inherit; } a.list-group-item-danger:hover, button.list-group-item-danger:hover, a.list-group-item-danger:focus, button.list-group-item-danger:focus { color: #a94442; background-color: #ebcccc; } a.list-group-item-danger.active, button.list-group-item-danger.active, a.list-group-item-danger.active:hover, button.list-group-item-danger.active:hover, a.list-group-item-danger.active:focus, button.list-group-item-danger.active:focus { color: #fff; background-color: #a94442; border-color: #a94442; } .list-group-item-heading { margin-top: 0; margin-bottom: 5px; } .list-group-item-text { margin-bottom: 0; line-height: 1.3; } .panel { margin-bottom: 20px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); box-shadow: 0 1px 1px rgba(0, 0, 0, .05); } .panel-body { padding: 15px; } .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel-heading > .dropdown .dropdown-toggle { color: inherit; } .panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit; } .panel-title > a, .panel-title > small, .panel-title > .small, .panel-title > small > a, .panel-title > .small > a { color: inherit; } .panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #ddd; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .list-group, .panel > .panel-collapse > .list-group { margin-bottom: 0; } .panel > .list-group .list-group-item, .panel > .panel-collapse > .list-group .list-group-item { border-width: 1px 0; border-radius: 0; } .panel > .list-group:first-child .list-group-item:first-child, .panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { border-top: 0; border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel > .list-group:last-child .list-group-item:last-child, .panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { border-bottom: 0; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { border-top-left-radius: 0; border-top-right-radius: 0; } .panel-heading + .list-group .list-group-item:first-child { border-top-width: 0; } .list-group + .panel-footer { border-top-width: 0; } .panel > .table, .panel > .table-responsive > .table, .panel > .panel-collapse > .table { margin-bottom: 0; } .panel > .table caption, .panel > .table-responsive > .table caption, .panel > .panel-collapse > .table caption { padding-right: 15px; padding-left: 15px; } .panel > .table:first-child, .panel > .table-responsive:first-child > .table:first-child { border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { border-top-left-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { border-top-right-radius: 3px; } .panel > .table:last-child, .panel > .table-responsive:last-child > .table:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { border-bottom-left-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { border-bottom-right-radius: 3px; } .panel > .panel-body + .table, .panel > .panel-body + .table-responsive, .panel > .table + .panel-body, .panel > .table-responsive + .panel-body { border-top: 1px solid #ddd; } .panel > .table > tbody:first-child > tr:first-child th, .panel > .table > tbody:first-child > tr:first-child td { border-top: 0; } .panel > .table-bordered, .panel > .table-responsive > .table-bordered { border: 0; } .panel > .table-bordered > thead > tr > th:first-child, .panel > .table-responsive > .table-bordered > thead > tr > th:first-child, .panel > .table-bordered > tbody > tr > th:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, .panel > .table-bordered > tfoot > tr > th:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, .panel > .table-bordered > thead > tr > td:first-child, .panel > .table-responsive > .table-bordered > thead > tr > td:first-child, .panel > .table-bordered > tbody > tr > td:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, .panel > .table-bordered > tfoot > tr > td:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { border-left: 0; } .panel > .table-bordered > thead > tr > th:last-child, .panel > .table-responsive > .table-bordered > thead > tr > th:last-child, .panel > .table-bordered > tbody > tr > th:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, .panel > .table-bordered > tfoot > tr > th:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, .panel > .table-bordered > thead > tr > td:last-child, .panel > .table-responsive > .table-bordered > thead > tr > td:last-child, .panel > .table-bordered > tbody > tr > td:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, .panel > .table-bordered > tfoot > tr > td:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { border-right: 0; } .panel > .table-bordered > thead > tr:first-child > td, .panel > .table-responsive > .table-bordered > thead > tr:first-child > td, .panel > .table-bordered > tbody > tr:first-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, .panel > .table-bordered > thead > tr:first-child > th, .panel > .table-responsive > .table-bordered > thead > tr:first-child > th, .panel > .table-bordered > tbody > tr:first-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { border-bottom: 0; } .panel > .table-bordered > tbody > tr:last-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, .panel > .table-bordered > tfoot > tr:last-child > td, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, .panel > .table-bordered > tbody > tr:last-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, .panel > .table-bordered > tfoot > tr:last-child > th, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { border-bottom: 0; } .panel > .table-responsive { margin-bottom: 0; border: 0; } .panel-group { margin-bottom: 20px; } .panel-group .panel { margin-bottom: 0; border-radius: 4px; } .panel-group .panel + .panel { margin-top: 5px; } .panel-group .panel-heading { border-bottom: 0; } .panel-group .panel-heading + .panel-collapse > .panel-body, .panel-group .panel-heading + .panel-collapse > .list-group { border-top: 1px solid #ddd; } .panel-group .panel-footer { border-top: 0; } .panel-group .panel-footer + .panel-collapse .panel-body { border-bottom: 1px solid #ddd; } .panel-default { border-color: #ddd; } .panel-default > .panel-heading { color: #333; background-color: #f5f5f5; border-color: #ddd; } .panel-default > .panel-heading + .panel-collapse > .panel-body { border-top-color: #ddd; } .panel-default > .panel-heading .badge { color: #f5f5f5; background-color: #333; } .panel-default > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #ddd; } .panel-primary { border-color: #337ab7; } .panel-primary > .panel-heading { color: #fff; background-color: #337ab7; border-color: #337ab7; } .panel-primary > .panel-heading + .panel-collapse > .panel-body { border-top-color: #337ab7; } .panel-primary > .panel-heading .badge { color: #337ab7; background-color: #fff; } .panel-primary > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #337ab7; } .panel-success { border-color: #d6e9c6; } .panel-success > .panel-heading { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; } .panel-success > .panel-heading + .panel-collapse > .panel-body { border-top-color: #d6e9c6; } .panel-success > .panel-heading .badge { color: #dff0d8; background-color: #3c763d; } .panel-success > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #d6e9c6; } .panel-info { border-color: #bce8f1; } .panel-info > .panel-heading { color: #31708f; background-color: #d9edf7; border-color: #bce8f1; } .panel-info > .panel-heading + .panel-collapse > .panel-body { border-top-color: #bce8f1; } .panel-info > .panel-heading .badge { color: #d9edf7; background-color: #31708f; } .panel-info > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #bce8f1; } .panel-warning { border-color: #faebcc; } .panel-warning > .panel-heading { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; } .panel-warning > .panel-heading + .panel-collapse > .panel-body { border-top-color: #faebcc; } .panel-warning > .panel-heading .badge { color: #fcf8e3; background-color: #8a6d3b; } .panel-warning > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #faebcc; } .panel-danger { border-color: #ebccd1; } .panel-danger > .panel-heading { color: #a94442; background-color: #f2dede; border-color: #ebccd1; } .panel-danger > .panel-heading + .panel-collapse > .panel-body { border-top-color: #ebccd1; } .panel-danger > .panel-heading .badge { color: #f2dede; background-color: #a94442; } .panel-danger > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #ebccd1; } .embed-responsive { position: relative; display: block; height: 0; padding: 0; overflow: hidden; } .embed-responsive .embed-responsive-item, .embed-responsive iframe, .embed-responsive embed, .embed-responsive object, .embed-responsive video { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; height: 100%; border: 0; } .embed-responsive-16by9 { padding-bottom: 56.25%; } .embed-responsive-4by3 { padding-bottom: 75%; } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, .15); } .well-lg { padding: 24px; border-radius: 6px; } .well-sm { padding: 9px; border-radius: 3px; } .close { float: right; font-size: 21px; font-weight: bold; line-height: 1; color: #000; text-shadow: 0 1px 0 #fff; filter: alpha(opacity=20); opacity: .2; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; filter: alpha(opacity=50); opacity: .5; } button.close { -webkit-appearance: none; padding: 0; cursor: pointer; background: transparent; border: 0; } .modal-open { overflow: hidden; } .modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; display: none; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0; } .modal.fade .modal-dialog { -webkit-transition: -webkit-transform .3s ease-out; -o-transition: -o-transform .3s ease-out; transition: transform .3s ease-out; -webkit-transform: translate(0, -25%); -ms-transform: translate(0, -25%); -o-transform: translate(0, -25%); transform: translate(0, -25%); } .modal.in .modal-dialog { -webkit-transform: translate(0, 0); -ms-transform: translate(0, 0); -o-transform: translate(0, 0); transform: translate(0, 0); } .modal-open .modal { overflow-x: hidden; overflow-y: auto; } .modal-dialog { position: relative; width: auto; margin: 10px; } .modal-content { position: relative; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; outline: 0; -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5); box-shadow: 0 3px 9px rgba(0, 0, 0, .5); } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000; } .modal-backdrop.fade { filter: alpha(opacity=0); opacity: 0; } .modal-backdrop.in { filter: alpha(opacity=50); opacity: .5; } .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; } .modal-header .close { margin-top: -2px; } .modal-title { margin: 0; line-height: 1.42857143; } .modal-body { position: relative; padding: 15px; } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5; } .modal-footer .btn + .btn { margin-bottom: 0; margin-left: 5px; } .modal-footer .btn-group .btn + .btn { margin-left: -1px; } .modal-footer .btn-block + .btn-block { margin-left: 0; } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto; } .modal-content { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); box-shadow: 0 5px 15px rgba(0, 0, 0, .5); } .modal-sm { width: 300px; } } @media (min-width: 992px) { .modal-lg { width: 900px; } } .tooltip { position: absolute; z-index: 1070; display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; letter-spacing: normal; word-break: normal; word-spacing: normal; word-wrap: normal; white-space: normal; filter: alpha(opacity=0); opacity: 0; line-break: auto; } .tooltip.in { filter: alpha(opacity=90); opacity: .9; } .tooltip.top { padding: 5px 0; margin-top: -3px; } .tooltip.right { padding: 0 5px; margin-left: 3px; } .tooltip.bottom { padding: 5px 0; margin-top: 3px; } .tooltip.left { padding: 0 5px; margin-left: -3px; } .tooltip-inner { max-width: 200px; padding: 3px 8px; color: #fff; text-align: center; background-color: #000; border-radius: 4px; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid; } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000; } .tooltip.top-left .tooltip-arrow { right: 5px; bottom: 0; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000; } .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000; } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000; } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000; } .popover { position: absolute; top: 0; left: 0; z-index: 1060; display: none; max-width: 276px; padding: 1px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; letter-spacing: normal; word-break: normal; word-spacing: normal; word-wrap: normal; white-space: normal; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); box-shadow: 0 5px 10px rgba(0, 0, 0, .2); line-break: auto; } .popover.top { margin-top: -10px; } .popover.right { margin-left: 10px; } .popover.bottom { margin-top: 10px; } .popover.left { margin-left: -10px; } .popover-title { padding: 8px 14px; margin: 0; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0; } .popover-content { padding: 9px 14px; } .popover > .arrow, .popover > .arrow:after { position: absolute; display: block; width: 0; height: 0; border-color: transparent; border-style: solid; } .popover > .arrow { border-width: 11px; } .popover > .arrow:after { content: ""; border-width: 10px; } .popover.top > .arrow { bottom: -11px; left: 50%; margin-left: -11px; border-top-color: #999; border-top-color: rgba(0, 0, 0, .25); border-bottom-width: 0; } .popover.top > .arrow:after { bottom: 1px; margin-left: -10px; content: " "; border-top-color: #fff; border-bottom-width: 0; } .popover.right > .arrow { top: 50%; left: -11px; margin-top: -11px; border-right-color: #999; border-right-color: rgba(0, 0, 0, .25); border-left-width: 0; } .popover.right > .arrow:after { bottom: -10px; left: 1px; content: " "; border-right-color: #fff; border-left-width: 0; } .popover.bottom > .arrow { top: -11px; left: 50%; margin-left: -11px; border-top-width: 0; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, .25); } .popover.bottom > .arrow:after { top: 1px; margin-left: -10px; content: " "; border-top-width: 0; border-bottom-color: #fff; } .popover.left > .arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; border-left-color: #999; border-left-color: rgba(0, 0, 0, .25); } .popover.left > .arrow:after { right: 1px; bottom: -10px; content: " "; border-right-width: 0; border-left-color: #fff; } .carousel { position: relative; } .carousel-inner { position: relative; width: 100%; overflow: hidden; } .carousel-inner > .item { position: relative; display: none; -webkit-transition: .6s ease-in-out left; -o-transition: .6s ease-in-out left; transition: .6s ease-in-out left; } .carousel-inner > .item > img, .carousel-inner > .item > a > img { line-height: 1; } @media all and (transform-3d), (-webkit-transform-3d) { .carousel-inner > .item { -webkit-transition: -webkit-transform .6s ease-in-out; -o-transition: -o-transform .6s ease-in-out; transition: transform .6s ease-in-out; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-perspective: 1000px; perspective: 1000px; } .carousel-inner > .item.next, .carousel-inner > .item.active.right { left: 0; -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); } .carousel-inner > .item.prev, .carousel-inner > .item.active.left { left: 0; -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); } .carousel-inner > .item.next.left, .carousel-inner > .item.prev.right, .carousel-inner > .item.active { left: 0; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } } .carousel-inner > .active, .carousel-inner > .next, .carousel-inner > .prev { display: block; } .carousel-inner > .active { left: 0; } .carousel-inner > .next, .carousel-inner > .prev { position: absolute; top: 0; width: 100%; } .carousel-inner > .next { left: 100%; } .carousel-inner > .prev { left: -100%; } .carousel-inner > .next.left, .carousel-inner > .prev.right { left: 0; } .carousel-inner > .active.left { left: -100%; } .carousel-inner > .active.right { left: 100%; } .carousel-control { position: absolute; top: 0; bottom: 0; left: 0; width: 15%; font-size: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, 0); filter: alpha(opacity=50); opacity: .5; } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); background-repeat: repeat-x; } .carousel-control.right { right: 0; left: auto; background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5))); background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); background-repeat: repeat-x; } .carousel-control:hover, .carousel-control:focus { color: #fff; text-decoration: none; filter: alpha(opacity=90); outline: 0; opacity: .9; } .carousel-control .icon-prev, .carousel-control .icon-next, .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right { position: absolute; top: 50%; z-index: 5; display: inline-block; margin-top: -10px; } .carousel-control .icon-prev, .carousel-control .glyphicon-chevron-left { left: 50%; margin-left: -10px; } .carousel-control .icon-next, .carousel-control .glyphicon-chevron-right { right: 50%; margin-right: -10px; } .carousel-control .icon-prev, .carousel-control .icon-next { width: 20px; height: 20px; font-family: serif; line-height: 1; } .carousel-control .icon-prev:before { content: '\2039'; } .carousel-control .icon-next:before { content: '\203a'; } .carousel-indicators { position: absolute; bottom: 10px; left: 50%; z-index: 15; width: 60%; padding-left: 0; margin-left: -30%; text-align: center; list-style: none; } .carousel-indicators li { display: inline-block; width: 10px; height: 10px; margin: 1px; text-indent: -999px; cursor: pointer; background-color: #000 \9; background-color: rgba(0, 0, 0, 0); border: 1px solid #fff; border-radius: 10px; } .carousel-indicators .active { width: 12px; height: 12px; margin: 0; background-color: #fff; } .carousel-caption { position: absolute; right: 15%; bottom: 20px; left: 15%; z-index: 10; padding-top: 20px; padding-bottom: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); } .carousel-caption .btn { text-shadow: none; } @media screen and (min-width: 768px) { .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-prev, .carousel-control .icon-next { width: 30px; height: 30px; margin-top: -10px; font-size: 30px; } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { margin-left: -10px; } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { margin-right: -10px; } .carousel-caption { right: 20%; left: 20%; padding-bottom: 30px; } .carousel-indicators { bottom: 20px; } } .clearfix:before, .clearfix:after, .dl-horizontal dd:before, .dl-horizontal dd:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, .form-horizontal .form-group:before, .form-horizontal .form-group:after, .btn-toolbar:before, .btn-toolbar:after, .btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after, .nav:before, .nav:after, .navbar:before, .navbar:after, .navbar-header:before, .navbar-header:after, .navbar-collapse:before, .navbar-collapse:after, .pager:before, .pager:after, .panel-body:before, .panel-body:after, .modal-header:before, .modal-header:after, .modal-footer:before, .modal-footer:after { display: table; content: " "; } .clearfix:after, .dl-horizontal dd:after, .container:after, .container-fluid:after, .row:after, .form-horizontal .form-group:after, .btn-toolbar:after, .btn-group-vertical > .btn-group:after, .nav:after, .navbar:after, .navbar-header:after, .navbar-collapse:after, .pager:after, .panel-body:after, .modal-header:after, .modal-footer:after { clear: both; } .center-block { display: block; margin-right: auto; margin-left: auto; } .pull-right { float: right !important; } .pull-left { float: left !important; } .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .hidden { display: none !important; } .affix { position: fixed; } @-ms-viewport { width: device-width; } .visible-xs, .visible-sm, .visible-md, .visible-lg { display: none !important; } .visible-xs-block, .visible-xs-inline, .visible-xs-inline-block, .visible-sm-block, .visible-sm-inline, .visible-sm-inline-block, .visible-md-block, .visible-md-inline, .visible-md-inline-block, .visible-lg-block, .visible-lg-inline, .visible-lg-inline-block { display: none !important; } @media (max-width: 767px) { .visible-xs { display: block !important; } table.visible-xs { display: table !important; } tr.visible-xs { display: table-row !important; } th.visible-xs, td.visible-xs { display: table-cell !important; } } @media (max-width: 767px) { .visible-xs-block { display: block !important; } } @media (max-width: 767px) { .visible-xs-inline { display: inline !important; } } @media (max-width: 767px) { .visible-xs-inline-block { display: inline-block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm { display: block !important; } table.visible-sm { display: table !important; } tr.visible-sm { display: table-row !important; } th.visible-sm, td.visible-sm { display: table-cell !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline { display: inline !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline-block { display: inline-block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md { display: block !important; } table.visible-md { display: table !important; } tr.visible-md { display: table-row !important; } th.visible-md, td.visible-md { display: table-cell !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-block { display: block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline { display: inline !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline-block { display: inline-block !important; } } @media (min-width: 1200px) { .visible-lg { display: block !important; } table.visible-lg { display: table !important; } tr.visible-lg { display: table-row !important; } th.visible-lg, td.visible-lg { display: table-cell !important; } } @media (min-width: 1200px) { .visible-lg-block { display: block !important; } } @media (min-width: 1200px) { .visible-lg-inline { display: inline !important; } } @media (min-width: 1200px) { .visible-lg-inline-block { display: inline-block !important; } } @media (max-width: 767px) { .hidden-xs { display: none !important; } } @media (min-width: 768px) and (max-width: 991px) { .hidden-sm { display: none !important; } } @media (min-width: 992px) and (max-width: 1199px) { .hidden-md { display: none !important; } } @media (min-width: 1200px) { .hidden-lg { display: none !important; } } .visible-print { display: none !important; } @media print { .visible-print { display: block !important; } table.visible-print { display: table !important; } tr.visible-print { display: table-row !important; } th.visible-print, td.visible-print { display: table-cell !important; } } .visible-print-block { display: none !important; } @media print { .visible-print-block { display: block !important; } } .visible-print-inline { display: none !important; } @media print { .visible-print-inline { display: inline !important; } } .visible-print-inline-block { display: none !important; } @media print { .visible-print-inline-block { display: inline-block !important; } } @media print { .hidden-print { display: none !important; } } /*# sourceMappingURL=bootstrap.css.map */ ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/dist/js/bootstrap.js ================================================ /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under the MIT license */ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } +function ($) { 'use strict'; var version = $.fn.jquery.split(' ')[0].split('.') if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) { throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4') } }(jQuery); /* ======================================================================== * Bootstrap: transition.js v3.3.7 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { WebkitTransition : 'webkitTransitionEnd', MozTransition : 'transitionend', OTransition : 'oTransitionEnd otransitionend', transition : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } return false // explicit for ie8 ( ._.) } // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { var called = false var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this } $(function () { $.support.transition = transitionEnd() if (!$.support.transition) return $.event.special.bsTransitionEnd = { bindType: $.support.transition.end, delegateType: $.support.transition.end, handle: function (e) { if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) } } }) }(jQuery); /* ======================================================================== * Bootstrap: alert.js v3.3.7 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== var dismiss = '[data-dismiss="alert"]' var Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.VERSION = '3.3.7' Alert.TRANSITION_DURATION = 150 Alert.prototype.close = function (e) { var $this = $(this) var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = $(selector === '#' ? [] : selector) if (e) e.preventDefault() if (!$parent.length) { $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { // detach from parent, fire event then clean up data $parent.detach().trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? $parent .one('bsTransitionEnd', removeElement) .emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement() } // ALERT PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.alert') if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.alert $.fn.alert = Plugin $.fn.alert.Constructor = Alert // ALERT NO CONFLICT // ================= $.fn.alert.noConflict = function () { $.fn.alert = old return this } // ALERT DATA-API // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); /* ======================================================================== * Bootstrap: button.js v3.3.7 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) this.isLoading = false } Button.VERSION = '3.3.7' Button.DEFAULTS = { loadingText: 'loading...' } Button.prototype.setState = function (state) { var d = 'disabled' var $el = this.$element var val = $el.is('input') ? 'val' : 'html' var data = $el.data() state += 'Text' if (data.resetText == null) $el.data('resetText', $el[val]()) // push to event loop to allow forms to submit setTimeout($.proxy(function () { $el[val](data[state] == null ? this.options[state] : data[state]) if (state == 'loadingText') { this.isLoading = true $el.addClass(d).attr(d, d).prop(d, true) } else if (this.isLoading) { this.isLoading = false $el.removeClass(d).removeAttr(d).prop(d, false) } }, this), 0) } Button.prototype.toggle = function () { var changed = true var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') if ($input.prop('type') == 'radio') { if ($input.prop('checked')) changed = false $parent.find('.active').removeClass('active') this.$element.addClass('active') } else if ($input.prop('type') == 'checkbox') { if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false this.$element.toggleClass('active') } $input.prop('checked', this.$element.hasClass('active')) if (changed) $input.trigger('change') } else { this.$element.attr('aria-pressed', !this.$element.hasClass('active')) this.$element.toggleClass('active') } } // BUTTON PLUGIN DEFINITION // ======================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.button') var options = typeof option == 'object' && option if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } var old = $.fn.button $.fn.button = Plugin $.fn.button.Constructor = Button // BUTTON NO CONFLICT // ================== $.fn.button.noConflict = function () { $.fn.button = old return this } // BUTTON DATA-API // =============== $(document) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { var $btn = $(e.target).closest('.btn') Plugin.call($btn, 'toggle') if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { // Prevent double click on radios, and the double selections (so cancellation) on checkboxes e.preventDefault() // The target component still receive the focus if ($btn.is('input,button')) $btn.trigger('focus') else $btn.find('input:visible,button:visible').first().trigger('focus') } }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); /* ======================================================================== * Bootstrap: carousel.js v3.3.7 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.paused = null this.sliding = null this.interval = null this.$active = null this.$items = null this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) } Carousel.VERSION = '3.3.7' Carousel.TRANSITION_DURATION = 600 Carousel.DEFAULTS = { interval: 5000, pause: 'hover', wrap: true, keyboard: true } Carousel.prototype.keydown = function (e) { if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break default: return } e.preventDefault() } Carousel.prototype.cycle = function (e) { e || (this.paused = false) this.interval && clearInterval(this.interval) this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } Carousel.prototype.getItemIndex = function (item) { this.$items = item.parent().children('.item') return this.$items.index(item || this.$active) } Carousel.prototype.getItemForDirection = function (direction, active) { var activeIndex = this.getItemIndex(active) var willWrap = (direction == 'prev' && activeIndex === 0) || (direction == 'next' && activeIndex == (this.$items.length - 1)) if (willWrap && !this.options.wrap) return active var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) } Carousel.prototype.pause = function (e) { e || (this.paused = true) if (this.$element.find('.next, .prev').length && $.support.transition) { this.$element.trigger($.support.transition.end) this.cycle(true) } this.interval = clearInterval(this.interval) return this } Carousel.prototype.next = function () { if (this.sliding) return return this.slide('next') } Carousel.prototype.prev = function () { if (this.sliding) return return this.slide('prev') } Carousel.prototype.slide = function (type, next) { var $active = this.$element.find('.item.active') var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' var that = this if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] var slideEvent = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) this.$element.trigger(slideEvent) if (slideEvent.isDefaultPrevented()) return this.sliding = true isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) $nextIndicator && $nextIndicator.addClass('active') } var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) $active .one('bsTransitionEnd', function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger(slidEvent) }, 0) }) .emulateTransitionEnd(Carousel.TRANSITION_DURATION) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger(slidEvent) } isCycling && this.cycle() return this } // CAROUSEL PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.carousel') var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } var old = $.fn.carousel $.fn.carousel = Plugin $.fn.carousel.Constructor = Carousel // CAROUSEL NO CONFLICT // ==================== $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } // CAROUSEL DATA-API // ================= var clickHandler = function (e) { var href var $this = $(this) var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false Plugin.call($target, options) if (slideIndex) { $target.data('bs.carousel').to(slideIndex) } e.preventDefault() } $(document) .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) $(window).on('load', function () { $('[data-ride="carousel"]').each(function () { var $carousel = $(this) Plugin.call($carousel, $carousel.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: collapse.js v3.3.7 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ /* jshint latedef: false */ +function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + '[data-toggle="collapse"][data-target="#' + element.id + '"]') this.transitioning = null if (this.options.parent) { this.$parent = this.getParent() } else { this.addAriaAndCollapsedClass(this.$element, this.$trigger) } if (this.options.toggle) this.toggle() } Collapse.VERSION = '3.3.7' Collapse.TRANSITION_DURATION = 350 Collapse.DEFAULTS = { toggle: true } Collapse.prototype.dimension = function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } Collapse.prototype.show = function () { if (this.transitioning || this.$element.hasClass('in')) return var activesData var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') if (activesData && activesData.transitioning) return } var startEvent = $.Event('show.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return if (actives && actives.length) { Plugin.call(actives, 'hide') activesData || actives.data('bs.collapse', null) } var dimension = this.dimension() this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) .attr('aria-expanded', true) this.$trigger .removeClass('collapsed') .attr('aria-expanded', true) this.transitioning = 1 var complete = function () { this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('') this.transitioning = 0 this.$element .trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return var startEvent = $.Event('hide.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() this.$element[dimension](this.$element[dimension]())[0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse in') .attr('aria-expanded', false) this.$trigger .addClass('collapsed') .attr('aria-expanded', false) this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element .removeClass('collapsing') .addClass('collapse') .trigger('hidden.bs.collapse') } if (!$.support.transition) return complete.call(this) this.$element [dimension](0) .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION) } Collapse.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } Collapse.prototype.getParent = function () { return $(this.options.parent) .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .each($.proxy(function (i, element) { var $element = $(element) this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) }, this)) .end() } Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { var isOpen = $element.hasClass('in') $element.attr('aria-expanded', isOpen) $trigger .toggleClass('collapsed', !isOpen) .attr('aria-expanded', isOpen) } function getTargetFromTrigger($trigger) { var href var target = $trigger.attr('data-target') || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 return $(target) } // COLLAPSE PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.collapse $.fn.collapse = Plugin $.fn.collapse.Constructor = Collapse // COLLAPSE NO CONFLICT // ==================== $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { var $this = $(this) if (!$this.attr('data-target')) e.preventDefault() var $target = getTargetFromTrigger($this) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() Plugin.call($target, option) }) }(jQuery); /* ======================================================================== * Bootstrap: dropdown.js v3.3.7 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle="dropdown"]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.VERSION = '3.3.7' function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = selector && $(selector) return $parent && $parent.length ? $parent : $this.parent() } function clearMenus(e) { if (e && e.which === 3) return $(backdrop).remove() $(toggle).each(function () { var $this = $(this) var $parent = getParent($this) var relatedTarget = { relatedTarget: this } if (!$parent.hasClass('open')) return if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this.attr('aria-expanded', 'false') $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) }) } Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we use a backdrop because click events don't delegate $(document.createElement('div')) .addClass('dropdown-backdrop') .insertAfter($(this)) .on('click', clearMenus) } var relatedTarget = { relatedTarget: this } $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this .trigger('focus') .attr('aria-expanded', 'true') $parent .toggleClass('open') .trigger($.Event('shown.bs.dropdown', relatedTarget)) } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') if (!isActive && e.which != 27 || isActive && e.which == 27) { if (e.which == 27) $parent.find(toggle).trigger('focus') return $this.trigger('click') } var desc = ' li:not(.disabled):visible a' var $items = $parent.find('.dropdown-menu' + desc) if (!$items.length) return var index = $items.index(e.target) if (e.which == 38 && index > 0) index-- // up if (e.which == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items.eq(index).trigger('focus') } // DROPDOWN PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.dropdown') if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.dropdown $.fn.dropdown = Plugin $.fn.dropdown.Constructor = Dropdown // DROPDOWN NO CONFLICT // ==================== $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) }(jQuery); /* ======================================================================== * Bootstrap: modal.js v3.3.7 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { this.options = options this.$body = $(document.body) this.$element = $(element) this.$dialog = this.$element.find('.modal-dialog') this.$backdrop = null this.isShown = null this.originalBodyPad = null this.scrollbarWidth = 0 this.ignoreBackdropClick = false if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { this.$element.trigger('loaded.bs.modal') }, this)) } } Modal.VERSION = '3.3.7' Modal.TRANSITION_DURATION = 300 Modal.BACKDROP_TRANSITION_DURATION = 150 Modal.DEFAULTS = { backdrop: true, keyboard: true, show: true } Modal.prototype.toggle = function (_relatedTarget) { return this.isShown ? this.hide() : this.show(_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.checkScrollbar() this.setScrollbar() this.$body.addClass('modal-open') this.escape() this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.$dialog.on('mousedown.dismiss.bs.modal', function () { that.$element.one('mouseup.dismiss.bs.modal', function (e) { if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true }) }) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(that.$body) // don't move modals dom position } that.$element .show() .scrollTop(0) that.adjustDialog() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element.addClass('in') that.enforceFocus() var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$dialog // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() e = $.Event('hide.bs.modal') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() this.resize() $(document).off('focusin.bs.modal') this.$element .removeClass('in') .off('click.dismiss.bs.modal') .off('mouseup.dismiss.bs.modal') this.$dialog.off('mousedown.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element .one('bsTransitionEnd', $.proxy(this.hideModal, this)) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal() } Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (document !== e.target && this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.trigger('focus') } }, this)) } Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { this.$element.off('keydown.dismiss.bs.modal') } } Modal.prototype.resize = function () { if (this.isShown) { $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) } else { $(window).off('resize.bs.modal') } } Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) } Modal.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } Modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $(document.createElement('div')) .addClass('modal-backdrop ' + animate) .appendTo(this.$body) this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (this.ignoreBackdropClick) { this.ignoreBackdropClick = false return } if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide() }, this)) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') if (!callback) return doAnimate ? this.$backdrop .one('bsTransitionEnd', callback) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') var callbackRemove = function () { that.removeBackdrop() callback && callback() } $.support.transition && this.$element.hasClass('fade') ? this.$backdrop .one('bsTransitionEnd', callbackRemove) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove() } else if (callback) { callback() } } // these following methods are used to handle overflowing modals Modal.prototype.handleUpdate = function () { this.adjustDialog() } Modal.prototype.adjustDialog = function () { var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight this.$element.css({ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' }) } Modal.prototype.resetAdjustments = function () { this.$element.css({ paddingLeft: '', paddingRight: '' }) } Modal.prototype.checkScrollbar = function () { var fullWindowWidth = window.innerWidth if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 var documentElementRect = document.documentElement.getBoundingClientRect() fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) } this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) this.originalBodyPad = document.body.style.paddingRight || '' if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { this.$body.css('padding-right', this.originalBodyPad) } Modal.prototype.measureScrollbar = function () { // thx walsh var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth this.$body[0].removeChild(scrollDiv) return scrollbarWidth } // MODAL PLUGIN DEFINITION // ======================= function Plugin(option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option](_relatedTarget) else if (options.show) data.show(_relatedTarget) }) } var old = $.fn.modal $.fn.modal = Plugin $.fn.modal.Constructor = Modal // MODAL NO CONFLICT // ================= $.fn.modal.noConflict = function () { $.fn.modal = old return this } // MODAL DATA-API // ============== $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) if ($this.is('a')) e.preventDefault() $target.one('show.bs.modal', function (showEvent) { if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown $target.one('hidden.bs.modal', function () { $this.is(':visible') && $this.trigger('focus') }) }) Plugin.call($target, option, this) }) }(jQuery); /* ======================================================================== * Bootstrap: tooltip.js v3.3.7 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TOOLTIP PUBLIC CLASS DEFINITION // =============================== var Tooltip = function (element, options) { this.type = null this.options = null this.enabled = null this.timeout = null this.hoverState = null this.$element = null this.inState = null this.init('tooltip', element, options) } Tooltip.VERSION = '3.3.7' Tooltip.TRANSITION_DURATION = 150 Tooltip.DEFAULTS = { animation: true, placement: 'top', selector: false, template: '', trigger: 'hover focus', title: '', delay: 0, html: false, container: false, viewport: { selector: 'body', padding: 0 } } Tooltip.prototype.init = function (type, element, options) { this.enabled = true this.type = type this.$element = $(element) this.options = this.getOptions(options) this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) this.inState = { click: false, hover: false, focus: false } if (this.$element[0] instanceof document.constructor && !this.options.selector) { throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') } var triggers = this.options.trigger.split(' ') for (var i = triggers.length; i--;) { var trigger = triggers[i] if (trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (trigger != 'manual') { var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } Tooltip.prototype.getDefaults = function () { return Tooltip.DEFAULTS } Tooltip.prototype.getOptions = function (options) { options = $.extend({}, this.getDefaults(), this.$element.data(), options) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay, hide: options.delay } } return options } Tooltip.prototype.getDelegateOptions = function () { var options = {} var defaults = this.getDefaults() this._options && $.each(this._options, function (key, value) { if (defaults[key] != value) options[key] = value }) return options } Tooltip.prototype.enter = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } if (obj instanceof $.Event) { self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true } if (self.tip().hasClass('in') || self.hoverState == 'in') { self.hoverState = 'in' return } clearTimeout(self.timeout) self.hoverState = 'in' if (!self.options.delay || !self.options.delay.show) return self.show() self.timeout = setTimeout(function () { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } Tooltip.prototype.isInStateTrue = function () { for (var key in this.inState) { if (this.inState[key]) return true } return false } Tooltip.prototype.leave = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } if (obj instanceof $.Event) { self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false } if (self.isInStateTrue()) return clearTimeout(self.timeout) self.hoverState = 'out' if (!self.options.delay || !self.options.delay.hide) return self.hide() self.timeout = setTimeout(function () { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } Tooltip.prototype.show = function () { var e = $.Event('show.bs.' + this.type) if (this.hasContent() && this.enabled) { this.$element.trigger(e) var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) if (e.isDefaultPrevented() || !inDom) return var that = this var $tip = this.tip() var tipId = this.getUID(this.type) this.setContent() $tip.attr('id', tipId) this.$element.attr('aria-describedby', tipId) if (this.options.animation) $tip.addClass('fade') var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement var autoToken = /\s?auto?\s?/i var autoPlace = autoToken.test(placement) if (autoPlace) placement = placement.replace(autoToken, '') || 'top' $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) .data('bs.' + this.type, this) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) this.$element.trigger('inserted.bs.' + this.type) var pos = this.getPosition() var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (autoPlace) { var orgPlacement = placement var viewportDim = this.getPosition(this.$viewport) placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) } var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) var complete = function () { var prevHoverState = that.hoverState that.$element.trigger('shown.bs.' + that.type) that.hoverState = null if (prevHoverState == 'out') that.leave(that) } $.support.transition && this.$tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() } } Tooltip.prototype.applyPlacement = function (offset, placement) { var $tip = this.tip() var width = $tip[0].offsetWidth var height = $tip[0].offsetHeight // manually read margins because getBoundingClientRect includes difference var marginTop = parseInt($tip.css('margin-top'), 10) var marginLeft = parseInt($tip.css('margin-left'), 10) // we must check for NaN for ie 8/9 if (isNaN(marginTop)) marginTop = 0 if (isNaN(marginLeft)) marginLeft = 0 offset.top += marginTop offset.left += marginLeft // $.fn.offset doesn't round pixel values // so we use setOffset directly with our own function B-0 $.offset.setOffset($tip[0], $.extend({ using: function (props) { $tip.css({ top: Math.round(props.top), left: Math.round(props.left) }) } }, offset), 0) $tip.addClass('in') // check to see if placing tip in new offset caused the tip to resize itself var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (placement == 'top' && actualHeight != height) { offset.top = offset.top + height - actualHeight } var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) if (delta.left) offset.left += delta.left else offset.top += delta.top var isVertical = /top|bottom/.test(placement) var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' $tip.offset(offset) this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) } Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { this.arrow() .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') .css(isVertical ? 'top' : 'left', '') } Tooltip.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } Tooltip.prototype.hide = function (callback) { var that = this var $tip = $(this.$tip) var e = $.Event('hide.bs.' + this.type) function complete() { if (that.hoverState != 'in') $tip.detach() if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. that.$element .removeAttr('aria-describedby') .trigger('hidden.bs.' + that.type) } callback && callback() } this.$element.trigger(e) if (e.isDefaultPrevented()) return $tip.removeClass('in') $.support.transition && $tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() this.hoverState = null return this } Tooltip.prototype.fixTitle = function () { var $e = this.$element if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') } } Tooltip.prototype.hasContent = function () { return this.getTitle() } Tooltip.prototype.getPosition = function ($element) { $element = $element || this.$element var el = $element[0] var isBody = el.tagName == 'BODY' var elRect = el.getBoundingClientRect() if (elRect.width == null) { // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) } var isSvg = window.SVGElement && el instanceof window.SVGElement // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. // See https://github.com/twbs/bootstrap/issues/20280 var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null return $.extend({}, elRect, scroll, outerDims, elOffset) } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } } Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { var delta = { top: 0, left: 0 } if (!this.$viewport) return delta var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 var viewportDimensions = this.getPosition(this.$viewport) if (/right|left/.test(placement)) { var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight if (topEdgeOffset < viewportDimensions.top) { // top overflow delta.top = viewportDimensions.top - topEdgeOffset } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset } } else { var leftEdgeOffset = pos.left - viewportPadding var rightEdgeOffset = pos.left + viewportPadding + actualWidth if (leftEdgeOffset < viewportDimensions.left) { // left overflow delta.left = viewportDimensions.left - leftEdgeOffset } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset } } return delta } Tooltip.prototype.getTitle = function () { var title var $e = this.$element var o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } Tooltip.prototype.getUID = function (prefix) { do prefix += ~~(Math.random() * 1000000) while (document.getElementById(prefix)) return prefix } Tooltip.prototype.tip = function () { if (!this.$tip) { this.$tip = $(this.options.template) if (this.$tip.length != 1) { throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') } } return this.$tip } Tooltip.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) } Tooltip.prototype.enable = function () { this.enabled = true } Tooltip.prototype.disable = function () { this.enabled = false } Tooltip.prototype.toggleEnabled = function () { this.enabled = !this.enabled } Tooltip.prototype.toggle = function (e) { var self = this if (e) { self = $(e.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(e.currentTarget, this.getDelegateOptions()) $(e.currentTarget).data('bs.' + this.type, self) } } if (e) { self.inState.click = !self.inState.click if (self.isInStateTrue()) self.enter(self) else self.leave(self) } else { self.tip().hasClass('in') ? self.leave(self) : self.enter(self) } } Tooltip.prototype.destroy = function () { var that = this clearTimeout(this.timeout) this.hide(function () { that.$element.off('.' + that.type).removeData('bs.' + that.type) if (that.$tip) { that.$tip.detach() } that.$tip = null that.$arrow = null that.$viewport = null that.$element = null }) } // TOOLTIP PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.tooltip $.fn.tooltip = Plugin $.fn.tooltip.Constructor = Tooltip // TOOLTIP NO CONFLICT // =================== $.fn.tooltip.noConflict = function () { $.fn.tooltip = old return this } }(jQuery); /* ======================================================================== * Bootstrap: popover.js v3.3.7 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // POPOVER PUBLIC CLASS DEFINITION // =============================== var Popover = function (element, options) { this.init('popover', element, options) } if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') Popover.VERSION = '3.3.7' Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { placement: 'right', trigger: 'click', content: '', template: '' }) // NOTE: POPOVER EXTENDS tooltip.js // ================================ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) Popover.prototype.constructor = Popover Popover.prototype.getDefaults = function () { return Popover.DEFAULTS } Popover.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() var content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' ](content) $tip.removeClass('fade top bottom left right in') // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do // this manually by checking the contents. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() } Popover.prototype.hasContent = function () { return this.getTitle() || this.getContent() } Popover.prototype.getContent = function () { var $e = this.$element var o = this.options return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) } Popover.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.arrow')) } // POPOVER PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.popover') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.popover $.fn.popover = Plugin $.fn.popover.Constructor = Popover // POPOVER NO CONFLICT // =================== $.fn.popover.noConflict = function () { $.fn.popover = old return this } }(jQuery); /* ======================================================================== * Bootstrap: scrollspy.js v3.3.7 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== function ScrollSpy(element, options) { this.$body = $(document.body) this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || '') + ' .nav li > a' this.offsets = [] this.targets = [] this.activeTarget = null this.scrollHeight = 0 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) this.refresh() this.process() } ScrollSpy.VERSION = '3.3.7' ScrollSpy.DEFAULTS = { offset: 10 } ScrollSpy.prototype.getScrollHeight = function () { return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) } ScrollSpy.prototype.refresh = function () { var that = this var offsetMethod = 'offset' var offsetBase = 0 this.offsets = [] this.targets = [] this.scrollHeight = this.getScrollHeight() if (!$.isWindow(this.$scrollElement[0])) { offsetMethod = 'position' offsetBase = this.$scrollElement.scrollTop() } this.$body .find(this.selector) .map(function () { var $el = $(this) var href = $el.data('target') || $el.attr('href') var $href = /^#./.test(href) && $(href) return ($href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]]) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { that.offsets.push(this[0]) that.targets.push(this[1]) }) } ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollHeight = this.getScrollHeight() var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget var i if (this.scrollHeight != scrollHeight) { this.refresh() } if (scrollTop >= maxScroll) { return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) } if (activeTarget && scrollTop < offsets[0]) { this.activeTarget = null return this.clear() } for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) && this.activate(targets[i]) } } ScrollSpy.prototype.activate = function (target) { this.activeTarget = target this.clear() var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active .closest('li.dropdown') .addClass('active') } active.trigger('activate.bs.scrollspy') } ScrollSpy.prototype.clear = function () { $(this.selector) .parentsUntil(this.options.target, '.active') .removeClass('active') } // SCROLLSPY PLUGIN DEFINITION // =========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.scrollspy') var options = typeof option == 'object' && option if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.scrollspy $.fn.scrollspy = Plugin $.fn.scrollspy.Constructor = ScrollSpy // SCROLLSPY NO CONFLICT // ===================== $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old return this } // SCROLLSPY DATA-API // ================== $(window).on('load.bs.scrollspy.data-api', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) Plugin.call($spy, $spy.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: tab.js v3.3.7 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TAB CLASS DEFINITION // ==================== var Tab = function (element) { // jscs:disable requireDollarBeforejQueryAssignment this.element = $(element) // jscs:enable requireDollarBeforejQueryAssignment } Tab.VERSION = '3.3.7' Tab.TRANSITION_DURATION = 150 Tab.prototype.show = function () { var $this = this.element var $ul = $this.closest('ul:not(.dropdown-menu)') var selector = $this.data('target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } if ($this.parent('li').hasClass('active')) return var $previous = $ul.find('.active:last a') var hideEvent = $.Event('hide.bs.tab', { relatedTarget: $this[0] }) var showEvent = $.Event('show.bs.tab', { relatedTarget: $previous[0] }) $previous.trigger(hideEvent) $this.trigger(showEvent) if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return var $target = $(selector) this.activate($this.closest('li'), $ul) this.activate($target, $target.parent(), function () { $previous.trigger({ type: 'hidden.bs.tab', relatedTarget: $this[0] }) $this.trigger({ type: 'shown.bs.tab', relatedTarget: $previous[0] }) }) } Tab.prototype.activate = function (element, container, callback) { var $active = container.find('> .active') var transition = callback && $.support.transition && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', false) element .addClass('active') .find('[data-toggle="tab"]') .attr('aria-expanded', true) if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if (element.parent('.dropdown-menu').length) { element .closest('li.dropdown') .addClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', true) } callback && callback() } $active.length && transition ? $active .one('bsTransitionEnd', next) .emulateTransitionEnd(Tab.TRANSITION_DURATION) : next() $active.removeClass('in') } // TAB PLUGIN DEFINITION // ===================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') if (!data) $this.data('bs.tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } var old = $.fn.tab $.fn.tab = Plugin $.fn.tab.Constructor = Tab // TAB NO CONFLICT // =============== $.fn.tab.noConflict = function () { $.fn.tab = old return this } // TAB DATA-API // ============ var clickHandler = function (e) { e.preventDefault() Plugin.call($(this), 'show') } $(document) .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) }(jQuery); /* ======================================================================== * Bootstrap: affix.js v3.3.7 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== var Affix = function (element, options) { this.options = $.extend({}, Affix.DEFAULTS, options) this.$target = $(this.options.target) .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) this.$element = $(element) this.affixed = null this.unpin = null this.pinnedOffset = null this.checkPosition() } Affix.VERSION = '3.3.7' Affix.RESET = 'affix affix-top affix-bottom' Affix.DEFAULTS = { offset: 0, target: window } Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { var scrollTop = this.$target.scrollTop() var position = this.$element.offset() var targetHeight = this.$target.height() if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false if (this.affixed == 'bottom') { if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' } var initializing = this.affixed == null var colliderTop = initializing ? scrollTop : position.top var colliderHeight = initializing ? targetHeight : height if (offsetTop != null && scrollTop <= offsetTop) return 'top' if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' return false } Affix.prototype.getPinnedOffset = function () { if (this.pinnedOffset) return this.pinnedOffset this.$element.removeClass(Affix.RESET).addClass('affix') var scrollTop = this.$target.scrollTop() var position = this.$element.offset() return (this.pinnedOffset = position.top - scrollTop) } Affix.prototype.checkPositionWithEventLoop = function () { setTimeout($.proxy(this.checkPosition, this), 1) } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var height = this.$element.height() var offset = this.options.offset var offsetTop = offset.top var offsetBottom = offset.bottom var scrollHeight = Math.max($(document).height(), $(document.body).height()) if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) if (this.affixed != affix) { if (this.unpin != null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') this.$element.trigger(e) if (e.isDefaultPrevented()) return this.affixed = affix this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null this.$element .removeClass(Affix.RESET) .addClass(affixType) .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') } if (affix == 'bottom') { this.$element.offset({ top: scrollHeight - height - offsetBottom }) } } // AFFIX PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.affix') var options = typeof option == 'object' && option if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.affix $.fn.affix = Plugin $.fn.affix.Constructor = Affix // AFFIX NO CONFLICT // ================= $.fn.affix.noConflict = function () { $.fn.affix = old return this } // AFFIX DATA-API // ============== $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) var data = $spy.data() data.offset = data.offset || {} if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom if (data.offsetTop != null) data.offset.top = data.offsetTop Plugin.call($spy, data) }) }) }(jQuery); ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/bootstrap/dist/js/npm.js ================================================ // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. require('../../js/transition.js') require('../../js/alert.js') require('../../js/button.js') require('../../js/carousel.js') require('../../js/collapse.js') require('../../js/dropdown.js') require('../../js/modal.js') require('../../js/tooltip.js') require('../../js/popover.js') require('../../js/scrollspy.js') require('../../js/tab.js') require('../../js/affix.js') ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/jquery/.bower.json ================================================ { "name": "jquery", "main": "dist/jquery.js", "license": "MIT", "ignore": [ "package.json" ], "keywords": [ "jquery", "javascript", "browser", "library" ], "homepage": "https://github.com/jquery/jquery-dist", "version": "2.2.0", "_release": "2.2.0", "_resolution": { "type": "version", "tag": "2.2.0", "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" }, "_source": "git://github.com/jquery/jquery-dist.git", "_target": "2.2.0", "_originalSource": "jquery" } ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/jquery/LICENSE.txt ================================================ Copyright jQuery Foundation and other contributors, https://jquery.org/ This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history available at https://github.com/jquery/jquery The following license applies to all parts of this software except as documented below: ==== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==== All files located in the node_modules and external directories are externally maintained libraries used by this software which have their own licenses; we recommend you read them, as their terms may differ from the terms above. ================================================ FILE: VirtoCommerce.Storefront/wwwroot/lib/jquery/dist/jquery.js ================================================ /*! * jQuery JavaScript Library v2.2.0 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2016-01-08T20:02Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Support: Firefox 18+ // Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) //"use strict"; var arr = []; var document = window.document; var slice = arr.slice; var concat = arr.concat; var push = arr.push; var indexOf = arr.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var version = "2.2.0", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. each: function( callback ) { return jQuery.each( this, callback ); }, map: function( callback ) { return this.pushStack( jQuery.map( this, function( elem, i ) { return callback.call( elem, i, elem ); } ) ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); }, end: function() { return this.prevObject || this.constructor(); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[ 0 ] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // Skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } // Extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( ( options = arguments[ i ] ) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = jQuery.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend( { // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type( obj ) === "function"; }, isArray: Array.isArray, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) var realStringObj = obj && obj.toString(); return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; }, isPlainObject: function( obj ) { // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } if ( obj.constructor && !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } // If the function hasn't returned already, we're confident that // |obj| is a plain object, created by {} or constructed with new Object return true; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android<4.0, iOS<6 (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; }, // Evaluates a script in a global context globalEval: function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf( "use strict" ) === 1 ) { script = document.createElement( "script" ); script.text = code; document.head.appendChild( script ).parentNode.removeChild( script ); } else { // Otherwise, avoid the DOM node creation, insertion // and removal by using an indirect global eval indirect( code ); } } }, // Convert dashed to camelCase; used by the css and data modules // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function( obj, callback ) { var length, i = 0; if ( isArrayLike( obj ) ) { length = obj.length; for ( ; i < length; i++ ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } else { for ( i in obj ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } return obj; }, // Support: Android<4.1 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; for ( ; j < len; j++ ) { first[ i++ ] = second[ j ]; } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var length, value, i = 0, ret = []; // Go through the array, translating each of the items to their new values if ( isArrayLike( elems ) ) { length = elems.length; for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support } ); // JSHint would error on this code due to the Symbol not being defined in ES5. // Defining this global in .jshintrc would create a danger of using the global // unguarded in another place, it seems safer to just disable JSHint for these // three lines. /* jshint ignore: start */ if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; } /* jshint ignore: end */ // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), function( i, name ) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); } ); function isArrayLike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.1 * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-10-17 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + identifier + ")" ), "CLASS": new RegExp( "^\\.(" + identifier + ")" ), "TAG": new RegExp( "^(" + identifier + "|[*])" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var m, i, elem, nid, nidselect, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document nodeType = context ? context.nodeType : 9; results = results || []; // Return early from calls with invalid selector or context if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } // Try to shortcut find operations (as opposed to filters) in HTML documents if ( !seed ) { if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; if ( documentIsHTML ) { // If the selector is sufficiently simple, try using a "get*By*" DOM method // (excepting DocumentFragment context, where the methods don't exist) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // ID selector if ( (m = match[1]) ) { // Document context if ( nodeType === 9 ) { if ( (elem = context.getElementById( m )) ) { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } // Element context } else { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( newContext && (elem = newContext.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Type selector } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Class selector } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll if ( support.qsa && !compilerCache[ selector + " " ] && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { if ( nodeType !== 1 ) { newContext = context; newSelector = selector; // qSA looks outside Element context, which is not what we want // Thanks to Andrew Dupont for this workaround technique // Support: IE <=8 // Exclude object elements } else if ( context.nodeName.toLowerCase() !== "object" ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { nid = nid.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", (nid = expando) ); } // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; while ( i-- ) { groups[i] = nidselect + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch ( qsaError ) { } finally { if ( nid === expando ) { context.removeAttribute( "id" ); } } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {function(string, object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = arr.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Update global variables document = doc; docElem = document.documentElement; documentIsHTML = !isXML( document ); // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) if ( (parent = document.defaultView) && parent.top !== parent ) { // Support: IE 11 if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); return m ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "" + ""; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully self-exclusive // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && !compilerCache[ expr + " " ] && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index // ...in a gzip-friendly way node = parent; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } } else { // Use previously-cached element index if available if ( useCache ) { // ...in a gzip-friendly way node = elem; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } // xml :nth-child(...) // or :nth-last-child(...) or :nth(-last)?-of-type(...) if ( diff === false ) { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); uniqueCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); if ( (oldCache = uniqueCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements uniqueCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is only one selector in the list and no seed // (the latter of which guarantees us context) if ( match.length === 1 ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = ""; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = ""; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var dir = function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }; var siblings = function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; }; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; } ); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not; } ); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; } ) ); }; jQuery.fn.extend( { find: function( selector ) { var i, len = this.length, ret = [], self = this; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } } ) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); }, not: function( selector ) { return this.pushStack( winnow( this, selector || [], true ) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } } ); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context, root ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Method init() accepts an alternate rootjQuery // so migrate can support jQuery.sub (gh-2101) root = root || rootjQuery; // Handle HTML strings if ( typeof selector === "string" ) { if ( selector[ 0 ] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && ( match[ 1 ] || !context ) ) { // HANDLE: $(html) -> $(array) if ( match[ 1 ] ) { context = context instanceof jQuery ? context[ 0 ] : context; // Option to run scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[ 1 ], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[ 2 ] ); // Support: Blackberry 4.6 // gEBID returns nodes no longer in the document (#6963) if ( elem && elem.parentNode ) { // Inject the element directly into the jQuery object this.length = 1; this[ 0 ] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || root ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[ 0 ] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return root.ready !== undefined ? root.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // Methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend( { has: function( target ) { var targets = jQuery( target, this ), l = targets.length; return this.filter( function() { var i = 0; for ( ; i < l; i++ ) { if ( jQuery.contains( this, targets[ i ] ) ) { return true; } } } ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && ( pos ? pos.index( cur ) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); }, // Determine the position of an element within the set index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; } // Index in selector if ( typeof elem === "string" ) { return indexOf.call( jQuery( elem ), this[ 0 ] ); } // Locate the position of the desired element return indexOf.call( this, // If it receives a jQuery object, the first element is used elem.jquery ? elem[ 0 ] : elem ); }, add: function( selector, context ) { return this.pushStack( jQuery.uniqueSort( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); } } ); function sibling( cur, dir ) { while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} return cur; } jQuery.each( { parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return siblings( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return siblings( elem.firstChild ); }, contents: function( elem ) { return elem.contentDocument || jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var matched = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { matched = jQuery.filter( selector, matched ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { jQuery.uniqueSort( matched ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { matched.reverse(); } } return this.pushStack( matched ); }; } ); var rnotwhite = ( /\S+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? createOptions( options ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value for non-forgettable lists memory, // Flag to know if list was already fired fired, // Flag to prevent firing locked, // Actual callback list list = [], // Queue of execution data for repeatable lists queue = [], // Index of currently firing callback (modified by add/remove as needed) firingIndex = -1, // Fire callbacks fire = function() { // Enforce single-firing locked = options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes fired = firing = true; for ( ; queue.length; firingIndex = -1 ) { memory = queue.shift(); while ( ++firingIndex < list.length ) { // Run callback and check for early termination if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && options.stopOnFalse ) { // Jump to end and forget the data so .add doesn't re-fire firingIndex = list.length; memory = false; } } } // Forget the data if we're done with it if ( !options.memory ) { memory = false; } firing = false; // Clean up if we're done firing for good if ( locked ) { // Keep an empty list if we have data for future add calls if ( memory ) { list = []; // Otherwise, this object is spent } else { list = ""; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // If we have memory from a past run, we should fire after adding if ( memory && !firing ) { firingIndex = list.length - 1; queue.push( memory ); } ( function add( args ) { jQuery.each( args, function( _, arg ) { if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { // Inspect recursively add( arg ); } } ); } )( arguments ); if ( memory && !firing ) { fire(); } } return this; }, // Remove a callback from the list remove: function() { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( index <= firingIndex ) { firingIndex--; } } } ); return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : list.length > 0; }, // Remove all callbacks from the list empty: function() { if ( list ) { list = []; } return this; }, // Disable .fire and .add // Abort any current/pending executions // Clear all callbacks and values disable: function() { locked = queue = []; list = memory = ""; return this; }, disabled: function() { return !list; }, // Disable .fire // Also disable .add unless we have memory (since it would have no effect) // Abort any pending executions lock: function() { locked = queue = []; if ( !memory ) { list = memory = ""; } return this; }, locked: function() { return !!locked; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( !locked ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; queue.push( args ); if ( !firing ) { fire(); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend( { Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], [ "notify", "progress", jQuery.Callbacks( "memory" ) ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } } ); } ); fns = null; } ).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { list.add( function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[ 0 ] ] = function() { deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. // If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // Add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .progress( updateFunc( i, progressContexts, progressValues ) ) .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ); } else { --remaining; } } } // If we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } } ); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend( { // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } } ); /** * The ready event handler and self cleanup method */ function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called // after the browser event has already occurred. // Support: IE9-10 only // Older IE sometimes signals "interactive" too soon if ( document.readyState === "complete" || ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready window.setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed ); } } return readyList.promise( obj ); }; // Kick off the DOM ready check even if the user does not jQuery.ready.promise(); // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : len ? fn( elems[ 0 ], key ) : emptyGet; }; var acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; function Data() { this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; Data.prototype = { register: function( owner, initial ) { var value = initial || {}; // If it is a node unlikely to be stringify-ed or looped over // use plain assignment if ( owner.nodeType ) { owner[ this.expando ] = value; // Otherwise secure it in a non-enumerable, non-writable property // configurability must be true to allow the property to be // deleted with the delete operator } else { Object.defineProperty( owner, this.expando, { value: value, writable: true, configurable: true } ); } return owner[ this.expando ]; }, cache: function( owner ) { // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return an empty object. if ( !acceptData( owner ) ) { return {}; } // Check if the owner object already has a cache var value = owner[ this.expando ]; // If not, create one if ( !value ) { value = {}; // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return an empty object. if ( acceptData( owner ) ) { // If it is a node unlikely to be stringify-ed or looped over // use plain assignment if ( owner.nodeType ) { owner[ this.expando ] = value; // Otherwise secure it in a non-enumerable property // configurable must be true to allow the property to be // deleted when data is removed } else { Object.defineProperty( owner, this.expando, { value: value, configurable: true } ); } } } return value; }, set: function( owner, data, value ) { var prop, cache = this.cache( owner ); // Handle: [ owner, key, value ] args if ( typeof data === "string" ) { cache[ data ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { cache[ prop ] = data[ prop ]; } } return cache; }, get: function( owner, key ) { return key === undefined ? this.cache( owner ) : owner[ this.expando ] && owner[ this.expando ][ key ]; }, access: function( owner, key, value ) { var stored; // In cases where either: // // 1. No key was specified // 2. A string key was specified, but no value provided // // Take the "read" path and allow the get method to determine // which value to return, respectively either: // // 1. The entire cache object // 2. The data stored at the key // if ( key === undefined || ( ( key && typeof key === "string" ) && value === undefined ) ) { stored = this.get( owner, key ); return stored !== undefined ? stored : this.get( owner, jQuery.camelCase( key ) ); } // When the key is not a string, or both a key and value // are specified, set or extend (existing objects) with either: // // 1. An object of properties // 2. A key and value // this.set( owner, key, value ); // Since the "set" path can have two possible entry points // return the expected data based on which path was taken[*] return value !== undefined ? value : key; }, remove: function( owner, key ) { var i, name, camel, cache = owner[ this.expando ]; if ( cache === undefined ) { return; } if ( key === undefined ) { this.register( owner ); } else { // Support array or space separated string of keys if ( jQuery.isArray( key ) ) { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = key.concat( key.map( jQuery.camelCase ) ); } else { camel = jQuery.camelCase( key ); // Try the string as a key before any manipulation if ( key in cache ) { name = [ key, camel ]; } else { // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace name = camel; name = name in cache ? [ name ] : ( name.match( rnotwhite ) || [] ); } } i = name.length; while ( i-- ) { delete cache[ name[ i ] ]; } } // Remove the expando if there's no more data if ( key === undefined || jQuery.isEmptyObject( cache ) ) { // Support: Chrome <= 35-45+ // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead // https://code.google.com/p/chromium/issues/detail?id=378607 if ( owner.nodeType ) { owner[ this.expando ] = undefined; } else { delete owner[ this.expando ]; } } }, hasData: function( owner ) { var cache = owner[ this.expando ]; return cache !== undefined && !jQuery.isEmptyObject( cache ); } }; var dataPriv = new Data(); var dataUser = new Data(); // Implementation Summary // // 1. Enforce API surface and semantic compatibility with 1.9.x branch // 2. Improve the module's maintainability by reducing the storage // paths to a single mechanism. // 3. Use the same single mechanism to support "private" and "user" data. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) // 5. Avoid exposing implementation details on user objects (eg. expando properties) // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; function dataAttr( elem, key, data ) { var name; // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch ( e ) {} // Make sure we set the data so it isn't changed later dataUser.set( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend( { hasData: function( elem ) { return dataUser.hasData( elem ) || dataPriv.hasData( elem ); }, data: function( elem, name, data ) { return dataUser.access( elem, name, data ); }, removeData: function( elem, name ) { dataUser.remove( elem, name ); }, // TODO: Now that all calls to _data and _removeData have been replaced // with direct calls to dataPriv methods, these can be deprecated. _data: function( elem, name, data ) { return dataPriv.access( elem, name, data ); }, _removeData: function( elem, name ) { dataPriv.remove( elem, name ); } } ); jQuery.fn.extend( { data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { if ( this.length ) { data = dataUser.get( elem ); if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } } dataPriv.set( elem, "hasDataAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each( function() { dataUser.set( this, key ); } ); } return access( this, function( value ) { var data, camelKey; // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the // `value` parameter was not undefined. An empty jQuery object // will result in `undefined` for elem = this[ 0 ] which will // throw an exception if an attempt to read a data cache is made. if ( elem && value === undefined ) { // Attempt to get data from the cache // with the key as-is data = dataUser.get( elem, key ) || // Try to find dashed key if it exists (gh-2779) // This is for 2.2.x only dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); if ( data !== undefined ) { return data; } camelKey = jQuery.camelCase( key ); // Attempt to get data from the cache // with the key camelized data = dataUser.get( elem, camelKey ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs data = dataAttr( elem, camelKey, undefined ); if ( data !== undefined ) { return data; } // We tried really hard, but the data doesn't exist. return; } // Set the data... camelKey = jQuery.camelCase( key ); this.each( function() { // First, attempt to store a copy or reference of any // data that might've been store with a camelCased key. var data = dataUser.get( this, camelKey ); // For HTML5 data-* attribute interop, we have to // store property names with dashes in a camelCase form. // This might not apply to all properties...* dataUser.set( this, camelKey, value ); // *... In the case of properties that might _actually_ // have dashes, we need to also store a copy of that // unchanged property. if ( key.indexOf( "-" ) > -1 && data !== undefined ) { dataUser.set( this, key, value ); } } ); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each( function() { dataUser.remove( this, key ); } ); } } ); jQuery.extend( { queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = dataPriv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { empty: jQuery.Callbacks( "once memory" ).add( function() { dataPriv.remove( elem, [ type + "queue", key ] ); } ) } ); } } ); jQuery.fn.extend( { queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[ 0 ], type ); } return data === undefined ? this : this.each( function() { var queue = jQuery.queue( this, type, data ); // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { jQuery.dequeue( this, type ); } } ); }, dequeue: function( type ) { return this.each( function() { jQuery.dequeue( this, type ); } ); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } } ); var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; function adjustCSS( elem, prop, valueParts, tween ) { var adjusted, scale = 1, maxIterations = 20, currentValue = tween ? function() { return tween.cur(); } : function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; // Make sure we update the tween properties later on valueParts = valueParts || []; // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; do { // If previous iteration zeroed out, double until we get *something*. // Use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply initialInUnit = initialInUnit / scale; jQuery.style( elem, prop, initialInUnit + unit ); // Update scale, tolerating zero or NaN from tween.cur() // Break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations ); } if ( valueParts ) { initialInUnit = +initialInUnit || +initial || 0; // Apply relative offset (+=/-=) if specified adjusted = valueParts[ 1 ] ? initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : +valueParts[ 2 ]; if ( tween ) { tween.unit = unit; tween.start = initialInUnit; tween.end = adjusted; } } return adjusted; } var rcheckableType = ( /^(?:checkbox|radio)$/i ); var rtagName = ( /<([\w:-]+)/ ); var rscriptType = ( /^$|\/(?:java|ecma)script/i ); // We have to close these tags to support XHTML (#13200) var wrapMap = { // Support: IE9 option: [ 1, "" ], // XHTML parsers do not magically insert elements in the // same way that tag soup parsers do. So we cannot shorten // this by omitting or other required elements. thead: [ 1, "", "
" ], col: [ 2, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], _default: [ 0, "", "" ] }; // Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { // Support: IE9-11+ // Use typeof to avoid zero-argument method invocation on host objects (#15151) var ret = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : []; return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], ret ) : ret; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { dataPriv.set( elems[ i ], "globalEval", !refElements || dataPriv.get( refElements[ i ], "globalEval" ) ); } } var rhtml = /<|&#?\w+;/; function buildFragment( elems, context, scripts, selection, ignored ) { var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); // Deserialize a standard representation tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { tmp = tmp.lastChild; } // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); // Remember the top-level container tmp = fragment.firstChild; // Ensure the created nodes are orphaned (#12392) tmp.textContent = ""; } } } // Remove wrapper from fragment fragment.textContent = ""; i = 0; while ( ( elem = nodes[ i++ ] ) ) { // Skip elements already in the context collection (trac-4087) if ( selection && jQuery.inArray( elem, selection ) > -1 ) { if ( ignored ) { ignored.push( elem ); } continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( fragment.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( ( elem = tmp[ j++ ] ) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } return fragment; } ( function() { var fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); // Support: Android 4.0-4.3, Safari<=5.1 // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); div.appendChild( input ); // Support: Safari<=5.1, Android<4.2 // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; } function returnFalse() { return false; } // Support: IE9 // See #13393 for more info function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } function on( elem, types, selector, data, fn, one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { on( elem, type, selector, data, types[ type ], one ); } return elem; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return elem.each( function() { jQuery.event.add( this, types, fn, data, selector ); } ); } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !( events = elemData.events ) ) { events = elemData.events = {}; } if ( !( eventHandle = elemData.handle ) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend( { type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join( "." ) }, handleObjIn ); // Init the event handler queue if we're the first if ( !( handlers = events[ type ] ) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); if ( !elemData || !( events = elemData.events ) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove data and the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { dataPriv.remove( elem, "handle events" ); } }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call( arguments ), handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or 2) have namespace(s) // a subset or equal to those in the bound event (both can have no namespace). if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || handleObj.handler ).apply( matched.elem, args ); if ( ret !== undefined ) { if ( ( event.result = ret ) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Support (at least): Chrome, IE9 // Find delegate handlers // Black-hole SVG instance trees (#13180) // // Support: Firefox<=42+ // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) if ( delegateCount && cur.nodeType && ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push( { elem: cur, handlers: matches } ); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, // Includes some event props shared by KeyEvent and MouseEvent props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split( " " ), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + "screenX screenY toElement" ).split( " " ), filter: function( event, original ) { var eventDoc, doc, body, button = original.button; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: Cordova 2.5 (WebKit) (#13255) // All events should have a target; Cordova deviceready doesn't if ( !event.target ) { event.target = document; } // Support: Safari 6.0+, Chrome<28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { this.focus(); return false; } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } } }; jQuery.removeEvent = function( elem, type, handle ) { // This "if" is needed for plain objects if ( elem.removeEventListener ) { elem.removeEventListener( type, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !( this instanceof jQuery.Event ) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: Android<4.0 src.returnValue === false ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( e ) { e.preventDefault(); } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( e ) { e.stopPropagation(); } }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: // https://code.google.com/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mouseenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; } ); jQuery.fn.extend( { on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, one: function( types, selector, data, fn ) { return on( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each( function() { jQuery.event.remove( this, types, fn, selector ); } ); } } ); var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, // Support: IE 10-11, Edge 10240+ // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /\s*$/g; function manipulationTarget( elem, content ) { if ( jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; } return elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute( "type" ); } return elem; } function cloneCopyEvent( src, dest ) { var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; if ( dest.nodeType !== 1 ) { return; } // 1. Copy private data: events, handlers, etc. if ( dataPriv.hasData( src ) ) { pdataOld = dataPriv.access( src ); pdataCur = dataPriv.set( dest, pdataOld ); events = pdataOld.events; if ( events ) { delete pdataCur.handle; pdataCur.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } } // 2. Copy user data if ( dataUser.hasData( src ) ) { udataOld = dataUser.access( src ); udataCur = jQuery.extend( {}, udataOld ); dataUser.set( dest, udataCur ); } } // Fix IE bugs, see support tests function fixInput( src, dest ) { var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button. if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } function domManip( collection, args, callback, ignored ) { // Flatten any nested arrays args = concat.apply( [], args ); var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); } ); } if ( l ) { fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } // Require either new content or an interest in ignored elements to invoke the callback if ( first || ignored ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item // instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( collection[ i ], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !dataPriv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); } } } } } } return collection; } function remove( elem, selector, keepData ) { var node, nodes = selector ? jQuery.filter( selector, elem ) : elem, i = 0; for ( ; ( node = nodes[ i ] ) != null; i++ ) { if ( !keepData && node.nodeType === 1 ) { jQuery.cleanData( getAll( node ) ); } if ( node.parentNode ) { if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); } } return elem; } jQuery.extend( { htmlPrefilter: function( html ) { return html.replace( rxhtmlTag, "<$1>" ); }, clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), inPage = jQuery.contains( elem.ownerDocument, elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); for ( i = 0, l = srcElements.length; i < l; i++ ) { fixInput( srcElements[ i ], destElements[ i ] ); } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0, l = srcElements.length; i < l; i++ ) { cloneCopyEvent( srcElements[ i ], destElements[ i ] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } // Return the cloned set return clone; }, cleanData: function( elems ) { var data, elem, type, special = jQuery.event.special, i = 0; for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { if ( acceptData( elem ) ) { if ( ( data = elem[ dataPriv.expando ] ) ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataPriv.expando ] = undefined; } if ( elem[ dataUser.expando ] ) { // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataUser.expando ] = undefined; } } } } } ); jQuery.fn.extend( { // Keep domManip exposed until 3.0 (gh-2225) domManip: domManip, detach: function( selector ) { return remove( this, selector, true ); }, remove: function( selector ) { return remove( this, selector ); }, text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().each( function() { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.textContent = value; } } ); }, null, value, arguments.length ); }, append: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } } ); }, prepend: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } } ); }, before: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } } ); }, after: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } } ); }, empty: function() { var elem, i = 0; for ( ; ( elem = this[ i ] ) != null; i++ ) { if ( elem.nodeType === 1 ) { // Prevent memory leaks jQuery.cleanData( getAll( elem, false ) ); // Remove any remaining nodes elem.textContent = ""; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); } ); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined && elem.nodeType === 1 ) { return elem.innerHTML; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { value = jQuery.htmlPrefilter( value ); try { for ( ; i < l; i++ ) { elem = this[ i ] || {}; // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch ( e ) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var ignored = []; // Make the changes, replacing each non-ignored context element with the new content return domManip( this, arguments, function( elem ) { var parent = this.parentNode; if ( jQuery.inArray( this, ignored ) < 0 ) { jQuery.cleanData( getAll( this ) ); if ( parent ) { parent.replaceChild( elem, this ); } } // Force callback invocation }, ignored ); } } ); jQuery.each( { appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, ret = [], insert = jQuery( selector ), last = insert.length - 1, i = 0; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); // Support: QtWebKit // .get() because push.apply(_, arraylike) throws push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); var iframe, elemdisplay = { // Support: Firefox // We have to pre-define these values for FF (#10227) HTML: "block", BODY: "block" }; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = ( iframe || jQuery( "