private async static Task <string> BuildUrl( string baseQuery, MapLocationOptions mapLocationOptions, string resource = "Locations", bool startWithAmpersand = true) { var culture = await mapLocationOptions.GetCulture().ConfigureAwait(true); var region = await mapLocationOptions.GetRegion().ConfigureAwait(true); if (string.IsNullOrWhiteSpace(region)) { Debug.LogWarning("No region has been specified for the MapLocationFinder request."); } var parameters = $"{baseQuery}" + (startWithAmpersand ? "&" : "") + FormattableString.Invariant($"maxRes={Math.Max(mapLocationOptions.MaxResults, 1)}") + (string.IsNullOrWhiteSpace(culture) ? "" : $"&c={culture}") + (string.IsNullOrWhiteSpace(region) ? "" : $"&ur={region}") + (mapLocationOptions.IncludeCountryCode ? "&incl=ciso2" : "") + (mapLocationOptions.IncludeNeighborhood ? "&inclnb=1" : ""); return(Endpoints.BuildUrl(resource, mapLocationOptions.MapSession, parameters)); }
private static string BuildUrl( string baseQuery, MapLocationOptions mapLocationOptions, string resource = "Locations", bool startWithAmpersand = true) { string url; if (mapLocationOptions != null) { var parameters = $"{baseQuery}" + (startWithAmpersand ? "&" : "") + $"maxRes={Math.Max(mapLocationOptions.MaxResults, 1)}" + (string.IsNullOrWhiteSpace(mapLocationOptions.Culture) ? "" : $"&c={mapLocationOptions.Culture}") + (string.IsNullOrWhiteSpace(mapLocationOptions.Region) ? "" : $"&ur={mapLocationOptions.Region}") + (mapLocationOptions.IncludeCountryCode ? "&incl=ciso2" : "") + (mapLocationOptions.IncludeNeighborhood ?"&inclnb=1" : ""); url = Endpoints.BuildUrl(resource, parameters); } else { url = Endpoints.BuildUrl(resource, $"{baseQuery}"); } return(url); }