Added Autosuggest Support, XML comments, Licsence Info, misc edits

This commit is contained in:
Christopher French 2018-08-29 16:58:58 -07:00
Родитель 62b167f376
Коммит e4a857a6a8
28 изменённых файлов: 924 добавлений и 55 удалений

Просмотреть файл

@ -7,6 +7,33 @@ namespace RESTToolkitTestConsoleApp
{
private string _ApiKey = System.Configuration.ConfigurationManager.AppSettings.Get("BingMapsKey");
private void PrintTZResource(TimeZoneResponse tz)
{
Console.WriteLine($"Name: {tz.GenericName}");
Console.WriteLine($"Windows ID: {tz.WindowsTimeZoneId}");
Console.WriteLine($"IANA ID: {tz.IANATimeZoneId}");
Console.WriteLine($"UTC offset: {tz.UtcOffset}");
Console.WriteLine($"Abbrev: {tz.Abbreviation}");
if (tz.ConvertedTime != null)
{
var ctz = tz.ConvertedTime;
Console.WriteLine($"Local Time: {ctz.LocalTime}");
Console.WriteLine($"TZ Abbr: {ctz.TimeZoneDisplayAbbr} ");
Console.WriteLine($"TZ Name: {ctz.TimeZoneDisplayName}");
Console.WriteLine($"UTC offset: {ctz.UtcOffsetWithDst }");
}
if (tz.DstRule != null)
{
var dst = tz.DstRule;
Console.WriteLine("Start: {0} - {1} - {2} - {3}", dst.DstStartTime, dst.DstStartMonth, dst.DstStartDateRule, dst.DstAdjust1);
Console.WriteLine("End: {0} - {1} - {2} - {3}", dst.DstEndTime, dst.DstEndMonth, dst.DstEndDateRule, dst.DstAdjust2);
}
}
private Resource[] GetResourcesFromRequest(BaseRestRequest rest_request)
{
var r = ServiceManager.GetResponseAsync(rest_request).GetAwaiter().GetResult();
@ -23,7 +50,102 @@ namespace RESTToolkitTestConsoleApp
public void AutoSuggestTest()
{
Console.WriteLine("Running Autosuggest Test");
CoordWithRadius ul = new CoordWithRadius() { Latitude = 47.668697, Longitude = -122.376373, Radius = 5 };
var request = new AutosuggestRequest()
{
BingMapsKey = _ApiKey,
Query = "El Bur",
UserLoc = ul
};
Console.WriteLine(request.GetRequestUrl());
var resources = GetResourcesFromRequest(request);
var entities = (resources[0] as AutosuggestResource);
foreach (var entity in entities.Value)
Console.Write($"Entity of type {entity.Type} returned.");
Console.ReadLine();
}
public void ConvertTimeZoneTest()
{
Console.WriteLine("Running Convert TZ Test");
var dt = DateTimeHelper.GetDateTimeFromUTCString("2018-05-15T13:14:15Z");
var request = new ConvertTimeZoneRequest(dt, "Cape Verde Standard Time") { BingMapsKey = _ApiKey };
var resources = GetResourcesFromRequest(request);
var tz = (resources[0] as RESTTimeZone);
PrintTZResource(tz.TimeZone);
Console.ReadLine();
}
public void ListTimeZoneTest()
{
Console.WriteLine("Running List TZ Test");
var list_request = new ListTimeZonesRequest(true)
{
BingMapsKey = _ApiKey,
TimeZoneStandard = "Windows"
};
Console.WriteLine(list_request.GetRequestUrl());
var resources = GetResourcesFromRequest(list_request);
Console.WriteLine("Printing first three TZ resources:\n");
for (int i = 0; i < 3; i++)
PrintTZResource((resources[i] as RESTTimeZone).TimeZone);
Console.WriteLine("Running Get TZ By ID Test");
var get_tz_request = new ListTimeZonesRequest(false)
{
IncludeDstRules = true,
BingMapsKey = _ApiKey,
DestinationTZID = "Cape Verde Standard Time"
};
Console.WriteLine(get_tz_request.GetRequestUrl());
var tz_resources = GetResourcesFromRequest(get_tz_request);
var tz = (tz_resources[0] as RESTTimeZone);
PrintTZResource(tz.TimeZone);
Console.ReadLine();
}
public void FindTimeZoneTest()
{
Console.WriteLine("Running Find Time Zone Test: By Query");
var dt = DateTime.Now;
var query_tz_request = new FindTimeZoneRequest("Seattle, USA", dt) { BingMapsKey = _ApiKey };
var query_resources = GetResourcesFromRequest(query_tz_request);
Console.WriteLine(query_tz_request.GetRequestUrl());
var r_query = (query_resources[0] as RESTTimeZone);
if (r_query.TimeZoneAtLocation.Length > 0)
{
var qtz = (r_query.TimeZoneAtLocation[0] as TimeZoneAtLocationResource);
Console.WriteLine($"Place Name: {qtz.PlaceName}");
PrintTZResource(qtz.TimeZone[0] as TimeZoneResponse);
}
else
{
Console.WriteLine("No Time Zone Query response.");
}
Console.WriteLine("\nRunning Find Time Zone Test: By Point");
Coordinate cpoint = new Coordinate(47.668915, -122.375789);
var point_tz_request = new FindTimeZoneRequest(cpoint) { BingMapsKey = _ApiKey, IncludeDstRules = true };
var point_resources = GetResourcesFromRequest(point_tz_request);
var r_point = (point_resources[0] as RESTTimeZone);
var tz = (r_point.TimeZone as TimeZoneResponse);
Console.WriteLine($"Time Zone: {r_point.TimeZone}");
PrintTZResource(tz);
Console.ReadLine();
}
public void LocationRecogTest()
@ -36,19 +158,30 @@ namespace RESTToolkitTestConsoleApp
var request = new LocationRecogRequest() { BingMapsKey = _ApiKey, CenterPoint = cpoint };
Console.WriteLine("constructed!");
Console.WriteLine(request.GetRequestUrl());
var resources = GetResourcesFromRequest(request);
foreach (LocationRecog resource in resources)
var r = (resources[0] as LocationRecog);
if (r.AddressOfLocation.Length > 0)
Console.WriteLine($"Address:\n{r.AddressOfLocation.ToString()}");
if (r.BusinessAtLocation != null)
{
Console.WriteLine(resource);
foreach (LocalBusiness business in r.BusinessAtLocation)
{
Console.WriteLine($"Business:\n{business.BusinessInfo.EntityName}");
}
}
if (r.NaturalPOIAtLocation != null)
{
foreach (NaturalPOIAtLocationEntity poi in r.NaturalPOIAtLocation)
{
Console.WriteLine($"POI:\n{poi.EntityName}");
}
}
Console.ReadLine();
}
public void GeoCodeTest()
@ -71,7 +204,6 @@ namespace RESTToolkitTestConsoleApp
}
}
class Program
{
static void Main(string[] args)
@ -79,8 +211,10 @@ namespace RESTToolkitTestConsoleApp
Tests tests = new Tests();
tests.GeoCodeTest();
tests.LocationRecogTest();
tests.FindTimeZoneTest();
tests.ConvertTimeZoneTest();
tests.ListTimeZoneTest();
tests.AutoSuggestTest();
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="BingMapsKey" value="API_KEY_HERE" />
<add key="BingMapsKey" value="API_Key_Here" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

Просмотреть файл

@ -50,7 +50,23 @@ namespace RESTToolkitTestConsoleApp
public void AutoSuggestTest()
{
Console.WriteLine("Running Autosuggest Test");
CoordWithRadius ul = new CoordWithRadius() { Latitude = 47.668697, Longitude = -122.376373, Radius = 5 };
var request = new AutosuggestRequest()
{
BingMapsKey = _ApiKey,
Query = "El Bur",
UserLoc = ul
};
Console.WriteLine(request.GetRequestUrl());
var resources = GetResourcesFromRequest(request);
var entities = (resources[0] as AutosuggestResource);
foreach (var entity in entities.Value)
Console.Write($"Entity of type {entity.Type} returned.");
Console.ReadLine();
}
public void ConvertTimeZoneTest()
@ -198,6 +214,7 @@ namespace RESTToolkitTestConsoleApp
tests.FindTimeZoneTest();
tests.ConvertTimeZoneTest();
tests.ListTimeZoneTest();
tests.AutoSuggestTest();
}
}
}

