Esempio n. 1
0
 /// <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();
        }
Esempio n. 3
0
 /// <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);
     }
 }
Esempio n. 4
0
        public ClientUsingFetch()
        {
            session = Diffusion.Sessions.Principal("client").Password("password")
                      .Open("ws://diffusion.example.com:80");

            topics = session.GetTopicsFeature();
        }
Esempio n. 5
0
 /// <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);
     }
 }
Esempio n. 6
0
 /// <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);
     }
 }
Esempio n. 7
0
 /// <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);
     }
 }
Esempio n. 8
0
 /// <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);
     }
 }
Esempio n. 9
0
 /// <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);
     }
 }
Esempio n. 10
0
 /// <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);
        }
Esempio n. 13
0
 /// <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());
 }
Esempio n. 14
0
 /// <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());
 }
Esempio n. 15
0
 /// <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());
 }
Esempio n. 16
0
 /// <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());
 }
Esempio n. 17
0
 public TopicsController(ITopics topicsService,
                         IMapper mapper)
 {
     _topicsService = topicsService;
     _mapper        = mapper;
 }
Esempio n. 18
0
 /// <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());
 }
Esempio n. 19
0
 /// <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());
 }
Esempio n. 20
0
 /// <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());
 }