コード例 #1
0
 //May need to include employee id
 public PostNotificationsRequest(string notificationType, string employeeID, string sender)
 {
     Body = new NotificationRequestBody
     {
         notificationType = notificationType,
         employee_id      = employeeID,
         sender           = sender
     };
 }
コード例 #2
0
 public static NotificationRequest ToNotificationRequest(this NotificationRequestBody requestBody, TimeZoneInfo timeZone)
 {
     return(new NotificationRequest
     {
         PhoneNumber = requestBody.PhoneNumber?.ParsePhoneNumber(requestBody.PhoneNumberCountryCode).NationalNumber,
         PhoneNumberCountryCode = requestBody.PhoneNumberCountryCode,
         EmailAddress = requestBody.EmailAddress,
         TimeToSend = TimeZoneInfo.ConvertTimeToUtc(requestBody.TimeToSend, timeZone).TimeOfDay,
         Latitude = requestBody.Latitude,
         Longitude = requestBody.Longitude,
         RainThreshold = requestBody.RainThreshold,
     });
 }
コード例 #3
0
        public async Task <IActionResult> RegisterForNotifications(NotificationRequestBody requestBody)
        {
            // Load the timezone for the selected location
            var timeZone = await LocationService.GetTimeZone(requestBody.Latitude, requestBody.Longitude);

            // Parse the request body into the correct model
            var notificationRequest = requestBody.ToNotificationRequest(timeZone);

            try
            {
                await NotificationService.AddNotificationRequest(notificationRequest);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            return(Ok());
        }
コード例 #4
0
        public void CreateTestNotificationAtResourceGroupLevelTest()
        {
            var expectedResponse = new HttpResponseMessage(HttpStatusCode.Accepted)
            {
                Content = new StringContent(@""),
            };

            expectedResponse.Headers.Location = new Uri("https://test.test");

            var handler = new RecordedDelegatingHandler(expectedResponse)
            {
                SubsequentStatusCodeToReturn = HttpStatusCode.OK
            };
            var insightsClient = GetMonitorManagementClient(handler);

            NotificationRequestBody request = GetNotificationRequestBody();
            var result = insightsClient.ActionGroups.CreateNotificationsAtResourceGroupLevel("Test-Rg", request);

            Assert.NotNull(result);
        }
コード例 #5
0
 /// <summary>
 /// Send test notifications to a set of provided receivers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='notificationRequest'>
 /// The notification request body which includes the contact details
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <TestNotificationResponse> BeginPostTestNotificationsAsync(this IActionGroupsOperations operations, NotificationRequestBody notificationRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginPostTestNotificationsWithHttpMessagesAsync(notificationRequest, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #6
0
 /// <summary>
 /// Send test notifications to a set of provided receivers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='notificationRequest'>
 /// The notification request body which includes the contact details
 /// </param>
 public static TestNotificationResponse BeginPostTestNotifications(this IActionGroupsOperations operations, NotificationRequestBody notificationRequest)
 {
     return(operations.BeginPostTestNotificationsAsync(notificationRequest).GetAwaiter().GetResult());
 }
コード例 #7
0
 /// <summary>
 /// Send test notifications to a set of provided receivers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='actionGroupName'>
 /// The name of the action group.
 /// </param>
 /// <param name='notificationRequest'>
 /// The notification request body which includes the contact details
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ActionGroupsCreateNotificationsAtActionGroupResourceLevelHeaders> BeginCreateNotificationsAtActionGroupResourceLevelAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, NotificationRequestBody notificationRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateNotificationsAtActionGroupResourceLevelWithHttpMessagesAsync(resourceGroupName, actionGroupName, notificationRequest, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Headers);
     }
 }
コード例 #8
0
 /// <summary>
 /// Send test notifications to a set of provided receivers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='actionGroupName'>
 /// The name of the action group.
 /// </param>
 /// <param name='notificationRequest'>
 /// The notification request body which includes the contact details
 /// </param>
 public static ActionGroupsCreateNotificationsAtActionGroupResourceLevelHeaders BeginCreateNotificationsAtActionGroupResourceLevel(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, NotificationRequestBody notificationRequest)
 {
     return(operations.BeginCreateNotificationsAtActionGroupResourceLevelAsync(resourceGroupName, actionGroupName, notificationRequest).GetAwaiter().GetResult());
 }
コード例 #9
0
 /// <summary>
 /// Send test notifications to a set of provided receivers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='notificationRequest'>
 /// The notification request body which includes the contact details
 /// </param>
 public static ActionGroupsPostTestNotificationsHeaders PostTestNotifications(this IActionGroupsOperations operations, NotificationRequestBody notificationRequest)
 {
     return(operations.PostTestNotificationsAsync(notificationRequest).GetAwaiter().GetResult());
 }