public GoogleBloggerv3Client(Uri postApiUrl, IBlogCredentialsAccessor credentials) : base(credentials) { // configure client options BlogClientOptions clientOptions = new BlogClientOptions(); clientOptions.SupportsCategories = false; clientOptions.SupportsMultipleCategories = false; clientOptions.SupportsNewCategories = false; clientOptions.SupportsCustomDate = true; clientOptions.SupportsExcerpt = false; clientOptions.SupportsSlug = false; clientOptions.SupportsFileUpload = true; clientOptions.SupportsKeywords = true; clientOptions.SupportsGetKeywords = true; clientOptions.SupportsPages = true; clientOptions.SupportsExtendedEntries = true; _clientOptions = clientOptions; _nsMgr = new XmlNamespaceManager(new NameTable()); _nsMgr.AddNamespace(atomNS.Prefix, atomNS.Uri); _nsMgr.AddNamespace(pubNS.Prefix, pubNS.Uri); _nsMgr.AddNamespace(AtomClient.xhtmlNS.Prefix, AtomClient.xhtmlNS.Uri); _nsMgr.AddNamespace(AtomClient.featuresNS.Prefix, AtomClient.featuresNS.Uri); _nsMgr.AddNamespace(AtomClient.mediaNS.Prefix, AtomClient.mediaNS.Uri); _nsMgr.AddNamespace(AtomClient.liveNS.Prefix, AtomClient.liveNS.Uri); }
protected override void ConfigureClientOptions(BlogClientOptions clientOptions) { clientOptions.SupportsCustomDate = true; clientOptions.SupportsCategories = true; clientOptions.SupportsMultipleCategories = true; clientOptions.SupportsNewCategories = true; clientOptions.SupportsNewCategoriesInline = true; clientOptions.SupportsFileUpload = true; clientOptions.SupportsExtendedEntries = true; }
public StaticSiteClient(Uri postApiUrl, IBlogCredentialsAccessor credentials) : base(credentials) { Config = StaticSiteConfig.LoadConfigFromCredentials(credentials); // Set the client options var options = new BlogClientOptions(); ConfigureClientOptions(options); Options = options; }
public XmlRpcBlogClient(Uri postApiUrl, IBlogCredentialsAccessor credentials) : base(credentials) { _postApiUrl = UrlHelper.SafeToAbsoluteUri(postApiUrl); // configure client options BlogClientOptions clientOptions = new BlogClientOptions(); ConfigureClientOptions(clientOptions); _clientOptions = clientOptions; }
protected override void ConfigureClientOptions(BlogClientOptions clientOptions) { clientOptions.SupportsCategories = true; clientOptions.SupportsMultipleCategories = true; clientOptions.SupportsCategoryIds = true; clientOptions.SupportsCategoriesInline = false; clientOptions.SupportsFileUpload = true; clientOptions.SupportsCommentPolicy = true; clientOptions.SupportsPingPolicy = true; clientOptions.SupportsTrackbacks = true; clientOptions.SupportsKeywords = true; clientOptions.SupportsExcerpt = true; clientOptions.SupportsExtendedEntries = true; }
public static IBlogClient CreateClient(string clientType, string postApiUrl, IBlogCredentialsAccessor credentials, string providerId, IDictionary optionOverrides, IDictionary userOptionOverrides, IDictionary homepageOptionOverrides) { // create blog client reflecting the settings IBlogClient blogClient = CreateClient(clientType, postApiUrl, credentials); // if there is a provider associated with the client then use it to override options // as necessary for this provider IBlogProvider provider = BlogProviderManager.FindProvider(providerId); if (provider != null) { IBlogClientOptions providerOptions = provider.ConstructBlogOptions(blogClient.Options); blogClient.OverrideOptions(providerOptions); } if (homepageOptionOverrides != null) { OptionOverrideReader homepageOptionsReader = new OptionOverrideReader(homepageOptionOverrides); IBlogClientOptions homepageOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(homepageOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(homepageOptions); } // if there are manifest overrides then apply them if (optionOverrides != null) { OptionOverrideReader manifestOptionsReader = new OptionOverrideReader(optionOverrides); IBlogClientOptions manifestOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(manifestOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(manifestOptions); } // if there are user overrides then apply them if (userOptionOverrides != null) { OptionOverrideReader userOptionsReader = new OptionOverrideReader(userOptionOverrides); IBlogClientOptions userOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(userOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(userOptions); } // return the blog client return(blogClient); }
public AtomClient(AtomProtocolVersion atomVer, Uri postApiUrl, IBlogCredentialsAccessor credentials) : base(credentials) { _feedServiceUrl = postApiUrl; // configure client options BlogClientOptions clientOptions = new BlogClientOptions(); ConfigureClientOptions(clientOptions); _clientOptions = clientOptions; _atomVer = atomVer; _atomNS = new Namespace(atomVer.NamespaceUri, "atom"); _pubNS = new Namespace(atomVer.PubNamespaceUri, "app"); _nsMgr = new XmlNamespaceManager(new NameTable()); _nsMgr.AddNamespace(_atomNS.Prefix, _atomNS.Uri); _nsMgr.AddNamespace(_pubNS.Prefix, _pubNS.Uri); _nsMgr.AddNamespace(xhtmlNS.Prefix, xhtmlNS.Uri); _nsMgr.AddNamespace(featuresNS.Prefix, featuresNS.Uri); _nsMgr.AddNamespace(mediaNS.Prefix, mediaNS.Uri); _nsMgr.AddNamespace(liveNS.Prefix, liveNS.Uri); }
protected override void ConfigureClientOptions(BlogClientOptions clientOptions) { // inherit mt defaults base.ConfigureClientOptions(clientOptions); // support advanced category features clientOptions.SupportsHierarchicalCategories = true; clientOptions.SupportsNewCategories = true; clientOptions.SupportsSuggestCategories = true; // don't require out-of-band categories clientOptions.SupportsCategoriesInline = true; // add support for wp-api features clientOptions.SupportsKeywords = true; clientOptions.SupportsPages = true; clientOptions.SupportsPageParent = true; clientOptions.SupportsPageOrder = true; clientOptions.SupportsSlug = true; clientOptions.SupportsPassword = true; clientOptions.SupportsAuthor = true; }
/// <summary> /// Sets the relevant BlogClientOptions for this client based on values from the StaticSiteConfig /// </summary> /// <param name="clientOptions">A BlogClientOptions instance</param> private void ConfigureClientOptions(BlogClientOptions clientOptions) { clientOptions.SupportsPages = clientOptions.SupportsPageParent = Config.PagesEnabled; clientOptions.SupportsPostAsDraft = Config.DraftsEnabled; clientOptions.SupportsFileUpload = Config.ImagesEnabled; clientOptions.SupportsImageUpload = Config.ImagesEnabled ? SupportsFeature.Yes : SupportsFeature.No; clientOptions.SupportsScripts = clientOptions.SupportsEmbeds = SupportsFeature.Yes; clientOptions.SupportsExtendedEntries = true; // Blog template is downloaded from publishing a test post clientOptions.SupportsAutoUpdate = true; clientOptions.SupportsCategories = true; clientOptions.SupportsMultipleCategories = true; clientOptions.SupportsNewCategories = true; clientOptions.SupportsKeywords = false; clientOptions.FuturePublishDateWarning = true; clientOptions.SupportsCustomDate = clientOptions.SupportsCustomDateUpdate = true; clientOptions.SupportsSlug = true; clientOptions.SupportsAuthor = false; }
/// <summary> /// Enable subclasses to change the default client options /// </summary> /// <param name="clientOptions"></param> protected virtual void ConfigureClientOptions(BlogClientOptions clientOptions) { }
protected override void ConfigureClientOptions(BlogClientOptions clientOptions) { clientOptions.SupportsFileUpload = true; clientOptions.SupportsCustomDate = false; clientOptions.SupportsExtendedEntries = true; }