Snippets

OICP 2.1 Push Authentication Data | C#

Created by Gregor Schermuly last modified Julius Poessnecker
1
2
3
4
5
6
7
The service description can be found in the OICP 2.1 (EMP).

Section:
3.3.1 eRoamingPushAuthenticationData

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/// <summary>
/// Create a new task pushing provider authentication data records onto the OICP server.
/// </summary>
/// <param name="ProviderAuthenticationDataRecords">An enumeration of provider authentication data records.</param>
/// <param name="OICPAction">An optional OICP action.</param>
/// <param name="QueryTimeout">An optional timeout for this query.</param>
public async Task<HTTPResponse<eRoamingAcknowledgement>>

    PushAuthenticationData(IEnumerable<ProviderAuthenticationData>  ProviderAuthenticationDataRecords,
                           ActionType                               OICPAction    = ActionType.fullLoad,
                           TimeSpan?                                QueryTimeout  = null)

{
    [...]
}


/// <summary>
/// Create a new task pushing authorization identifications onto the OICP server.
/// </summary>
/// <param name="AuthorizationIdentifications">An enumeration of authorization identifications.</param>
/// <param name="ProviderId">The unique identification of the EVSP.</param>
/// <param name="OICPAction">An optional OICP action.</param>
/// <param name="QueryTimeout">An optional timeout for this query.</param>
public async Task<HTTPResponse<eRoamingAcknowledgement>>

    PushAuthenticationData(IEnumerable<AuthorizationIdentification>  AuthorizationIdentifications,
                           EVSP_Id                                   ProviderId,
                           ActionType                                OICPAction    = ActionType.fullLoad,
                           TimeSpan?                                 QueryTimeout  = null)

{
    [...]
}
Task.Factory.StartNew(async () => {

    var result = await new EMPClient("api.playground.hubject.com").
        PushAuthenticationData(Enumeration.Create(

                                   AuthorizationIdentification.
                                       FromAuthToken(Auth_Token.Parse("08152305")),

                                   AuthorizationIdentification.
                                       FromQRCodeIdentification(eMA_Id.Parse("DE-GDF-C123ABC56-X"),
                                                                "1234")

                              ),
                              EVSP_Id.Parse("DE*GDF"),
                              OICPAction:   ActionType.fullLoad,
                              QueryTimeout: TimeSpan.FromSeconds(120));


    if (result.Content.Result)
        Console.WriteLine("success!");

    else
    {
        ConsoleX.WriteLines("PushAuthenticationData result:",
                            result.Content.StatusCode.Code,
                            result.Content.StatusCode.Description,
                            result.Content.StatusCode.AdditionalInfo);
    }

}).

// Wait for the task to complete...
Wait();

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.