/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Subscriber = new Subscriber(this); Tenants = new Tenants(this); Topics = new Topics(this); BaseUri = new System.Uri("http://localhost:8979"); 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 <JsonConverter> { 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 <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
public ClientUsingFetch() { session = Diffusion.Sessions.Principal( "client" ).Password( "password" ) .Open( "ws://diffusion.example.com:80" ); topics = session.GetTopicsFeature(); }
/// <summary> /// Get topic /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicHandle'> /// Topic handle /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <TopicView> GetTopicAsync(this ITopics operations, string topicHandle, string authorization, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetTopicWithHttpMessagesAsync(topicHandle, authorization, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public ClientUsingFetch() { session = Diffusion.Sessions.Principal("client").Password("password") .Open("ws://diffusion.example.com:80"); topics = session.GetTopicsFeature(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// </param> /// <param name='topicName'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <string> DeleteTopicAsync(this ITopics operations, string tenantId, string topicName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteTopicWithHttpMessagesAsync(tenantId, topicName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetTopicsAsync(this ITopics operations, string tenantId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetTopicsWithHttpMessagesAsync(tenantId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Get recent topics /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cursor'> /// Current read cursor /// </param> /// <param name='limit'> /// Number of items to return /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <FeedResponseTopicView> GetTopicsAsync(this ITopics operations, string authorization, string cursor = default(string), int?limit = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetTopicsWithHttpMessagesAsync(authorization, cursor, limit, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Create a new topic /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='request'> /// Post topic request /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PostTopicResponse> PostTopicAsync(this ITopics operations, PostTopicRequest request, string authorization, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostTopicWithHttpMessagesAsync(request, authorization, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Get a topic by topic name /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicName'> /// Topic name /// </param> /// <param name='publisherType'> /// Publisher type. Possible values include: 'User', 'App' /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GetTopicByNameResponse> GetTopicByNameAsync(this ITopics operations, string topicName, PublisherType publisherType, string authorization, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetTopicByNameWithHttpMessagesAsync(topicName, publisherType, authorization, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Delete a topic name /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicName'> /// Topic name /// </param> /// <param name='request'> /// Delete topic request /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> DeleteTopicNameAsync(this ITopics operations, string topicName, DeleteTopicNameRequest request, string authorization, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteTopicNameWithHttpMessagesAsync(topicName, request, authorization, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public TopicManager(ISession session, DataGenerators.ICarControlsDataGenerator carControlsDataGenerator, DataGenerators.ICarStateDataGenerator carStateDataGenerator, RefreshIntervalManager refreshIntervalManager, Metrics metrics) { this.carControlsDataGenerator = carControlsDataGenerator; this.carStateDataGenerator = carStateDataGenerator; this.refreshIntervalManager = refreshIntervalManager; this.metrics = metrics; topics = session.GetTopicsFeature(); topicControl = session.GetTopicControlFeature(); topicUpdateControl = session.GetTopicUpdateControlFeature(); topicPathsPendingAddition = new List<string>(); // The first thing we need to do is kick of an asynchronous request to see // whether our root topic path already exists. var topicDetailsHandler = new Handlers.TopicDetailsHandler(); topicDetailsHandler.Success += topicDetailsHandler_Success; topics.GetTopicDetails(rootTopicPath, TopicDetailsLevel.BASIC, topicDetailsHandler); }
public TopicManager(ISession session, DataGenerators.ICarControlsDataGenerator carControlsDataGenerator, DataGenerators.ICarStateDataGenerator carStateDataGenerator, RefreshIntervalManager refreshIntervalManager, Metrics metrics) { this.carControlsDataGenerator = carControlsDataGenerator; this.carStateDataGenerator = carStateDataGenerator; this.refreshIntervalManager = refreshIntervalManager; this.metrics = metrics; topics = session.GetTopicsFeature(); topicControl = session.GetTopicControlFeature(); topicUpdateControl = session.GetTopicUpdateControlFeature(); topicPathsPendingAddition = new List <string>(); // The first thing we need to do is kick of an asynchronous request to see // whether our root topic path already exists. var topicDetailsHandler = new Handlers.TopicDetailsHandler(); topicDetailsHandler.Success += topicDetailsHandler_Success; topics.GetTopicDetails(rootTopicPath, TopicDetailsLevel.BASIC, topicDetailsHandler); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// </param> /// <param name='topicName'> /// </param> public static string DeleteTopic(this ITopics operations, string tenantId, string topicName) { return(operations.DeleteTopicAsync(tenantId, topicName).GetAwaiter().GetResult()); }
/// <summary> /// Delete a topic name /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicName'> /// Topic name /// </param> /// <param name='request'> /// Delete topic request /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> public static object DeleteTopicName(this ITopics operations, string topicName, DeleteTopicNameRequest request, string authorization) { return(Task.Factory.StartNew(s => ((ITopics)s).DeleteTopicNameAsync(topicName, request, authorization), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Get a topic by topic name /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicName'> /// Topic name /// </param> /// <param name='publisherType'> /// Publisher type. Possible values include: 'User', 'App' /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> public static GetTopicByNameResponse GetTopicByName(this ITopics operations, string topicName, PublisherType publisherType, string authorization) { return(Task.Factory.StartNew(s => ((ITopics)s).GetTopicByNameAsync(topicName, publisherType, authorization), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Get featured topics /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> /// <param name='cursor'> /// Current read cursor /// </param> /// <param name='limit'> /// Number of items to return /// </param> public static FeedResponseTopicView GetFeaturedTopics(this ITopics operations, string authorization, string cursor = default(string), int?limit = default(int?)) { return(Task.Factory.StartNew(s => ((ITopics)s).GetFeaturedTopicsAsync(authorization, cursor, limit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
public TopicsController(ITopics topicsService, IMapper mapper) { _topicsService = topicsService; _mapper = mapper; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// </param> public static object GetTopics(this ITopics operations, string tenantId) { return(operations.GetTopicsAsync(tenantId).GetAwaiter().GetResult()); }
/// <summary> /// Create a new topic /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='request'> /// Post topic request /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> public static PostTopicResponse PostTopic(this ITopics operations, PostTopicRequest request, string authorization) { return(Task.Factory.StartNew(s => ((ITopics)s).PostTopicAsync(request, authorization), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Get topic /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='topicHandle'> /// Topic handle /// </param> /// <param name='authorization'> /// Format is: "Scheme CredentialsList". Possible values are: /// /// - Anon AK=AppKey /// /// - SocialPlus TK=SessionToken /// /// - Facebook AK=AppKey|TK=AccessToken /// /// - Google AK=AppKey|TK=AccessToken /// /// - Twitter AK=AppKey|RT=RequestToken|TK=AccessToken /// /// - Microsoft AK=AppKey|TK=AccessToken /// /// - AADS2S AK=AppKey|[UH=UserHandle]|TK=AADToken /// </param> public static TopicView GetTopic(this ITopics operations, string topicHandle, string authorization) { return(Task.Factory.StartNew(s => ((ITopics)s).GetTopicAsync(topicHandle, authorization), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }