Example #1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomRFIDIdentificationSerializer">A delegate to serialize custom RFID identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <RFIDIdentification> CustomRFIDIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("UID", UID.ToString()),

                new JProperty("RFID", RFIDType.AsString()),

                EVCOId.HasValue
                               ? new JProperty("EvcoID", EVCOId.Value.ToString())
                               : null,

                PrintedNumber.IsNeitherNullNorEmpty()
                               ? new JProperty("PrintedNumber", PrintedNumber)
                               : null,

                ExpiryDate.HasValue
                               ? new JProperty("ExpiryDate", ExpiryDate.Value.ToIso8601())
                               : null,

                CustomData?.HasValues == true
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomRFIDIdentificationSerializer != null
                       ? CustomRFIDIdentificationSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomStopTransactionRequestRequestSerializer">A delegate to serialize custom stop transaction requests.</param>
        /// <param name="CustomMeterValueSerializer">A delegate to serialize custom meter values.</param>
        /// <param name="CustomSampledValueSerializer">A delegate to serialize custom sampled values.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <StopTransactionRequest> CustomStopTransactionRequestRequestSerializer = null,
                              CustomJObjectSerializerDelegate <MeterValue> CustomMeterValueSerializer     = null,
                              CustomJObjectSerializerDelegate <SampledValue> CustomSampledValueSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("transactionId", TransactionId.ToString()),
                new JProperty("timestamp", Timestamp.ToIso8601()),
                new JProperty("meterStop", MeterStop),

                IdTag.HasValue
                               ? new JProperty("idTag", IdTag.Value.ToString())
                               : null,

                Reason.HasValue
                               ? new JProperty("reason", Reason.Value.ToString())
                               : null,

                TransactionData.SafeAny()
                               ? new JProperty("transactionData", new JArray(TransactionData.Select(meterValue => meterValue.ToJSON(CustomMeterValueSerializer,
                                                                                                                                    CustomSampledValueSerializer))))
                               : null

                );

            return(CustomStopTransactionRequestRequestSerializer != null
                       ? CustomStopTransactionRequestRequestSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeRemoteReservationStopRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStopRequest responses.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeRemoteReservationStopRequest> CustomAuthorizeRemoteReservationStopRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("ProviderID", ProviderId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("SessionID", SessionId.ToString()),

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomAuthorizeRemoteReservationStopRequestSerializer != null
                       ? CustomAuthorizeRemoteReservationStopRequestSerializer(this, JSON)
                       : JSON);
        }
Example #4
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <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 <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("EvseDataRecord", new JArray(EVSEDataRecords.Select(evseDataRecord => evseDataRecord.ToJSON(CustomEVSEDataRecordSerializer,
                                                                                                                          CustomAddressSerializer,
                                                                                                                          CustomChargingFacilitySerializer,
                                                                                                                          CustomGeoCoordinatesSerializer,
                                                                                                                          CustomEnergySourceSerializer,
                                                                                                                          CustomEnvironmentalImpactSerializer,
                                                                                                                          CustomOpeningTimesSerializer)))),
                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("OperatorName", OperatorName),

                CustomData?.HasValues == true
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomOperatorEVSEDataSerializer != null
                       ? CustomOperatorEVSEDataSerializer(this, JSON)
                       : JSON);
        }
Example #5
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        public JObject ToJSON(CustomJObjectSerializerDelegate <NamedGeoCoordinate> CustomNamedGeoCoordinateSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("geoCoordinate", GeoCoordinate.ToJSON()),

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

                AttachedImages.SafeAny()
                               ? new JProperty("attachedImages", new JArray(AttachedImages))
                               : null,

                AttachedImages.SafeAny()
                               ? new JProperty("attachedFiles", new JArray(AttachedImages))
                               : null,

                CustomData.SafeAny()
                               ? new JProperty("customData", new JObject(CustomData.SafeSelect(data => new JProperty(data.Key, data.Value))))
                               : null

                );

            return(CustomNamedGeoCoordinateSerializer != null
                       ? CustomNamedGeoCoordinateSerializer(this, JSON)
                       : JSON);
        }
Example #6
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);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomPublishTokenTypeSerializer">A delegate to serialize custom publish token type JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <PublishTokenType> CustomPublishTokenTypeSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("uid", Id.ToString()),

                Type.HasValue
                               ? new JProperty("type", Type.ToString())
                               : null,

                VisualNumber.IsNotNullOrEmpty()
                               ? new JProperty("visual_number", VisualNumber)
                               : null,

                Issuer.IsNotNullOrEmpty()
                               ? new JProperty("issuer", Issuer)
                               : null,

                GroupId.HasValue
                               ? new JProperty("group_id", GroupId.ToString())
                               : null

                );

            return(CustomPublishTokenTypeSerializer != null
                       ? CustomPublishTokenTypeSerializer(this, JSON)
                       : JSON);
        }
Example #8
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeResponseSerializer">A delegate to serialize custom authorize responses.</param>
        /// <param name="CustomIdTokenInfoResponseSerializer">A delegate to serialize custom IdTokenInfos.</param>
        /// <param name="CustomIdTokenResponseSerializer">A delegate to serialize custom IdTokens.</param>
        /// <param name="CustomAdditionalInfoResponseSerializer">A delegate to serialize custom AdditionalInfo objects.</param>
        /// <param name="CustomMessageContentResponseSerializer">A delegate to serialize custom MessageContent objects.</param>
        /// <param name="CustomCustomDataResponseSerializer">A delegate to serialize CustomData objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeResponse> CustomAuthorizeResponseSerializer   = null,
                              CustomJObjectSerializerDelegate <IdTokenInfo> CustomIdTokenInfoResponseSerializer       = null,
                              CustomJObjectSerializerDelegate <IdToken> CustomIdTokenResponseSerializer               = null,
                              CustomJObjectSerializerDelegate <AdditionalInfo> CustomAdditionalInfoResponseSerializer = null,
                              CustomJObjectSerializerDelegate <MessageContent> CustomMessageContentResponseSerializer = null,
                              CustomJObjectSerializerDelegate <CustomData> CustomCustomDataResponseSerializer         = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("IdTokenInfo", IdTokenInfo.ToJSON(CustomIdTokenInfoResponseSerializer,
                                                                CustomIdTokenResponseSerializer,
                                                                CustomAdditionalInfoResponseSerializer,
                                                                CustomMessageContentResponseSerializer,
                                                                CustomCustomDataResponseSerializer)),

                CustomData != null
                               ? new JProperty("customData", CustomData.ToJSON(CustomCustomDataResponseSerializer))
                               : null

                );

            return(CustomAuthorizeResponseSerializer != null
                       ? CustomAuthorizeResponseSerializer(this, JSON)
                       : JSON);
        }
Example #9
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomClearChargingProfileRequestRequestSerializer">A delegate to serialize custom clear charging profile requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ClearChargingProfileRequest> CustomClearChargingProfileRequestRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                ChargingProfileId.HasValue
                               ? new JProperty("chargingProfileId", ChargingProfileId.Value.ToString())
                               : null,

                ConnectorId.HasValue
                               ? new JProperty("connectorId", ConnectorId.Value.ToString())
                               : null,

                ChargingProfilePurpose.HasValue
                               ? new JProperty("chargingProfilePurpose", ChargingProfilePurpose.Value.ToString())
                               : null,

                StackLevel.HasValue
                               ? new JProperty("stackLevel", StackLevel.Value.ToString())
                               : null

                );

            return(CustomClearChargingProfileRequestRequestSerializer != null
                       ? CustomClearChargingProfileRequestRequestSerializer(this, JSON)
                       : JSON);
        }