Просмотреть файл

@ -126,7 +126,8 @@
<Compile Include="..\Models\ResponseModels\ConvertedTimeResource.cs" Link="Models\ResponseModels\ConvertedTimeResource.cs" />
<Compile Include="..\Models\ResponseModels\TimeZoneResponse.cs" Link="Models\ResponseModels\TimeZoneResponse.cs" />
<Compile Include="..\Models\ResponseModels\RESTTimeZone.cs" Link="Models\ResponseModels\RESTTimeZone.cs" />
<Compile Include="..\Models\ResponseModels\AutosuggestResource.cs" Link="Models\ResponseModels\AutosuggestResource.cs" />
<Compile Include="..\Models\RouteOptions.cs" Link="Models\RouteOptions.cs" />
@ -149,6 +150,12 @@
<Compile Include="..\Requests\SnapToRoadRequest.cs" Link="Requests\SnapToRoadRequest.cs" />
<Compile Include="..\Requests\TrafficRequest.cs" Link="Requests\TrafficRequest.cs" />
<Compile Include="..\Requests\LocationRecogRequest.cs" Link="Requests\LocationRecogRequest.cs" />
<Compile Include="..\Requests\ConvertTimeZoneRequest.cs" Link="Requests\ConvertTimeZoneRequest.cs" />
<Compile Include="..\Requests\ListTimeZonesRequest.cs" Link="Requests\ListTimeZonesRequest.cs" />
<Compile Include="..\Requests\FindTimeZoneRequest.cs" Link="Requests\FindTimeZoneRequest.cs" />
<Compile Include="..\ServiceManager.cs" Link="ServiceManager.cs" />
</ItemGroup>

