示例#1
0
        public override JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("method", Method.ToString()),
            new JProperty("URL", URL),
            new JProperty("TCPPort", RemotePort.ToUInt16()),

            BasicAuth_Login.IsNotNullOrEmpty() &&
            BasicAuth_Password.IsNotNullOrEmpty()
                       ? new JProperty("basicAuth",
                                       new JObject(
                                           new JProperty("login", BasicAuth_Login),
                                           new JProperty("password", BasicAuth_Password)
                                           )
                                       )
                       : null,

            APIKey.IsNotNullOrEmpty()
                       ? new JProperty("APIKey", APIKey)
                       : null,

            RequestTimeout.HasValue
                       ? new JProperty("RequestTimeout", RequestTimeout.Value.TotalSeconds)
                       : null,

            NotificationMessageTypes.SafeAny()
                       ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString())))
                       : null,

            Description.IsNotNullOrEmpty()
                       ? new JProperty("description", Description)
                       : null

            );