Example #10
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTransparencySoftwareSerializer">A delegate to serialize custom transparency software JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <TransparencySoftware> CustomTransparencySoftwareSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("name", Name),
                new JProperty("version", Version),
                new JProperty("legal_status", LegalStatus.ToString()),
                new JProperty("open_source_license", OpenSourceLicense.ToString()),
                new JProperty("vendor", Vendor),

                Logo.HasValue
                               ? new JProperty("logo", Logo.ToString())
                               : null,

                HowToUse.HasValue
                               ? new JProperty("how_to_use", HowToUse.ToString())
                               : null,

                MoreInformation.HasValue
                               ? new JProperty("more_information", MoreInformation.ToString())
                               : null,

                SourceCodeRepository.HasValue
                               ? new JProperty("source_code_repository", SourceCodeRepository.ToString())
                               : null

                );

            return(CustomTransparencySoftwareSerializer != null
                       ? CustomTransparencySoftwareSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizationInfoSerializer">A delegate to serialize custom authorizationInfo JSON objects.</param>
        /// <param name="CustomTokenSerializer">A delegate to serialize custom token JSON objects.</param>
        /// <param name="CustomLocationReferenceSerializer">A delegate to serialize custom location reference JSON objects.</param>
        /// <param name="CustomDisplayTextSerializer">A delegate to serialize custom multi-language text JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizationInfo> CustomAuthorizationInfoSerializer = null,
                              CustomJObjectSerializerDelegate <Token> CustomTokenSerializer = null,
                              CustomJObjectSerializerDelegate <LocationReference> CustomLocationReferenceSerializer = null,
                              CustomJObjectSerializerDelegate <DisplayText> CustomDisplayTextSerializer             = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("allowed", Allowed.ToString()),
                new JProperty("token", Token.ToJSON(CustomTokenSerializer)),

                Location.HasValue
                               ? new JProperty("location", Location.Value.ToJSON(CustomLocationReferenceSerializer))
                               : null,

                AuthorizationReference.HasValue
                               ? new JProperty("authorization_reference", AuthorizationReference.Value.ToString())
                               : null,

                Info.HasValue
                               ? new JProperty("info", Info.Value.ToJSON(CustomDisplayTextSerializer))
                               : null

                );

            return(CustomAuthorizationInfoSerializer != null
                       ? CustomAuthorizationInfoSerializer(this, JSON)
                       : JSON);
        }
Example #12
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomImageSerializer">A delegate to serialize custom image JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Image> CustomImageSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("url", URL.ToString()),

                Thumbnail.HasValue
                               ? new JProperty("thumbnail", Thumbnail.Value.ToString())
                               : null,

                new JProperty("category", Category.ToString()),
                new JProperty("type", Type.ToString()),

                Width.HasValue
                               ? new JProperty("width", Width.Value)
                               : null,

                Height.HasValue
                               ? new JProperty("height", Height.Value)
                               : null

                );

            return(CustomImageSerializer != null
                       ? CustomImageSerializer(this, JSON)
                       : JSON);
        }
Example #13
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomRemoteStartTransactionRequestSerializer">A delegate to serialize custom RemoteStartTransaction requests.</param>
        /// <param name="CustomChargingProfileSerializer">A delegate to serialize custom charging profiles.</param>
        /// <param name="CustomChargingScheduleSerializer">A delegate to serialize custom charging schedule requests.</param>
        /// <param name="CustomChargingSchedulePeriodSerializer">A delegate to serialize custom charging schedule periods.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <RemoteStartTransactionRequest> CustomRemoteStartTransactionRequestSerializer,
                              CustomJObjectSerializerDelegate <ChargingProfile> CustomChargingProfileSerializer               = null,
                              CustomJObjectSerializerDelegate <ChargingSchedule> CustomChargingScheduleSerializer             = null,
                              CustomJObjectSerializerDelegate <ChargingSchedulePeriod> CustomChargingSchedulePeriodSerializer = null)
        {
            var JSON = JSONObject.Create(

                ConnectorId.HasValue
                                  ? new JProperty("connectorId", ConnectorId.Value.Value)
                                  : null,

                new JProperty("idTag", IdTag.ToString()),

                ChargingProfile != null
                               ? new JProperty("chargingProfile", ChargingProfile.ToJSON(CustomChargingProfileSerializer,
                                                                                         CustomChargingScheduleSerializer,
                                                                                         CustomChargingSchedulePeriodSerializer))
                               : null

                );

            return(CustomRemoteStartTransactionRequestSerializer != null
                       ? CustomRemoteStartTransactionRequestSerializer(this, JSON)
                       : JSON);
        }
Example #14
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomStatusNotificationRequestSerializer">A delegate to serialize custom StatusNotification requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <StatusNotificationRequest> CustomStatusNotificationRequestSerializer)
        {
            var JSON = JSONObject.Create(

                new JProperty("connectorId", ConnectorId.Value),
                new JProperty("status", Status.AsText()),
                new JProperty("errorCode", ErrorCode.AsText()),

                Info.IsNotNullOrEmpty()
                               ? new JProperty("info", Info)
                               : null,

                StatusTimestamp.HasValue
                               ? new JProperty("timestamp", StatusTimestamp.Value.ToIso8601())
                               : null,

                VendorId.IsNotNullOrEmpty()
                               ? new JProperty("vendorId", VendorId)
                               : null,

                VendorErrorCode.IsNotNullOrEmpty()
                               ? new JProperty("vendorErrorCode", VendorErrorCode)
                               : null);

            return(CustomStatusNotificationRequestSerializer != null
                       ? CustomStatusNotificationRequestSerializer(this, JSON)
                       : JSON);
        }