Просмотреть файл

@ -81,6 +81,7 @@
<Compile Include="Models\CustomMapStyles\MapElementStyle.cs" />
<Compile Include="Models\CustomMapStyles\SettingsStyle.cs" />
<Compile Include="Models\ImageryPushpin.cs" />
<Compile Include="Models\ResponseModels\AutosuggestResource.cs" />
<Compile Include="Models\ResponseModels\BirdseyeMetadata.cs" />
<Compile Include="Models\ResponseModels\BusinessInfoEntity.cs" />
<Compile Include="Models\ResponseModels\CompressedPointList.cs" />

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

Просмотреть файл

@ -1,4 +1,28 @@
namespace BingMapsRESTToolkit
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace BingMapsRESTToolkit
{
/// <summary>
/// Measurement units of vehicle dimensions.

Просмотреть файл

@ -1,4 +1,27 @@
namespace BingMapsRESTToolkit
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace BingMapsRESTToolkit
{
/// <summary>
/// Types of hazardous material permits for truck routing.

Просмотреть файл

@ -1,4 +1,27 @@
namespace BingMapsRESTToolkit
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace BingMapsRESTToolkit
{
/// <summary>
/// Hazardous materials in which a truck may transport.

Просмотреть файл

@ -1,4 +1,27 @@
namespace BingMapsRESTToolkit
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace BingMapsRESTToolkit
{
/// <summary>
/// An enumeration for image resolution.

Просмотреть файл

@ -1,4 +1,27 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

Просмотреть файл

@ -0,0 +1,81 @@
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Autosuggest Resource Enity: Used for `Place`, `Address`, and `LocalBusiness`
/// </summary>
[DataContract]
public class AutosuggestEntityResource : Resource
{
/// <summary>
/// Address of the Entity
/// </summary>
[DataMember(Name ="address", EmitDefaultValue = false)]
public Address EntityAddress { get; set; }
}
[DataContract(Name= "LocalBusiness")]
public class AutoSuggestLocalBusinessResource : AutosuggestEntityResource
{
/// <summary>
/// Name of Entity
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }
}
[DataContract(Name = "Place")]
public class AutoSuggestPlaceResource : AutosuggestEntityResource
{
/// <summary>
/// Name of Entity
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }
}
[DataContract(Name = "Address")]
public class AutosuggestAddressResource : AutosuggestEntityResource
{
}
/// <summary>
/// Resource returned by Autosuggest API
/// </summary>
[DataContract(Name ="Autosuggest", Namespace ="http://schemas.microsoft.com/search/local/ws/rest/v1")]
public class AutosuggestResource : Resource
{
/// <summary>
/// List if Autosuggest Entities
/// </summary>
[DataMember(Name ="value")]
public AutosuggestEntityResource[] Value { get; set; }
}
}

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit

Просмотреть файл

@ -1,8 +1,35 @@
using System.Runtime.Serialization;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System.Runtime.Serialization;
using System;
namespace BingMapsRESTToolkit
{
/// <summary>
/// CovertedTime Resoruce returned by Time Zone API
/// </summary>
[DataContract]
public class ConvertedTimeResource
{

Просмотреть файл

@ -82,8 +82,8 @@ namespace BingMapsRESTToolkit
/// <summary>
/// Details of an error that may have occurred when processing the request.
/// </summary>
// [DataMember(Name = "errorMessage", EmitDefaultValue = false)]
// public string ErrorMessage { get; set; }
[DataMember(Name = "errorMessage", EmitDefaultValue = false)]
public string ErrorMessage { get; set; }
/// <summary>
/// Array of distance matrix cell results containing information for each coordinate pair and time interval.

Просмотреть файл

@ -1,11 +1,44 @@
using System.Runtime.Serialization;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System.Runtime.Serialization;
using System;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Resource used by TimeZone API
/// </summary>
[DataContract]
public class DstRuleResource
{
/// <summary>
/// Internal Start Datetime
/// </summary>
private DateTime StartTime {get; set;}
/// <summary>
/// Interntal End Time datetime
/// </summary>
private DateTime EndTime { get; set; }
/// <summary>

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
@ -9,9 +33,15 @@ namespace BingMapsRESTToolkit
[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")]
public class LocalBusiness
{
/// <summary>
/// Busisness Address `Address` Resource
/// </summary>
[DataMember(Name = "businessAddress", EmitDefaultValue = false)]
public Address BusinessAddress { get; set; }
/// <summary>
/// Resource just for Location Recog, `BusinessInfoEntity`
/// </summary>
[DataMember(Name = "businessInfo", EmitDefaultValue = false)]
public BusinessInfoEntity BusinessInfo { get; set; }

Просмотреть файл

@ -1,4 +1,29 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
@ -9,9 +34,15 @@ namespace BingMapsRESTToolkit
[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")]
public class LocationRecog : Resource
{
/// <summary>
/// Internal Variable to store string version of `IsPrivateResidence` value
/// </summary>
[DataMember(Name = "isPrivateResidence", EmitDefaultValue = false)]
public string _IsPrivateResidence { get; set; }
/// <summary>
/// IsPrivateResidence: "True" or "False" in JSON
/// </summary>
public bool IsPrivateResidence
{
get
@ -24,12 +55,21 @@ namespace BingMapsRESTToolkit
}
}
/// <summary>
/// Array of LocalBusiness Resources
/// </summary>
[DataMember(Name = "businessesAtLocation", EmitDefaultValue = false)]
public LocalBusiness[] BusinessAtLocation { get; set; }
/// <summary>
/// Array of Business Addressess
/// </summary>
[DataMember(Name = "addressOfLocation", EmitDefaultValue = false)]
public Address[] AddressOfLocation { get; set; }
/// <summary>
/// Array Point of Interest Entities
/// </summary>
[DataMember(Name = "naturalPOIAtLocation", EmitDefaultValue = false)]
public NaturalPOIAtLocationEntity[] NaturalPOIAtLocation { get; set;}

Просмотреть файл

@ -1,20 +1,59 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Point of Interest Resource
/// </summary>
[DataContract(Namespace = "http://schemas.microsoft.com/search/local/ws/rest/v1")]
public class NaturalPOIAtLocationEntity
{
/// <summary>
/// POI Name
/// </summary>
[DataMember(Name = "entityName", EmitDefaultValue = false)]
public string EntityName { get; set; }
/// <summary>
/// POI Latitude
/// </summary>
[DataMember(Name = "latitude", EmitDefaultValue = false)]
public double Latitude { get; set; }
/// <summary>
/// POI Longitude
/// </summary>
[DataMember(Name = "longitude", EmitDefaultValue = false)]
public double Longitude { get; set; }
/// <summary>
/// Type of Point of Interest
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
public string Type { get; set; }
}

Просмотреть файл

@ -1,7 +1,34 @@
using System.Runtime.Serialization;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Resource returned by Find TimeZone by Query
/// </summary>
[DataContract(Name = "timeZoneAtLocation")]
public class TimeZoneAtLocationResource
{

Просмотреть файл

@ -45,6 +45,11 @@ namespace BingMapsRESTToolkit
[KnownType(typeof(LocationRecog))]
[KnownType(typeof(TimeZoneResponse))]
[KnownType(typeof(RESTTimeZone))]
[KnownType(typeof(AutosuggestResource))]
[KnownType(typeof(AutosuggestEntityResource))]
[KnownType(typeof(AutoSuggestLocalBusinessResource))]
[KnownType(typeof(AutoSuggestPlaceResource))]
[KnownType(typeof(AutosuggestAddressResource))]
public class Resource
{
/// <summary>

Просмотреть файл

@ -1,4 +1,28 @@
using System.Runtime.Serialization;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System.Runtime.Serialization;
namespace BingMapsRESTToolkit
{

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
@ -7,7 +31,30 @@ using System.Threading.Tasks;
namespace BingMapsRESTToolkit
{
class AutosuggestRequest : BaseRestRequest
public class CoordWithRadius : Coordinate
{
/// <summary>
/// Radius in Meters
/// </summary>
public int Radius { get; set; }
/// <summary>
/// Default Constuctor
/// </summary>
public CoordWithRadius() : base()
{
}
/// <summary>
/// Return Comma-separated list of Lat,Lon,Radius
/// </summary>
/// <returns></returns>
public override string ToString() => string.Format("{0},{1},{2}", Latitude.ToString(), Longitude.ToString(), Radius.ToString());
}
public class AutosuggestRequest : BaseRestRequest
{
#region Private Properties
@ -20,24 +67,26 @@ namespace BingMapsRESTToolkit
public AutosuggestRequest()
{
this.AutoLocation = AutosuggestLocationType.userLocation;
this.IncludeEntityTypes = new List<AutosuggestEntityType>()
AutoLocation = AutosuggestLocationType.userLocation;
IncludeEntityTypes = new List<AutosuggestEntityType>()
{
AutosuggestEntityType.Address,
AutosuggestEntityType.LocalBusiness,
AutosuggestEntityType.Place,
};
this.Culture = "en-US";
this.UserRegion = "US";
this.CountryFilter = null;
this.Query = "";
Culture = "en-US";
UserRegion = "US";
CountryFilter = null;
Query = "";
UserLoc = null;
}
#endregion
#region Public Properties
public CoordWithRadius UserLoc { get; set; }
public string CountryFilter { get; set; }
public List<AutosuggestEntityType> IncludeEntityTypes {get; set;}
@ -54,7 +103,7 @@ namespace BingMapsRESTToolkit
public override Task<Response> Execute()
{
return this.Execute(null);
return Execute(null);
}
public override async Task<Response> Execute(Action<int> remainingTimeCallback)
@ -76,10 +125,10 @@ namespace BingMapsRESTToolkit
public override string GetRequestUrl()
{
if (this.Query == "")
if (Query == "")
throw new Exception("Empty Query value in Autosuggest REST Request");
string queryStr = string.Format("q={0}", this.Query);
string queryStr = string.Format("q={0}", Uri.EscapeDataString(Query));
string maxStr = string.Format("maxRes={0}", (max_maxResults < MaxResults) ? max_maxResults : MaxResults);
@ -88,13 +137,15 @@ namespace BingMapsRESTToolkit
switch(AutoLocation)
{
case AutosuggestLocationType.userCircularMapView:
locStr = string.Format("ucmv={0}", this.UserCircularMapView.ToString());
locStr = string.Format("ucmv={0}", UserCircularMapView.ToString());
break;
case AutosuggestLocationType.userMapView:
locStr = string.Format("umv={0}", this.UserMapView.ToString());
locStr = string.Format("umv={0}", UserMapView.ToString());
break;
case AutosuggestLocationType.userLocation:
locStr = string.Format("ul={0}", this.UserLocation.ToString());
if (UserLoc == null)
throw new Exception("User Location is Requred");
locStr = string.Format("ul={0}", UserLoc.ToString());
break;
}
@ -118,7 +169,7 @@ namespace BingMapsRESTToolkit
param_list.Add(country_filterStr);
}
return this.Domain + "Autosuggest?" + string.Join("&", param_list);
return Domain + "Autosuggest?" + string.Join("&", param_list);
}
#endregion

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
@ -27,6 +51,11 @@ namespace BingMapsRESTToolkit
#endregion
#region Constructor
/// <summary>
/// Create a Covert TZ Request for Given Datetime `datetime` and Destition ID string `DestID`
/// </summary>
/// <param name="datetime"></param>
/// <param name="DestID"></param>
public ConvertTimeZoneRequest(DateTime datetime, string DestID)
{
LocationDateTime = datetime;
@ -35,6 +64,11 @@ namespace BingMapsRESTToolkit
#endregion
#region Public Methods
/// <summary>
/// Returns the URI for Convert TZ API request
/// </summary>
/// <returns></returns>
public override string GetRequestUrl()
{
string headStr = "TimeZone/Convert/?";

Просмотреть файл

@ -1,23 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Request to Find a Time Zone by Query or Point
/// </summary>
public class FindTimeZoneRequest : BaseRestRequest
{
#region Public Props
/// <summary>
/// The Query to Find TZ
/// </summary>
public string Query { get; set; }
/// <summary>
/// The Point of Find TZ
/// </summary>
public Coordinate Point { get; set; }
/// <summary>
/// Optional. The UTC date time string for the specified location. The date must be specified to apply the correct DST.
/// </summary>
public DateTime? LocationDateTime { get; set; }
/// <summary>
/// Optional. If set to true then DST rule information will be returned in the response.
/// </summary>
public bool IncludeDstRules { get; set; }
#endregion
#region Constructors
/// <summary>
/// Construct or Finding a Time Zone by Query and Datetime
/// </summary>
/// <param name="query"></param>
/// <param name="datetime"></param>
public FindTimeZoneRequest(string query, DateTime datetime)
{
Point = null;
@ -37,13 +80,23 @@ namespace BingMapsRESTToolkit
IncludeDstRules = false;
}
/// <summary>
/// Constuctor for Find Time Zone without Specified Point or Query
/// </summary>
public FindTimeZoneRequest()
{
Point = null;
Query = "";
IncludeDstRules = false;
}
#endregion
#region Public Methods
/// <summary>
/// Returns URI for Find TimeZone Request
/// </summary>
/// <returns></returns>
public override string GetRequestUrl()
{
string headStr;
@ -73,5 +126,6 @@ namespace BingMapsRESTToolkit
return this.Domain + headStr + string.Join("&", param_list);
}
#endregion
}
}

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -7,12 +31,24 @@ using System.IO;
namespace BingMapsRESTToolkit
{
/// <summary>
/// List Resoruce of Time Zones
/// </summary>
public class ListTimeZonesRequest : BaseRestRequest
{
#region Private Props
/// <summary>
/// Internal TimeZoneStandardType Enum: IANA vs WINDOWS
/// </summary>
private TimeZoneStandardType tz_standard { get; set; }
private bool list_operation { get; set; }
/// <summary>
/// Used to call the List operaiton or Lookup TZ info
/// </summary>
private bool list_operation { get; set; }
#endregion
#region Public Props
/// <summary>
/// If set to true then DST rule information will be returned in the response.
/// </summary>
@ -23,6 +59,9 @@ namespace BingMapsRESTToolkit
/// </summary>
public string DestinationTZID { get; set; }
/// <summary>
/// Insert TZ Standards as String
/// </summary>
public string TimeZoneStandard
{
get
@ -50,10 +89,12 @@ namespace BingMapsRESTToolkit
}
}
}
#endregion
#region Constructor
/// <summary>
/// Constructor for using the List Operaiton
/// </summary>
/// <param name="input">The Time Zone Standard Name if `use_list_operation` is true, otherwise `input` is assumed to be a Time Zone ID.</param>
/// <param name="use_list_operation">Whether to use the List operation</param>
public ListTimeZonesRequest(bool use_list_operation)
{
@ -61,7 +102,9 @@ namespace BingMapsRESTToolkit
IncludeDstRules = false;
list_operation = use_list_operation;
}
#endregion
#region Public Method
public override string GetRequestUrl()
{
List<string> param_list = new List<string>()
@ -92,5 +135,6 @@ namespace BingMapsRESTToolkit
return this.Domain + headStr + string.Join("&", param_list);
}
#endregion
}
}

Просмотреть файл

@ -1,4 +1,28 @@
using System;
/*
* Copyright(c) 2018 Microsoft Corporation. All rights reserved.
*
* This code is licensed under the MIT License (MIT).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -7,6 +31,9 @@ using System.IO;
namespace BingMapsRESTToolkit
{
/// <summary>
/// Location Recog Request: Given a pair of location coordinates (latitude, longitude), the Location Recognition API returns a list of entities ranked by their proximity to that location.
/// </summary>
public class LocationRecogRequest : BaseRestRequest
{
@ -131,6 +158,9 @@ namespace BingMapsRESTToolkit
}
}
/// <summary>
/// The Max number of Entities returned
/// </summary>
public int Top
{
get
@ -175,6 +205,9 @@ namespace BingMapsRESTToolkit
}
}
/// <summary>
/// Whether Returned names should be verbose
/// </summary>
public bool VerbosePlaceNames { get; set; }
#endregion