/// <summary>
 /// Returns information about subscriptions of the specified notification type.
 /// You can use this API to get subscription information when you do not have a
 /// subscription identifier.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <GetSubscriptionResponse> GetSubscriptionAsync(this INotificationsClient operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Returns information about a subscription for the specified notification
 /// type. The getSubscriptionById API is grantless. For more information, see
 /// "Grantless operations" in the Selling Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// The identifier for the subscription that you want to get.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> GetSubscriptionByIdAsync(this INotificationsClient operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetSubscriptionByIdWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public ObservableNotificationsClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, nameof(client));

            _connection          = client.Connection;
            _notificationsClient = client.Activity.Notifications;
        }
Beispiel #4
0
        public ObservableNotificationsClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _connection = client.Connection;
            _notificationsClient = client.Notification;
        }
        public ObservableNotificationsClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _connection          = client.Connection;
            _notificationsClient = client.Notification;
        }
 /// <summary>
 /// Deletes the destination that you specify. The deleteDestination API is
 /// grantless. For more information, see "Grantless operations" in the Selling
 /// Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='destinationId'>
 /// The identifier for the destination that you want to delete.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DeleteDestinationResponse> DeleteDestinationAsync(this INotificationsClient operations, string destinationId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.DeleteDestinationWithHttpMessagesAsync(destinationId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates a destination resource to receive notifications. The
 /// createDestination API is grantless. For more information, see "Grantless
 /// operations" in the Selling Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CreateDestinationResponse> CreateDestinationAsync(this INotificationsClient operations, CreateDestinationRequest body, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateDestinationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public CompanyInvitationsController(
     CompaniesDbContext db,
     IEmailingClient emailingClient,
     IUsersClient usersClient,
     IAuthenticator authenticator,
     INotificationsClient notificationsClient)
 {
     this.db                  = db;
     this.emailingClient      = emailingClient;
     this.usersClient         = usersClient;
     this.authenticator       = authenticator;
     this.notificationsClient = notificationsClient;
 }
        public NotificationsListViewModel(INotificationsClient notificationsApi)
        {
            Notifications = new ReactiveList<NotificationTileViewModel>();
            LoadNotifications = new ReactiveCommand();

            var loadedNotifications = LoadNotifications.RegisterAsync(_ =>
                //BlobCache.LocalMachine.GetAndFetchLatest("notifications", () => Observable.Return(new List<Notification>())));
                BlobCache.LocalMachine.GetAndFetchLatest("notifications", () =>
                    notificationsApi.GetAllForCurrent()));

            loadedNotifications.Subscribe(newItems => {
                using (Notifications.SuppressChangeNotifications()) {
                    var toAdd = newItems
                        .Where(x => x.Repository.Owner.Id != 9919 && x.Repository.Owner.Id != 1089146)
                        .Select(x => new NotificationTileViewModel(x))
                        .ToArray();

                    Notifications.Clear();
                    Notifications.AddRange(toAdd);
                    //Notifications.AddRange(new[] { new NotificationTileViewModel(null) });
                }
            });
        }
Beispiel #10
0
        public static async Task <UserNotificationDto[]> WaitForMyNotificationsAsyn(this INotificationsClient notificationsClient,
                                                                                    Func <UserNotificationDto, bool> condition, TimeSpan timeout)
        {
            var result = Array.Empty <UserNotificationDto>();

            using (var cts = new CancellationTokenSource(timeout))
            {
                while (!cts.IsCancellationRequested)
                {
                    var response = await notificationsClient.GetMyNotificationsAsync(cancellationToken : cts.Token);

                    if (response.Items.Count > 0 && (condition == null || response.Items.Any(condition)))
                    {
                        result = response.Items.ToArray();
                        break;
                    }

                    await Task.Delay(50);
                }
            }

            return(result);
        }
 public NotificationClientTests()
 {
     NotificationsClient = Helper.GetAuthClient().Notifications;
 }
Beispiel #12
0
 public CompanyUsersController(CompaniesDbContext db, INotificationsClient notificationsClient)
 {
     this.db = db;
     this.notificationsClient = notificationsClient;
 }
 /// <summary>
 /// Creates a subscription for the specified notification type to be delivered
 /// to the specified destination. Before you can subscribe, you must first
 /// create the destination by calling the createDestination operation.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// </param>
 public static CreateSubscriptionResponse CreateSubscription(this INotificationsClient operations, CreateSubscriptionRequest body)
 {
     return(operations.CreateSubscriptionAsync(body).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Returns information about a subscription for the specified notification
 /// type. The getSubscriptionById API is grantless. For more information, see
 /// "Grantless operations" in the Selling Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// The identifier for the subscription that you want to get.
 /// </param>
 public static object GetSubscriptionById(this INotificationsClient operations, string subscriptionId)
 {
     return(operations.GetSubscriptionByIdAsync(subscriptionId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes the subscription indicated by the subscription identifier and
 /// notification type that you specify. The subscription identifier can be for
 /// any subscription associated with your application. After you successfully
 /// call this operation, notifications will stop being sent for the associated
 /// subscription. The deleteSubscriptionById API is grantless. For more
 /// information, see "Grantless operations" in the Selling Partner API
 /// Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// The identifier for the subscription that you want to delete.
 /// </param>
 public static DeleteSubscriptionByIdResponse DeleteSubscriptionById(this INotificationsClient operations, string subscriptionId)
 {
     return(operations.DeleteSubscriptionByIdAsync(subscriptionId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes the destination that you specify. The deleteDestination API is
 /// grantless. For more information, see "Grantless operations" in the Selling
 /// Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='destinationId'>
 /// The identifier for the destination that you want to delete.
 /// </param>
 public static DeleteDestinationResponse DeleteDestination(this INotificationsClient operations, string destinationId)
 {
     return(operations.DeleteDestinationAsync(destinationId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Returns information about subscriptions of the specified notification type.
 /// You can use this API to get subscription information when you do not have a
 /// subscription identifier.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static GetSubscriptionResponse GetSubscription(this INotificationsClient operations)
 {
     return(operations.GetSubscriptionAsync().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Returns information about all destinations. The getDestinations API is
 /// grantless. For more information, see "Grantless operations" in the Selling
 /// Partner API Developer Guide.
 ///
 /// **Usage Plan:**
 ///
 /// | Rate (requests per second) | Burst |
 /// | ---- | ---- |
 /// | 1 | 5 |
 ///
 /// For more information, see "Usage Plans and Rate Limits" in the Selling
 /// Partner API documentation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static GetDestinationsResponse GetDestinations(this INotificationsClient operations)
 {
     return(operations.GetDestinationsAsync().GetAwaiter().GetResult());
 }