Example #15
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomConnectorSerializer">A delegate to serialize custom connector JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Connector> CustomConnectorSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("id", Id.ToString()),
                new JProperty("standard", Standard.ToString()),
                new JProperty("format", Format.ToString()),
                new JProperty("power_type", PowerType.ToString()),
                new JProperty("max_voltage", MaxVoltage),
                new JProperty("max_amperage", MaxAmperage),

                MaxElectricPower.HasValue
                               ? new JProperty("max_electric_power", MaxElectricPower.Value)
                               : null,

                TariffIds.SafeAny()
                               ? new JProperty("tariff_ids", new JArray(TariffIds.Select(tarifId => tarifId.ToString())))
                               : null,

                TermsAndConditionsURL.HasValue
                               ? new JProperty("terms_and_conditions", TermsAndConditionsURL.ToString())
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

            return(CustomConnectorSerializer != null
                       ? CustomConnectorSerializer(this, JSON)
                       : JSON);
        }
Example #16
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomBootNotificationResponseSerializer">A delegate to serialize custom boot notification responses.</param>
        /// <param name="CustomStatusInfoResponseSerializer">A delegate to serialize a custom StatusInfo object.</param>
        /// <param name="CustomCustomDataResponseSerializer">A delegate to serialize CustomData objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <BootNotificationResponse> CustomBootNotificationResponseSerializer = null,
                              CustomJObjectSerializerDelegate <StatusInfo> CustomStatusInfoResponseSerializer = null,
                              CustomJObjectSerializerDelegate <CustomData> CustomCustomDataResponseSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("status", Status.AsText()),
                new JProperty("currentTime", CurrentTime.ToIso8601()),
                new JProperty("interval", (UInt32)Interval.TotalSeconds),

                StatusInfo != null
                               ? new JProperty("statusInfo", StatusInfo.ToJSON(CustomStatusInfoResponseSerializer,
                                                                               CustomCustomDataResponseSerializer))
                               : null,

                CustomData != null
                               ? new JProperty("customData", CustomData.ToJSON(CustomCustomDataResponseSerializer))
                               : null

                );

            return(CustomBootNotificationResponseSerializer != null
                       ? CustomBootNotificationResponseSerializer(this, JSON)
                       : JSON);
        }
Example #17
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeRequestSerializer">A delegate to serialize custom authorize requests.</param>
        /// <param name="CustomIdTokenResponseSerializer">A delegate to serialize custom IdTokens.</param>
        /// <param name="CustomAdditionalInfoResponseSerializer">A delegate to serialize custom AdditionalInfo objects.</param>
        /// <param name="CustomOCSPRequestDataResponseSerializer">A delegate to serialize custom OCSPRequestDatas.</param>
        /// <param name="CustomCustomDataResponseSerializer">A delegate to serialize CustomData objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeRequest> CustomAuthorizeRequestSerializer       = null,
                              CustomJObjectSerializerDelegate <IdToken> CustomIdTokenResponseSerializer                 = null,
                              CustomJObjectSerializerDelegate <AdditionalInfo> CustomAdditionalInfoResponseSerializer   = null,
                              CustomJObjectSerializerDelegate <OCSPRequestData> CustomOCSPRequestDataResponseSerializer = null,
                              CustomJObjectSerializerDelegate <CustomData> CustomCustomDataResponseSerializer           = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("idToken", IdToken.ToJSON(CustomIdTokenResponseSerializer,
                                                        CustomAdditionalInfoResponseSerializer,
                                                        CustomCustomDataResponseSerializer)),

                Certificate.IsNotNullOrEmpty()
                               ? new JProperty("certificate", Certificate)
                               : null,

                ISO15118CertificateHashData.SafeAny()
                               ? new JProperty("iso15118CertificateHashData", new JArray(ISO15118CertificateHashData.SafeSelect(hashData => hashData.ToJSON(CustomOCSPRequestDataResponseSerializer,
                                                                                                                                                            CustomCustomDataResponseSerializer))))
                               : null,

                CustomData != null
                               ? new JProperty("customData", CustomData.ToJSON(CustomCustomDataResponseSerializer))
                               : null

                );

            return(CustomAuthorizeRequestSerializer != null
                       ? CustomAuthorizeRequestSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingErrorNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingErrorNotificationRequest> CustomChargingErrorNotificationRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(
                new JProperty("Type", Type.AsString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)),
                new JProperty("ErrorType", ErrorType.AsString()),

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

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

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomChargingErrorNotificationRequestSerializer != null
                       ? CustomChargingErrorNotificationRequestSerializer(this, JSON)
                       : JSON);
        }
