/// <summary> /// Finds a person with certain attributes syncronously. If more than one matching person is found, an /// <see cref="ApiCallFailedException" /> will be thrown. If no match is found either an /// <see cref="ApiCallFailedException" /> will be thrown or null will be returned depending on the throwOnNotFound /// parameter. /// </summary> /// <param name="parameters">The attributes with which to attempt to find a matching person</param> /// <param name="throwOnNotFound"> /// Whether to throw an <see cref="ApiCallFailedException" /> if a match is not found. If /// false, null will be returned if a match is not found. /// </param> /// <param name="cancellationToken">Token allowing the request to be cancelled</param> /// <returns>The full person representation and their precinct</returns> public MatchPersonResponse Match(MatchPersonParameters parameters, bool throwOnNotFound = false, CancellationToken cancellationToken = default(CancellationToken)) { var url = UrlProvider.GetV1PersonMatchUrl(parameters); var result = GetJson <MatchPersonResponse>(url, cancellationToken, throwOnNotFound); ThrowIfApiFail(result, throwOnNotFound); return(result.Payload); }
/// <inheritDoc/> public string GetV1PersonMatchUrl(MatchPersonParameters personParameters) { var queryValues = CreateQueryStringValues(parameters: personParameters); return("api/v1/people/match" + queryValues.ToString(true)); }