/// <summary> /// Try to parse the given text representation of a AuthorizeRemoteReservationStart request. /// </summary> /// <param name="Text">The text to parse.</param> /// <param name="ProviderIdURL">The provider identification given in the URL of the HTTP request.</param> /// <param name="RequestTimeout">The timeout for this request.</param> /// <param name="AuthorizeRemoteReservationStartRequest">The parsed AuthorizeRemoteReservationStart request.</param> /// <param name="ErrorResponse">An optional error response.</param> /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="CustomAuthorizeRemoteReservationStartRequestParser">A delegate to parse custom AuthorizeRemoteReservationStart request JSON objects.</param> public static Boolean TryParse(String Text, Provider_Id ProviderIdURL, TimeSpan RequestTimeout, out AuthorizeRemoteReservationStartRequest AuthorizeRemoteReservationStartRequest, out String ErrorResponse, DateTime?Timestamp = null, EventTracking_Id EventTrackingId = null, CustomJObjectParserDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestParser = null) { try { return(TryParse(JObject.Parse(Text), ProviderIdURL, RequestTimeout, out AuthorizeRemoteReservationStartRequest, out ErrorResponse, Timestamp, EventTrackingId, CustomAuthorizeRemoteReservationStartRequestParser)); } catch (Exception e) { AuthorizeRemoteReservationStartRequest = default; ErrorResponse = "The given text representation of a AuthorizeRemoteReservationStart request is invalid: " + e.Message; return(false); } }
/// <summary> /// Create an AuthorizeRemoteReservationStart request. /// </summary> /// <param name="ProviderId">An e-mobility provider identification.</param> /// <param name="EVSEId">An EVSE identification.</param> /// <param name="Identification">The user or contract identification.</param> /// <param name="SessionId">An optional charging session identification.</param> /// <param name="CPOPartnerSessionId">An optional CPO partner session identification.</param> /// <param name="EMPPartnerSessionId">An optional EMP partner session identification.</param> /// <param name="PartnerProductId">An optional partner product identification.</param> /// <param name="Duration">The optional duration of reservation.</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 AuthorizeRemoteReservationStartRequest(Provider_Id ProviderId, EVSE_Id EVSEId, Identification Identification, Session_Id?SessionId = null, CPOPartnerSession_Id?CPOPartnerSessionId = null, EMPPartnerSession_Id?EMPPartnerSessionId = null, PartnerProduct_Id?PartnerProductId = null, TimeSpan?Duration = null, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.EVSEId = EVSEId; this.Identification = Identification; this.SessionId = SessionId; this.CPOPartnerSessionId = CPOPartnerSessionId; this.EMPPartnerSessionId = EMPPartnerSessionId; this.PartnerProductId = PartnerProductId; this.Duration = Duration; }
/// <summary> /// Create an AuthorizeRemoteReservationStop request. /// </summary> /// <param name="ProviderId">An e-mobility provider identification.</param> /// <param name="EVSEId">An EVSE identification.</param> /// <param name="SessionId">An charging session identification.</param> /// <param name="CPOPartnerSessionId">An optional CPO partner session identification.</param> /// <param name="EMPPartnerSessionId">An optional EMP partner session identification.</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 AuthorizeRemoteReservationStopRequest(Provider_Id ProviderId, EVSE_Id EVSEId, Session_Id SessionId, CPOPartnerSession_Id?CPOPartnerSessionId = null, EMPPartnerSession_Id?EMPPartnerSessionId = null, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.EVSEId = EVSEId; this.SessionId = SessionId; this.CPOPartnerSessionId = CPOPartnerSessionId; this.EMPPartnerSessionId = EMPPartnerSessionId; }
/// <summary> /// Create a new electric vehicle contract identification. /// </summary> /// <param name="InternalId">The internal representation of the EVCO identification, as there are some many optional characters.</param> /// <param name="ProviderId">The unique identification of an e-mobility provider.</param> /// <param name="Suffix">The suffix of the electric vehicle contract identification.</param> /// <param name="CheckDigit">An optional check digit of the electric vehicle contract identification.</param> private EVCO_Id(String InternalId, Provider_Id ProviderId, String Suffix, Char?CheckDigit = null) { this.InternalId = InternalId; this.ProviderId = ProviderId; this.Suffix = Suffix; this.CheckDigit = CheckDigit; }
/// <summary> /// Create a new PullEVSEData request. /// The request might either have none, 'SearchCenter + DistanceKM' or 'LastCall' parameters. /// Because of limitations at Hubject the SearchCenter and LastCall parameters can not be used at the same time! /// </summary> /// <param name="ProviderId">The unique identification of the e-mobility provider.</param> /// <param name="LastCall">An optional timestamp of the last call. Cannot be combined with 'SearchCenter'.</param> /// /// <param name="GeoCoordinatesResponseFormat">An optional response format for representing geo coordinates.</param> /// <param name="OperatorIdFilter">Only return EVSEs belonging to the given optional enumeration of EVSE operators.</param> /// <param name="CountryCodeFilter">An optional enumeration of countries whose EVSE's a provider wants to retrieve.</param> /// <param name="SearchCenter">An optional geo coordinate of the search center.</param> /// <param name="DistanceKM">An optional search distance relative to the search center.</param> /// /// <param name="Page">An optional page number of the request page.</param> /// <param name="Size">An optional size of a request page.</param> /// <param name="SortOrder">Optional sorting criteria in the format: property(,asc|desc).</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 PullEVSEDataRequest(Provider_Id ProviderId, DateTime?LastCall = null, IEnumerable <Operator_Id> OperatorIdFilter = null, IEnumerable <Country> CountryCodeFilter = null, IEnumerable <AccessibilityTypes> AccessibilityFilter = null, IEnumerable <AuthenticationModes> AuthenticationModeFilter = null, IEnumerable <CalibrationLawDataAvailabilities> CalibrationLawDataAvailabilityFilter = null, Boolean?RenewableEnergyFilter = null, Boolean?IsHubjectCompatibleFilter = null, Boolean?IsOpen24HoursFilter = null, GeoCoordinates?SearchCenter = null, Single?DistanceKM = null, GeoCoordinatesFormats?GeoCoordinatesResponseFormat = GeoCoordinatesFormats.DecimalDegree, UInt32?Page = null, UInt32?Size = null, IEnumerable <String> SortOrder = null, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(Page, Size, SortOrder, CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.LastCall = LastCall; this.OperatorIdFilter = OperatorIdFilter?.Distinct() ?? new Operator_Id[0]; this.CountryCodeFilter = CountryCodeFilter?.Distinct() ?? new Country[0]; this.AccessibilityFilter = AccessibilityFilter?.Distinct() ?? new AccessibilityTypes[0]; this.AuthenticationModeFilter = AuthenticationModeFilter?.Distinct() ?? new AuthenticationModes[0]; this.CalibrationLawDataAvailabilityFilter = CalibrationLawDataAvailabilityFilter?.Distinct() ?? new CalibrationLawDataAvailabilities[0]; this.RenewableEnergyFilter = RenewableEnergyFilter; this.IsHubjectCompatibleFilter = IsHubjectCompatibleFilter; this.IsOpen24HoursFilter = IsOpen24HoursFilter; this.SearchCenter = SearchCenter; this.DistanceKM = DistanceKM; this.GeoCoordinatesResponseFormat = GeoCoordinatesResponseFormat ?? GeoCoordinatesFormats.DecimalDegree; }
/// <summary> /// Try to parse the given string as an electric vehicle contract identification. /// </summary> /// <param name="Text">A text-representation of an electric vehicle contract identification.</param> /// <param name="EVCOId">The parsed electric vehicle contract identification.</param> public static Boolean TryParse(String Text, out EVCO_Id EVCOId) { Text = Text?.Trim(); if (Text.IsNotNullOrEmpty()) { try { var matchCollection = EVCOId_RegEx.Matches(Text); if (matchCollection.Count == 1) { // ISO: DE-GDF-C12022187-X, DEGDFC12022187X if (Provider_Id.TryParse(matchCollection[0].Groups[1].Value, out Provider_Id providerId)) { EVCOId = new EVCO_Id(Text, providerId, matchCollection[0].Groups[2].Value, matchCollection[0].Groups[3].Value[0]); return(true); } // DIN: DE*GDF*0010LY*3, DE-GDF-0010LY-3, DEGDF0010LY3 if (Provider_Id.TryParse(matchCollection[0].Groups[4].Value, out providerId)) { if (providerId.Format == ProviderIdFormats.ISO_HYPHEN) { providerId = providerId.ChangeFormat(ProviderIdFormats.DIN_HYPHEN); } EVCOId = new EVCO_Id(Text, providerId.ChangeFormat(ProviderIdFormats.DIN_HYPHEN), matchCollection[0].Groups[5].Value, matchCollection[0].Groups[6].Value[0]); return(true); } } } catch { } } EVCOId = default; return(false); }
/// <summary> /// Create a new PullEVSEStatusById request. /// </summary> /// <param name="ProviderId">The unique identification of the e-mobility provider.</param> /// <param name="EVSEIds">An enumeration of up to 100 EVSE identifications.</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 PullEVSEStatusByIdRequest(Provider_Id ProviderId, IEnumerable <EVSE_Id> EVSEIds, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.EVSEIds = EVSEIds ?? new EVSE_Id[0]; }
/// <summary> /// Parse the given text representation of a AuthorizeRemoteReservationStart request. /// </summary> /// <param name="Text">The text to parse.</param> /// <param name="ProviderIdURL">The provider identification given in the URL of the HTTP request.</param> /// <param name="RequestTimeout">The timeout for this request.</param> /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="CustomAuthorizeRemoteReservationStartRequestParser">A delegate to parse custom AuthorizeRemoteReservationStart request JSON objects.</param> public static AuthorizeRemoteReservationStartRequest Parse(String Text, Provider_Id ProviderIdURL, TimeSpan RequestTimeout, DateTime?Timestamp = null, EventTracking_Id EventTrackingId = null, CustomJObjectParserDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestParser = null) { if (TryParse(Text, ProviderIdURL, RequestTimeout, out AuthorizeRemoteReservationStartRequest authorizeRemoteReservationStartRequest, out String ErrorResponse, Timestamp, EventTrackingId, CustomAuthorizeRemoteReservationStartRequestParser)) { return(authorizeRemoteReservationStartRequest); } throw new ArgumentException("The given text representation of a AuthorizeRemoteReservationStart request is invalid: " + ErrorResponse, nameof(Text)); }
/// <summary> /// Create a new PullEVSEStatus request. /// </summary> /// <param name="ProviderId">The unique identification of the e-mobility provider.</param> /// <param name="SearchCenter">An optional geo coordinate of the search center.</param> /// <param name="DistanceKM">An optional search distance relative to the search center.</param> /// <param name="EVSEStatusFilter">An optional EVSE status as filter criteria.</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 PullEVSEStatusRequest(Provider_Id ProviderId, GeoCoordinates?SearchCenter = null, Single?DistanceKM = null, EVSEStatusTypes?EVSEStatusFilter = null, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.SearchCenter = SearchCenter; this.DistanceKM = DistanceKM; this.EVSEStatusFilter = EVSEStatusFilter; }
/// <summary> /// Create a new GetChargeDetailRecords request. /// </summary> /// <param name="ProviderId">An e-mobility provider identification.</param> /// <param name="From">The start of the requested time range.</param> /// <param name="To">The end of the requested time range.</param> /// /// <param name="SessionIds">An optional enumeration of charging session identifications.</param> /// <param name="OperatorIds">An optional enumeration of operator identifications.</param> /// <param name="CDRForwarded">Whether the CDR was successfuly forwarded to the EMP or not.</param> /// /// <param name="Page">An optional page number of the request page.</param> /// <param name="Size">An optional size of a request page.</param> /// <param name="SortOrder">Optional sorting criteria in the format: property(,asc|desc).</param> /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</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 GetChargeDetailRecordsRequest(Provider_Id ProviderId, DateTime From, DateTime To, IEnumerable <Session_Id> SessionIds = null, IEnumerable <Operator_Id> OperatorIds = null, Boolean?CDRForwarded = null, UInt32?Page = null, UInt32?Size = null, IEnumerable <String> SortOrder = null, JObject CustomData = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) : base(Page, Size, SortOrder, CustomData, Timestamp, CancellationToken, EventTrackingId, RequestTimeout) { this.ProviderId = ProviderId; this.From = From; this.To = To; this.SessionIds = SessionIds; this.OperatorIds = OperatorIds; this.CDRForwarded = CDRForwarded; }
/// <summary> /// Parse the given electric vehicle contract identification. /// </summary> /// <param name="ProviderId">The unique identification of an e-mobility provider.</param> /// <param name="Suffix">The suffix of the electric vehicle contract identification.</param> public static EVCO_Id Parse(Provider_Id ProviderId, String Suffix) { #region Initial checks if (Suffix != null) { Suffix = Suffix.Trim(); } if (Suffix.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(Suffix), "The given electric vehicle contract identification suffix must not be null or empty!"); } #endregion switch (ProviderId.Format) { case ProviderIdFormats.DIN: return(Parse(ProviderId + Suffix)); case ProviderIdFormats.DIN_STAR: return(Parse(ProviderId + "*" + Suffix)); case ProviderIdFormats.DIN_HYPHEN: return(Parse(ProviderId + "-" + Suffix)); case ProviderIdFormats.ISO: return(Parse(ProviderId + Suffix)); default: // ISO_HYPHEN return(Parse(ProviderId + "-" + Suffix)); } }
/// <summary> /// Try to parse the given JSON representation of a AuthorizeRemoteReservationStart request. /// </summary> /// <param name="JSON">The JSON to parse.</param> /// <param name="ProviderIdURL">The provider identification given in the URL of the HTTP request.</param> /// <param name="RequestTimeout">The timeout for this request.</param> /// <param name="AuthorizeRemoteReservationStartRequest">The parsed AuthorizeRemoteReservationStart request.</param> /// <param name="ErrorResponse">An optional error response.</param> /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="CustomAuthorizeRemoteReservationStartRequestParser">A delegate to parse custom AuthorizeRemoteReservationStart request JSON objects.</param> public static Boolean TryParse(JObject JSON, Provider_Id ProviderIdURL, TimeSpan RequestTimeout, out AuthorizeRemoteReservationStartRequest AuthorizeRemoteReservationStartRequest, out String ErrorResponse, DateTime?Timestamp = null, EventTracking_Id EventTrackingId = null, CustomJObjectParserDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestParser = null) { try { AuthorizeRemoteReservationStartRequest = default; if (JSON?.HasValues != true) { ErrorResponse = "The given JSON object must not be null or empty!"; return(false); } #region Parse ProviderId [mandatory] if (!JSON.ParseMandatory("ProviderID", "provider identification", Provider_Id.TryParse, out Provider_Id ProviderId, out ErrorResponse)) { return(false); } if (ProviderId != ProviderIdURL) { ErrorResponse = "Inconsistend provider identifications: '" + ProviderIdURL + "' (URL) <> '" + ProviderId + "' (JSON)!"; return(false); } #endregion #region Parse EVSEId [mandatory] if (!JSON.ParseMandatory("EvseID", "EVSE identification", EVSE_Id.TryParse, out EVSE_Id EVSEId, out ErrorResponse)) { return(false); } #endregion #region Parse Identification [mandatory] if (!JSON.ParseMandatoryJSON2("Identification", "identification", OICPv2_3.Identification.TryParse, out Identification Identification, out ErrorResponse)) { return(false); } #endregion #region Parse PartnerProductId [optional] if (JSON.ParseOptional("PartnerProductID", "partner product identification", PartnerProduct_Id.TryParse, out PartnerProduct_Id? PartnerProductId, out ErrorResponse)) { if (ErrorResponse != null) { return(false); } } #endregion #region Parse SessionId [optional] if (JSON.ParseOptional("SessionID", "session identification", Session_Id.TryParse, out Session_Id? SessionId, out ErrorResponse)) { if (ErrorResponse != null) { return(false); } } #endregion #region Parse CPOPartnerSessionId [optional] if (JSON.ParseOptional("CPOPartnerSessionID", "CPO product session identification", CPOPartnerSession_Id.TryParse, out CPOPartnerSession_Id? CPOPartnerSessionId, out ErrorResponse)) { if (ErrorResponse != null) { return(false); } } #endregion #region Parse EMPPartnerSessionId [optional] if (JSON.ParseOptional("EMPPartnerSessionID", "EMP product session identification", EMPPartnerSession_Id.TryParse, out EMPPartnerSession_Id? EMPPartnerSessionId, out ErrorResponse)) { if (ErrorResponse != null) { return(false); } } #endregion #region Parse Duration [optional] TimeSpan?Duration = default; if (JSON.ParseOptional("Duration", "reservation duration", out UInt32? durationMinutes, out ErrorResponse)) { if (ErrorResponse != null) { return(false); } Duration = durationMinutes.HasValue ? TimeSpan.FromMinutes(durationMinutes.Value) : default; } #endregion #region Parse CustomData [optional] var CustomData = JSON["CustomData"] as JObject; #endregion AuthorizeRemoteReservationStartRequest = new AuthorizeRemoteReservationStartRequest(ProviderId, EVSEId, Identification, SessionId, CPOPartnerSessionId, EMPPartnerSessionId, PartnerProductId, Duration, CustomData, Timestamp, null, EventTrackingId, RequestTimeout); if (CustomAuthorizeRemoteReservationStartRequestParser != null) { AuthorizeRemoteReservationStartRequest = CustomAuthorizeRemoteReservationStartRequestParser(JSON, AuthorizeRemoteReservationStartRequest); } return(true); } catch (Exception e) { AuthorizeRemoteReservationStartRequest = default; ErrorResponse = "The given JSON representation of a AuthorizeRemoteReservationStart request is invalid: " + e.Message; return(false); } }