Example #19
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomEnergyMixSerializer">A delegate to serialize custom hours JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <EnergyMix> CustomEnergyMixSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("is_green_energy", IsGreenEnergy),

                EnergySources.SafeAny()
                               ? new JProperty("energy_sources", new JArray(EnergySources.Select(energysource => energysource.ToJSON())))
                               : null,

                EnvironmentalImpacts.SafeAny()
                               ? new JProperty("environ_impact", new JArray(EnvironmentalImpacts.Select(environmentalimpact => environmentalimpact.ToJSON())))
                               : null,

                SupplierName.IsNotNullOrEmpty()
                               ? new JProperty("supplier_name", SupplierName)
                               : null,

                EnergyProductName.IsNotNullOrEmpty()
                               ? new JProperty("energy_product_name", EnergyProductName)
                               : null

                );

            return(CustomEnergyMixSerializer != null
                       ? CustomEnergyMixSerializer(this, JSON)
                       : JSON);
        }
Example #20
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)

        {
            var JSON = JSONObject.Create(

                RFIDId.HasValue
                               ? new JProperty("RFIDMifareFamilyIdentification", RFIDId.Value.ToString())
                               : null,

                RFIDIdentification.HasValue
                               ? new JProperty("RFIDIdentification", RFIDIdentification.Value.ToJSON())
                               : null,

                QRCodeIdentification.HasValue
                               ? new JProperty("QRCodeIdentification", QRCodeIdentification.Value.ToJSON())
                               : null,

                PlugAndChargeIdentification.HasValue
                               ? new JProperty("PlugAndChargeIdentification", PlugAndChargeIdentification.Value.ToString())
                               : null,

                RemoteIdentification.HasValue
                               ? new JProperty("RemoteIdentification", RemoteIdentification.Value.ToString())
                               : null);

            return(CustomIdentificationSerializer != null
                       ? CustomIdentificationSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomGetDiagnosticsRequestSerializer">A delegate to serialize custom start transaction requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <GetDiagnosticsRequest> CustomGetDiagnosticsRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("location", Location),

                StartTime.HasValue
                               ? new JProperty("startTime", StartTime.Value.ToIso8601())
                               : null,

                StopTime.HasValue
                               ? new JProperty("stopTime", StopTime.Value.ToIso8601())
                               : null,

                Retries.HasValue
                               ? new JProperty("retries", Retries.Value.ToString())
                               : null,

                RetryInterval.HasValue
                               ? new JProperty("retryInterval", (UInt64)RetryInterval.Value.TotalSeconds)
                               : null

                );

            return(CustomGetDiagnosticsRequestSerializer != null
                       ? CustomGetDiagnosticsRequestSerializer(this, JSON)
                       : JSON);
        }
Example #22
0
        /// <summary>
        /// Return a JSON representation for the given enumeration of remote parties.
        /// </summary>
        /// <param name="RemoteParties">An enumeration of remote parties.</param>
        /// <param name="Skip">The optional number of remote parties to skip.</param>
        /// <param name="Take">The optional number of remote parties to return.</param>
        /// <param name="Embedded">Whether this data is embedded into another data structure, e.g. into a remote party.</param>
        public static JArray ToJSON(this IEnumerable <RemoteParty> RemoteParties,
                                    UInt64?Skip      = null,
                                    UInt64?Take      = null,
                                    Boolean Embedded = false,
                                    CustomJObjectSerializerDelegate <RemoteParty> CustomRemotePartySerializer         = null,
                                    CustomJObjectSerializerDelegate <BusinessDetails> CustomBusinessDetailsSerializer = null,
                                    RemotePartyToJSONDelegate RemotePartyToJSON = null,
                                    Boolean IncludeCryptoHash = true)


        => RemoteParties?.Any() != true

                   ? new JArray()

                   : new JArray(RemoteParties.
                                Where(remoteParty => remoteParty != null).
                                OrderBy(remoteParty => remoteParty.Id).
                                SkipTakeFilter(Skip, Take).
                                SafeSelect(remoteParty => RemotePartyToJSON != null
                                                                      ? RemotePartyToJSON(remoteParty,
                                                                                          Embedded,
                                                                                          CustomRemotePartySerializer,
                                                                                          CustomBusinessDetailsSerializer,
                                                                                          IncludeCryptoHash)

                                                                      : remoteParty.ToJSON(Embedded,
                                                                                           CustomRemotePartySerializer,
                                                                                           CustomBusinessDetailsSerializer,
                                                                                           IncludeCryptoHash)));
