///
/// Copyright © 2003-2008 JetBrains s.r.o.
/// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder).
///
using System;
using System.IO;
using System.Xml;
namespace JetBrains.Omea.OpenAPI
{
///
/// Importer of subscription from other RSS readers.
///
/// 2.0
public interface IFeedImporter
{
///
/// Check if importer needs configuration before import starts.
///
bool HasSettings { get; }
///
/// Returns creator of options pane.
///
OptionsPaneCreator GetSettingsPaneCreator();
///
/// Import subscription
///
/// Link imported structure to this parent.
/// Add imported feeds to active workspace
void DoImport( IResource importRoot, bool addToWorkspace );
///
/// Import cached items, flags, etc.
///
void DoImportCache();
}
///
/// Parser for a single element in an RSS or ATOM feed.
///
public interface IFeedElementParser
{
///
/// Parses the value for the element.
///
/// The resource in which the element data should be stored
/// (of type RSSFeed for channel element parsers or RSSItem for item element
/// parsers).
/// The reader positioned after the starting tag of the element.
void ParseValue( IResource resource, XmlReader reader );
///
/// Checks if a Read() call is needed to move to the next element after
/// is completed.
///
bool SkipNextRead { get; }
}
///
/// Possible types of feeds for which element parsers can be registered.
///
public enum FeedType
{
///
/// RSS Feed.
///
Rss,
///
/// Atom Feed.
///
Atom
};
///
/// Service for performing operations on RSS feeds in Omea.
///
public interface IRssService
{
///
/// Shows the "Subscribe to Feed" wizard, optionally filling it with default
/// values.
///
/// The URL which is suggested in the dialog,
/// or null if the URL should be empty.
/// The group where it is suggested to place
/// the feed, or null if the default location is used.
void ShowAddFeedWizard( string defaultUrl, IResource defaultGroup );
///
/// Creates an RSS feed with the specified name and URL under the specified parent.
///
/// The name of the feed.
/// The URL of the feed.
/// The parent group of the feed, or null if the feed is created
/// at root level.
/// The created feed resource.
/// 2.0
IResource CreateFeed( string name, string url, IResource parent );
///
/// Creates an RSS feed with the specified name and URL under the specified parent,
/// with the specified authorization parameters.
///
/// The name of the feed.
/// The URL of the feed.
/// The parent group of the feed, or null if the feed is created
/// at root level.
/// The HTTP login name used for updating the feed.
/// The HTTP password used for updating the feed.
/// The created feed resource.
/// 2.0
IResource CreateFeed( string name, string url, IResource parent, string httpLogin, string httpPassword );
///
/// Finds an existing feed group with the specified name, or creates a new feed group if
/// one does not exist.
///
/// The name of the group.
/// The parent under which the group is created, or null
/// if the group is created under the feed root.
/// The group resource.
/// 2.0
IResource FindOrCreateGroup( string name, IResource parent );
///
/// Queues the specified RSS feed for immediate updating.
///
/// The feed to update.
void QueueFeedUpdate( IResource feed );
///
/// Initiates an update of the selected feed at a time determined by its
/// last update time and update frequency.
///
/// The feed scheduled for updating.
void ScheduleFeedUpdate( IResource feed );
///
/// Imports an OPML list of feeds from a stream.
///
/// The stream containing the OPML.
/// The root group under which the imported feeds are place,
/// or null if the feeds should be placed under the root of the feed tree.
/// The name or URL of the OPML file (used for
/// diagnostic messages only).
/// Whether a preview dialog should be shown before
/// completing the import.
void ImportOpmlStream( Stream importStream, IResource importRoot,
string importFileName, bool importPreview );
///
/// Exports the subscription tree or part of it to an OPML file.
///
/// The root of the subtree to export, or null
/// if the entire RSS tree should be exported.
/// The name of the file to which the OPML is exported.
void ExportOpmlFile( IResource exportRoot, string exportFileName );
///
/// Register a parser for a custom channel-level element of an RSS or ATOM feed.
///
/// The type of the feed (RSS or ATOM) for which the
/// parser is registered.
/// The XML namespace of the element which is handled
/// by the parser.
/// The tag name of the element which is handled by
/// the parser.
/// The parser instance.
void RegisterChannelElementParser( FeedType feedType, string xmlNameSpace, string elementName,
IFeedElementParser parser );
///
/// Register a parser for a custom item-level element of an RSS or ATOM feed.
///
/// The type of the feed (RSS or ATOM) for which the
/// parser is registered.
/// The XML namespace of the element which is handled
/// by the parser.
/// The tag name of the element which is handled by
/// the parser.
/// The parser instance.
void RegisterItemElementParser( FeedType feedType, string xmlNameSpace, string elementName,
IFeedElementParser parser );
///
/// Register new subscription importer. Importer will be available to user in startup wizard
/// and options pane.
///
/// the name of importer, will be shown to user.
/// The importer instance.
/// 2.0
void RegisterFeedImporter( string name, IFeedImporter importer );
///
/// An event which is fired on the resource thread when the update of an RSS or ATOM feed is completed.
///
///
/// As the event is fired on the resource thread, you don't need to marshal non-read-only
/// resource operations by using the . All the resource modifications
/// can be made from the current thread.
/// However, thus the UI operations must be marshalled to the UI thread.
/// This can be done by either calling
/// or using the . You should not call the synchronous
/// from the resource thread.
///
event ResourceEventHandler FeedUpdated;
///
/// Fires on the UI thread when a manual “Update All Feeds” action is executed.
///
/// The event is async and imposes no limits on user calls from the handler.
/// 2.1
event EventHandler UpdateAllStarted;
///
/// Fires on the UI thread when the “Update All Feeds” action completes updating all its feeds.
///
/// The event is async and imposes no limits on user calls from the handler.
/// 2.1
event EventHandler UpdateAllFinished;
///
/// Gets whether the “Update All Feeds” action is currently updating its feeds.
///
/// 2.1
bool IsDoingUpdateAll { get; }
///
/// Attempts to start updating all the feeds.
///
/// Whether an update-all was initiated successfully.
/// The attempt succeeds if an “update all feeds” process is not currently running. In this case the function returns True.
/// Otherwise, all the feeds are not queued for update again and False is returned.
bool UpdateAll();
}
}