Exemple #1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomPushEVSEDataRequestSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomOperatorEVSEDataSerializer">A delegate to serialize custom operator EVSE data JSON objects.</param>
        /// <param name="CustomEVSEDataRecordSerializer">A delegate to serialize custom EVSE data record JSON objects.</param>
        /// <param name="CustomAddressSerializer">A delegate to serialize custom address JSON objects.</param>
        /// <param name="CustomChargingFacilitySerializer">A delegate to serialize custom charging facility JSON objects.</param>
        /// <param name="CustomGeoCoordinatesSerializer">A delegate to serialize custom geo coordinates JSON objects.</param>
        /// <param name="CustomEnergySourceSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomEnvironmentalImpactSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomOpeningTimesSerializer">A delegate to serialize custom opening time JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <PushEVSEDataRequest> CustomPushEVSEDataRequestSerializer = null,
                              CustomJObjectSerializerDelegate <OperatorEVSEData> CustomOperatorEVSEDataSerializer       = null,
                              CustomJObjectSerializerDelegate <EVSEDataRecord> CustomEVSEDataRecordSerializer           = null,
                              CustomJObjectSerializerDelegate <Address> CustomAddressSerializer = null,
                              CustomJObjectSerializerDelegate <ChargingFacility> CustomChargingFacilitySerializer       = null,
                              CustomJObjectSerializerDelegate <GeoCoordinates> CustomGeoCoordinatesSerializer           = null,
                              CustomJObjectSerializerDelegate <EnergySource> CustomEnergySourceSerializer               = null,
                              CustomJObjectSerializerDelegate <EnvironmentalImpact> CustomEnvironmentalImpactSerializer = null,
                              CustomJObjectSerializerDelegate <OpeningTime> CustomOpeningTimesSerializer = null)
        {
            var JSON = JSONObject.Create(
                new JProperty("ActionType", Action.AsString()),
                new JProperty("OperatorEvseData", OperatorEVSEData.ToJSON(CustomOperatorEVSEDataSerializer,
                                                                          CustomEVSEDataRecordSerializer,
                                                                          CustomAddressSerializer,
                                                                          CustomChargingFacilitySerializer,
                                                                          CustomGeoCoordinatesSerializer,
                                                                          CustomEnergySourceSerializer,
                                                                          CustomEnvironmentalImpactSerializer,
                                                                          CustomOpeningTimesSerializer))
                );

            return(CustomPushEVSEDataRequestSerializer != null
                       ? CustomPushEVSEDataRequestSerializer(this, JSON)
                       : JSON);
        }
Exemple #2
0
        /// <summary>
        /// Create a new PushEVSEData request.
        /// </summary>
        /// <param name="OperatorEVSEData">The operator EVSE data record.</param>
        /// <param name="Action">The server-side data management operation.</param>
        ///
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">The timeout for this request.</param>
        public PushEVSEDataRequest(OperatorEVSEData OperatorEVSEData,
                                   ActionTypes Action = ActionTypes.FullLoad,

                                   DateTime?Timestamp = null,
                                   CancellationToken?CancellationToken = null,
                                   EventTracking_Id EventTrackingId    = null,
                                   TimeSpan?RequestTimeout             = null)

            : base(null,
                   Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {
            this.OperatorEVSEData = OperatorEVSEData ?? throw new ArgumentNullException(nameof(OperatorEVSEData), "The given operator EVSE data must not be null!");
            this.Action           = Action;
        }