Esempio n. 1
0
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="listEndpointsParameters">-</param>
        /// <returns>-</returns>
        public EncodedMessage Encode(ListEndpointsParameters listEndpointsParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = listEndpointsParameters.ApplicationMessageId,
                TeamSetContextId     = listEndpointsParameters.TeamsetContextId ?? "",
                TechnicalMessageType = TechnicalMessageType,
                Mode = RequestEnvelope.Types.Mode.Direct
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = ListEndpointsQuery.Descriptor.FullName
            };

            var listEndpointsQuery = new ListEndpointsQuery {
                Direction = listEndpointsParameters.Direction
            };

            if (null != listEndpointsParameters.TechnicalMessageType)
            {
                listEndpointsQuery.TechnicalMessageType = listEndpointsParameters.TechnicalMessageType;
            }

            messagePayloadParameters.Value = listEndpointsQuery.ToByteString();

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
Esempio n. 2
0
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="sendMessageParameters">-</param>
        /// <returns>-</returns>
        public EncodedMessage Encode(SendChunkedMessageParameters sendMessageParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = sendMessageParameters.ApplicationMessageId,
                TeamSetContextId     = sendMessageParameters.TeamsetContextId ?? "",
                TechnicalMessageType = sendMessageParameters.TechnicalMessageType,
                Mode       = Mode,
                Recipients = sendMessageParameters.Recipients,
                ChunkInfo  = sendMessageParameters.ChunkInfo
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = sendMessageParameters.TypeUrl ?? TechnicalMessageTypes.Empty,
                Value   = ByteString.FromBase64(sendMessageParameters.Base64MessageContent)
            };

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
Esempio n. 3
0
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="feedDeleteParameters">-</param>
        /// <returns>-</returns>
        public EncodedMessage Encode(FeedDeleteParameters feedDeleteParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = feedDeleteParameters.ApplicationMessageId,
                TeamSetContextId     = feedDeleteParameters.TeamsetContextId ?? "",
                TechnicalMessageType = TechnicalMessageTypes.DkeFeedConfirm,
                Mode = RequestEnvelope.Types.Mode.Direct
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = MessageDelete.Descriptor.FullName
            };

            var messageDelete = new MessageDelete();

            feedDeleteParameters.Senders?.ForEach(sender => messageDelete.Senders.Add(sender));
            feedDeleteParameters.MessageIds?.ForEach(messageId => messageDelete.MessageIds.Add(messageId));
            feedDeleteParameters.ValidityPeriod = feedDeleteParameters.ValidityPeriod;

            messagePayloadParameters.Value = messageDelete.ToByteString();

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="onboardVcuParameters"></param>
        /// <returns>-</returns>
        public EncodedMessage Encode(OnboardVcuParameters onboardVcuParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = onboardVcuParameters.ApplicationMessageId,
                TeamSetContextId     = onboardVcuParameters.TeamsetContextId ?? "",
                TechnicalMessageType = TechnicalMessageTypes.DkeCloudOnboardEndpoints,
                Mode = RequestEnvelope.Types.Mode.Direct
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = OnboardingRequest.Descriptor.FullName
            };

            var onboardingRequest = new OnboardingRequest();

            foreach (var onboardingRequestEntry in onboardVcuParameters.OnboardingRequests)
            {
                onboardingRequest.OnboardingRequests.Add(onboardingRequestEntry);
            }

            messagePayloadParameters.Value = onboardingRequest.ToByteString();

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
Esempio n. 5
0
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="subscriptionParameters">-</param>
        /// <returns>-</returns>
        public EncodedMessage Encode(SubscriptionParameters subscriptionParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = subscriptionParameters.ApplicationMessageId,
                TeamSetContextId     = subscriptionParameters.TeamsetContextId ?? "",
                TechnicalMessageType = TechnicalMessageTypes.DkeSubscription,
                Mode = RequestEnvelope.Types.Mode.Direct
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = Subscription.Descriptor.FullName
            };

            var subscription = new Subscription();

            subscriptionParameters.TechnicalMessageTypes?.ForEach(technicalMessageType =>
                                                                  subscription.TechnicalMessageTypes.Add(technicalMessageType));

            messagePayloadParameters.Value = subscription.ToByteString();

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="multipleMessageEntry">-</param>
        /// <returns>-</returns>
        public EncodedMessage Encode(MultipleMessageEntry multipleMessageEntry)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = multipleMessageEntry.ApplicationMessageId,
                TeamSetContextId     = multipleMessageEntry.TeamsetContextId ?? "",
                TechnicalMessageType = multipleMessageEntry.TechnicalMessageType,
                Mode       = Mode,
                Recipients = multipleMessageEntry.Recipients
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = multipleMessageEntry.TypeUrl ?? TechnicalMessageTypes.Empty,
                Value   = ByteString.FromBase64(multipleMessageEntry.Base64MessageContent)
            };

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }
Esempio n. 7
0
        /// <summary>
        ///     Please see <seealso cref="IEncodeMessageService{T}.Encode" /> for documentation.
        /// </summary>
        /// <param name="capabilitiesParameters"></param>
        /// <returns>-</returns>
        public EncodedMessage Encode(CapabilitiesParameters capabilitiesParameters)
        {
            var messageHeaderParameters = new MessageHeaderParameters
            {
                ApplicationMessageId = capabilitiesParameters.ApplicationMessageId,
                TeamSetContextId     = capabilitiesParameters.TeamsetContextId ?? "",
                TechnicalMessageType = TechnicalMessageTypes.DkeCapabilities,
                Mode = RequestEnvelope.Types.Mode.Direct
            };

            var messagePayloadParameters = new MessagePayloadParameters
            {
                TypeUrl = CapabilitySpecification.Descriptor.FullName
            };

            var capabilitySpecification = new CapabilitySpecification
            {
                AppCertificationId        = capabilitiesParameters.ApplicationId,
                AppCertificationVersionId = capabilitiesParameters.CertificationVersionId
            };

            capabilitiesParameters.CapabilityParameters.ForEach(capabilityParameter =>
            {
                var capability = new CapabilitySpecification.Types.Capability
                {
                    TechnicalMessageType = capabilityParameter.TechnicalMessageType,
                    Direction            = capabilityParameter.Direction
                };
                capabilitySpecification.Capabilities.Add(capability);
            });
            messagePayloadParameters.Value = capabilitySpecification.ToByteString();

            var encodedMessage = new EncodedMessage
            {
                Id      = Guid.NewGuid().ToString(),
                Content = EncodeMessageService.Encode(messageHeaderParameters, messagePayloadParameters)
            };

            return(encodedMessage);
        }