/// <summary>
        /// Map to AsyncIdResponse
        /// </summary>
        /// <param name="response">Response</param>
        /// <returns>The AsyncIdResponse</returns>
        public static AsyncIdResponse Map(mds.Model.AsyncIDResponse response)
        {
            var asyncIdResponse = new AsyncIdResponse
            {
                Status      = response.Status,
                Payload     = response.Payload,
                MaxAge      = response.MaxAge,
                Error       = response.Error,
                Id          = response.Id,
                ContentType = response.Ct,
            };

            return(asyncIdResponse);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Map the notification message
        /// </summary>
        /// <param name="data">Notification Message Data</param>
        /// <returns>The Notification Message</returns>
        public static NotificationMessage Map(mds.Model.NotificationMessage data)
        {
            var notificationMessage = new NotificationMessage
            {
                AsyncResponses  = data?.AsyncResponses?.Select(a => AsyncIdResponse.Map(a))?.ToList() ?? Enumerable.Empty <AsyncIdResponse>().ToList(),
                DeRegistrations = data?.DeRegistrations?.Select(r => new DeviceEventData {
                    DeviceId = r, State = DeviceEvent.DeRegistration
                })?.ToList() ?? Enumerable.Empty <DeviceEventData>().ToList(),
                RegistrationUpdates  = data?.RegUpdates?.Select(r => DeviceEventData.Map(r, DeviceEvent.RegistrationUpdate))?.ToList() ?? Enumerable.Empty <DeviceEventData>().ToList(),
                Registrations        = data?.Registrations?.Select(r => DeviceEventData.Map(r, DeviceEvent.Registration))?.ToList() ?? Enumerable.Empty <DeviceEventData>().ToList(),
                Notifications        = data?.Notifications?.Select(n => NotificationData.Map(n))?.ToList() ?? Enumerable.Empty <NotificationData>().ToList(),
                RegistrationsExpired = data?.RegistrationsExpired?.Select(r => new DeviceEventData {
                    DeviceId = r, State = DeviceEvent.ExpiredRegistration
                })?.ToList() ?? Enumerable.Empty <DeviceEventData>().ToList(),
            };

            return(notificationMessage);
        }