Example #23
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingFacilitySerializer">A delegate to serialize custom charging facility JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingFacility> CustomChargingFacilitySerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("PowerType", PowerType.AsString()),
                new JProperty("Power", Power),

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

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

                ChargingModes.SafeAny()
                               ? new JProperty("ChargingModes", new JArray(ChargingModes.Select(chargingMode => chargingMode.AsString())))
                               : null,

                CustomData?.HasValues == true
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomChargingFacilitySerializer != null
                       ? CustomChargingFacilitySerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeStopRequestSerializer">A delegate to customize the serialization of AuthorizeStopRequest responses.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeStopRequest> CustomAuthorizeStopRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer             = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer)),

                EVSEId.HasValue
                               ? new JProperty("EvseID", EVSEId.Value.ToString())
                               : null,

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomAuthorizeStopRequestSerializer != null
                       ? CustomAuthorizeStopRequestSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomPullEVSEStatusRequestSerializer">A delegate to customize the serialization of PullEVSEStatusRequest responses.</param>
        /// <param name="CustomGeoCoordinatesSerializer">A delegate to serialize custom geo coordinates JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <PullEVSEStatusRequest> CustomPullEVSEStatusRequestSerializer = null,
                              CustomJObjectSerializerDelegate <GeoCoordinates> CustomGeoCoordinatesSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("ProviderID", ProviderId.ToString()),

                SearchCenter.HasValue && DistanceKM.HasValue
                               ? new JProperty("SearchCenter", new JObject(
                                                   new JProperty("GeoCoordinates", SearchCenter.Value.ToJSON(CustomGeoCoordinatesSerializer)),
                                                   new JProperty("Radius", DistanceKM.Value)
                                                   ))
                               : null,

                EVSEStatusFilter.HasValue
                               ? new JProperty("EvseStatus", EVSEStatusFilter.Value.AsString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomPullEVSEStatusRequestSerializer != null
                       ? CustomPullEVSEStatusRequestSerializer(this, JSON)
                       : JSON);
        }
Example #26
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomSignedDataSerializer">A delegate to serialize custom signed data JSON objects.</param>
        /// <param name="CustomSignedValueSerializer">A delegate to serialize custom signed value JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <SignedData> CustomSignedDataSerializer   = null,
                              CustomJObjectSerializerDelegate <SignedValue> CustomSignedValueSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("encoding_method", EncodingMethod.ToString()),

                EncodingMethodVersion.HasValue
                               ? new JProperty("encoding_method_version", EncodingMethodVersion.ToString())
                               : null,

                PublicKey.HasValue
                               ? new JProperty("public_key", PublicKey.ToString())
                               : null,

                SignedValues.SafeAny()
                               ? new JProperty("signed_values", new JArray(SignedValues.Select(signedValue => signedValue.ToJSON(CustomSignedValueSerializer))))
                               : null,

                URL.IsNotNullOrEmpty()
                               ? new JProperty("url", URL)
                               : null

                );

            return(CustomSignedDataSerializer != null
                       ? CustomSignedDataSerializer(this, JSON)
                       : JSON);
        }
Example #27
0
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomGetChargeDetailRecordsRequestSerializer">A delegate to customize the serialization of GetChargeDetailRecordsRequest responses.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <GetChargeDetailRecordsRequest> CustomGetChargeDetailRecordsRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("ProviderID", ProviderId.ToString()),
                new JProperty("From", From.ToIso8601()),
                new JProperty("To", To.ToIso8601()),

                SessionIds.SafeAny()
                               ? new JProperty("SessionID", new JArray(SessionIds.Select(sessionId => sessionId.ToString())))
                               : null,

                OperatorIds.SafeAny()
                               ? new JProperty("OperatorID", new JArray(SessionIds.Select(sessionId => sessionId.ToString())))
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomGetChargeDetailRecordsRequestSerializer != null
                       ? CustomGetChargeDetailRecordsRequestSerializer(this, JSON)
                       : JSON);
        }
