Exemplo n.º 1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        public XElement ToXML()

        => new XElement(OCPPNS.OCPPv1_6_CP + "sendLocalListRequest",

                        new XElement(OCPPNS.OCPPv1_6_CP + "listVersion", ListVersion),

                        LocalAuthorizationList.IsNeitherNullNorEmpty()
                       ? LocalAuthorizationList.Select(item => item.ToXML(OCPPNS.OCPPv1_6_CP + "localAuthorizationList"))
                       : null,

                        new XElement(OCPPNS.OCPPv1_6_CP + "updateType", UpdateType.AsText())

                        );
Exemplo n.º 2
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomSendLocalListRequestSerializer">A delegate to serialize custom start transaction requests.</param>
        /// <param name="CustomAuthorizationDataSerializer">A delegate to serialize custom start transaction requests.</param>
        /// <param name="CustomIdTagInfoResponseSerializer">A delegate to serialize custom IdTagInfos.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <SendLocalListRequest> CustomSendLocalListRequestSerializer = null,
                              CustomJObjectSerializerDelegate <AuthorizationData> CustomAuthorizationDataSerializer       = null,
                              CustomJObjectSerializerDelegate <IdTagInfo> CustomIdTagInfoResponseSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("listVersion", ListVersion),
                new JProperty("updateType", UpdateType.AsText()),

                LocalAuthorizationList.IsNeitherNullNorEmpty()
                               ? new JProperty("localAuthorizationList", new JArray(LocalAuthorizationList.Select(item => item.ToJSON(CustomAuthorizationDataSerializer,
                                                                                                                                      CustomIdTagInfoResponseSerializer))))
                               : null

                );

            return(CustomSendLocalListRequestSerializer != null
                       ? CustomSendLocalListRequestSerializer(this, JSON)
                       : JSON);
        }