internal Response(ReturnCode result, int? ecadId, string geoDirectoryId, Request input, Model.Link[] links) { if (links == null) throw new ArgumentNullException("links"); Result = result; EcadId = ecadId; GeoDirectoryId = geoDirectoryId; Input = input; var newLinks = new List<Model.Link>(); foreach (Model.Link link in links) { Model.Link newLink; switch (link.Rel) { case "self": newLink = new Model.MapId.Link(link.Rel, link.Href); break; default: newLink = link; break; } newLinks.Add(newLink); } Links = newLinks.ToArray(); }
/// <summary> /// Map ID as an asynchronous operation. /// </summary> /// <param name="request">MapId request.</param> /// <returns>The task object representing the asynchronous operation.</returns> /// <example> /// The following code example creates an AutoaddressClient and calls GetGbPostcodeDataAsync with a request. /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientGetGbPostcodeDataAsyncRequestExample1.cs" language="cs" /> /// </example> public async Task <Model.MapId.Response> MapIdAsync(Model.MapId.Request request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } Uri requestUri = GetRequestUri(_licenceKey, request.Txn, _autoaddressConfig.ApiBaseAddress, Version, MapIdMethod, request); var response = await GetResponseAsync <Model.MapId.Response>(request, requestUri); return(response); }
/// <summary> /// Map ID. /// </summary> /// <param name="request">MapId request.</param> /// <returns>MapId response.</returns> /// <example> /// The following code example creates an AutoaddressClient and calls MapId with a request. /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientGetGbPostcodeDataRequestExample1.cs" language="cs" /> /// </example> public Model.MapId.Response MapId(Model.MapId.Request request) { try { return(MapIdAsync(request).Result); } catch (Exception e) { if (e.InnerException != null) { throw e.InnerException; } throw; } }