Example #28
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingScheduleSerializer">A delegate to serialize custom charging schedule requests.</param>
        /// <param name="CustomChargingSchedulePeriodSerializer">A delegate to serialize custom charging schedule periods.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingSchedule> CustomChargingScheduleSerializer             = null,
                              CustomJObjectSerializerDelegate <ChargingSchedulePeriod> CustomChargingSchedulePeriodSerializer = null)
        {
            var JSON = JSONObject.Create(

                Duration.HasValue
                               ? new JProperty("duration", Duration.Value)
                               : null,

                StartSchedule.HasValue
                               ? new JProperty("startSchedule", StartSchedule.Value.ToIso8601())
                               : null,

                new JProperty("chargingRateUnit", ChargingRateUnit.AsText()),

                new JProperty("chargingSchedulePeriod", ChargingSchedulePeriods.Select(value => value.ToJSON(CustomChargingSchedulePeriodSerializer))),

                Duration.HasValue
                               ? new JProperty("minChargingRate", MinChargingRate.Value.ToString("0.#"))
                               : null

                );

            return(CustomChargingScheduleSerializer != null
                       ? CustomChargingScheduleSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomQRCodeIdentificationSerializer">A delegate to serialize custom QR code identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <QRCodeIdentification> CustomQRCodeIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("EvcoID", EVCOId.ToString()),

                PIN.IsNotNullOrEmpty()

                               ? Function == PINCrypto.None

                                     ? new JProperty("PIN", PIN)

                                     : new JProperty("HashedPIN", JSONObject.Create(
                                                         new JProperty("Value", PIN),
                                                         new JProperty("Function", Function.AsString()),
                                                         new JProperty("Salt", Salt)
                                                         ))

                               : null

                );

            return(CustomQRCodeIdentificationSerializer != null
                       ? CustomQRCodeIdentificationSerializer(this, JSON)
                       : JSON);
        }
Example #30
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTariffSerializer">A delegate to serialize custom tariff JSON objects.</param>
        /// <param name="CustomTariffElementSerializer">A delegate to serialize custom tariff element JSON objects.</param>
        /// <param name="CustomPriceComponentSerializer">A delegate to serialize custom price component JSON objects.</param>
        /// <param name="CustomTariffRestrictionsSerializer">A delegate to serialize custom tariff restrictions JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Tariff> CustomTariffSerializer = null,
                              CustomJObjectSerializerDelegate <TariffElement> CustomTariffElementSerializer           = null,
                              CustomJObjectSerializerDelegate <PriceComponent> CustomPriceComponentSerializer         = null,
                              CustomJObjectSerializerDelegate <TariffRestrictions> CustomTariffRestrictionsSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("country_code", CountryCode.ToString()),
                new JProperty("party_id", PartyId.ToString()),
                new JProperty("id", Id.ToString()),

                new JProperty("currency", Currency.ToString()),

                TariffType.HasValue
                               ? new JProperty("type", TariffType.Value.ToString())
                               : null,

                TariffAltText.SafeAny()
                               ? new JProperty("tariff_alt_text", new JArray(TariffAltText.Select(tariffAltText => tariffAltText.ToJSON())))
                               : null,

                TariffAltURL.HasValue
                               ? new JProperty("tariff_alt_url", TariffAltURL.ToString())
                               : null,

                MinPrice.HasValue
                               ? new JProperty("min_price", MinPrice.Value.ToJSON())
                               : null,

                MaxPrice.HasValue
                               ? new JProperty("max_price", MaxPrice.Value.ToJSON())
                               : null,

                TariffElements.SafeAny()
                               ? new JProperty("elements", new JArray(TariffElements.Select(tariffElement => tariffElement.ToJSON(CustomTariffElementSerializer,
                                                                                                                                  CustomPriceComponentSerializer,
                                                                                                                                  CustomTariffRestrictionsSerializer))))
                               : null,

                Start.HasValue
                               ? new JProperty("start_date_time", Start.Value.ToIso8601())
                               : null,

                End.HasValue
                               ? new JProperty("end_date_time", End.Value.ToIso8601())
                               : null,

                EnergyMix != null
                               ? new JProperty("energy_mix", EnergyMix.ToJSON())
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

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