/// <summary> /// A radial search request for finding results that are near a location. /// </summary> /// <param name="info">Basic information about the data source.</param> public FindNearByRequest(BasicDataSourceInfo info) { this._getDistance = true; this.QueryUrl = info.QueryUrl; this.MasterKey = info.MasterKey; this.QueryKey = info.QueryKey; }
/// <summary> /// A search query that looks for locations that are within 1 mile or 1.6 kilometers of a route. /// </summary> /// <param name="info">Basic information about the data source.</param> public FindNearRouteRequest(BasicDataSourceInfo info) { this._getDistance = true; this.QueryUrl = info.QueryUrl; this.MasterKey = info.MasterKey; this.QueryKey = info.QueryKey; Optimize = RouteOptimizationType.Time; TravelMode = TravelModeType.Driving; }
public DeleteModal(DataSourceDetails details) { InitializeComponent(); info = new BasicDataSourceInfo() { AccessId = details.AccessId, QueryUrl = details.QueryUrl, MasterKey = details.MasterKey }; this.DataContext = info; }
public UploadModal(BasicDataSourceInfo info) { InitializeComponent(); _info = new BasicDataSourceInfo() { AccessId = info.AccessId, DataSourceName = info.DataSourceName, EntityTypeName = info.EntityTypeName, MasterKey = info.MasterKey, QueryKey = info.QueryKey }; this.DataContext = _info; }
/// <summary> /// A query that searches by property. /// </summary> /// <param name="info">Basic information about the data source.</param> public FindByPropertyRequest(BasicDataSourceInfo info) { this.QueryUrl = info.QueryUrl; this.MasterKey = info.MasterKey; this.QueryKey = info.QueryKey; }
/// <summary> /// Makes a request to delete a data source. /// Requires Access ID, Data Source Name and Master Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <param name="isStaging">A boolean indicating if the staging data source should be deleted or not.</param> /// <exception cref="System.Exception">Thrown if invalid parameters are specified or there is an error making the request.</exception> /// <returns>A boolean value indicating if the request to delete a data source was successfully made or not.</returns> public Task <bool> DeleteDataSource(BasicDataSourceInfo info, bool isStaging) { return(DeleteDataSource(info.AccessId, info.DataSourceName, info.MasterKey, isStaging)); }
/// <summary> /// Makes a request to delete a data source. /// Requires Access ID, Data Source Name and Master Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <exception cref="System.Exception">Thrown if invalid parameters are specified or there is an error making the request.</exception> /// <returns>A boolean value indicating if the request to delete a data source was successfully made or not.</returns> public Task <bool> DeleteDataSource(BasicDataSourceInfo info) { return(DeleteDataSource(info.AccessId, info.DataSourceName, info.MasterKey)); }
/// <summary> /// Sets the data source public setting as either public or non-public. /// Requires Access ID, Data Source Name and Master Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <param name="makePublic">A boolean indicating if the data source should be made public or not.</param> /// <returns>A data flow job which contains the status of the job setting the public flag of a data source.</returns> public async Task <DataServiceJob> SetPublicSetting(BasicDataSourceInfo info, bool makePublic) { return(await SetPublicSetting(info.AccessId, info.DataSourceName, info.MasterKey, makePublic)); }
/// <summary> /// Downloads a data source. /// Requires Access ID, Data Source Name and Master Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <exception cref="System.Exception">Thrown when invalid data is specified or the download process is aborted.</exception> /// <returns>The downloaded data source.</returns> public async Task <DataSource> Download(BasicDataSourceInfo info) { return(await Download(info.AccessId, info.DataSourceName, info.MasterKey)); }
/// <summary> /// Uploads KML and SHP files streams as a data source. /// </summary> /// <param name="dataSourceStream">A file stream for a data source that is in KML or SHP file format.</param> /// <param name="format">Data Source file Format.</param> /// <param name="loadOperation">The type of operation to perform when uploading a data source.</param> /// <param name="info">Information about the datasource.</param> /// <param name="setPublic">A boolean value indicating if the data source should be made public or not.</param> /// <returns>The final data flow job when the upload process completes or is aborted.</returns> public async Task <DataflowJob> Upload(Stream dataSourceStream, DataSourceFormat format, LoadOperation loadOperation, BasicDataSourceInfo info, bool setPublic) { var result = new DataflowJob(); try { if (string.IsNullOrWhiteSpace(info.MasterKey)) { throw new Exception("A valid Bing Maps key must be specified as a master key for the data source."); } if (format != DataSourceFormat.KML && format != DataSourceFormat.SHP) { var dataSource = new DataSource(info); if (await dataSource.ReadAsync(dataSourceStream, format)) { return(await Upload(dataSource, loadOperation, setPublic)); } else { throw new Exception("Unable to read data source file."); } } //Handle KML and SHP files. string request = string.Format("https://spatial.virtualearth.net/REST/v1/Dataflows/LoadDataSource?loadOperation={0}&dataSourceName={1}&setPublic={2}&input={3}&output=json&key={4}&clientApi=SDSToolkit", loadOperation, info.DataSourceName, (setPublic) ? 1 : 0, (format == DataSourceFormat.KML) ? "kml" : "shp", info.MasterKey); if (!string.IsNullOrWhiteSpace(info.QueryKey)) { request += "&queryKey=" + info.QueryKey; } if (!string.IsNullOrWhiteSpace(info.Description)) { request += "&description=" + Uri.EscapeDataString(info.Description); } ReportUploadStatus("Creating upload job."); var dataflowJobLocation = await CreateUploadJob(request, dataSourceStream, format); var statusUrl = new Uri(dataflowJobLocation + "?output=json&key=" + info.MasterKey); ReportUploadStatus("Upload job created. Monitoring status."); result = await MonitorStatus(statusUrl); ReportUploadStatus("Upload job " + result.Status); } catch (Exception ex) { result.ErrorMessage = ex.Message; result.Status = "Aborted"; ReportUploadStatus("Upload aborted.\r\n" + ex.Message); } return(result); }
/// <summary> /// Publishes a staged data source to production. /// Requires Access ID, Data Source Name and Master Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <returns>The final data flow job when the publishing process completes or is aborted.</returns> public async Task <DataServiceJob> PublishStagedDataSource(BasicDataSourceInfo info) { return(await PublishStagedDataSource(info.AccessId, info.DataSourceName, info.MasterKey)); }
/// <summary> /// Gets details for a specific data sources in a Bing Maps account. /// Requires Access ID, Data Source Name and Master or Query Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <param name="showAllVersions">A boolean value indicating if information for all versions of data sources should be returned.</param> /// <exception cref="System.Exception">Thrown when a Bing Maps key is not specified.</exception> /// <returns>A list of data source details.</returns> public async Task <List <DataSourceDetails> > GetDetails(BasicDataSourceInfo info, bool showAllVersions) { string key = (string.IsNullOrEmpty(info.MasterKey)) ? info.QueryKey : info.MasterKey; return(await GetDetails(key, info.AccessId, info.DataSourceName, showAllVersions)); }
/// <summary> /// Gets details for a specific data sources in a Bing Maps account. /// Requires Access ID, Data Source Name and Master or Query Key. /// </summary> /// <param name="info">Basic data source information.</param> /// <exception cref="System.Exception">Thrown when a Bing Maps key is not specified.</exception> /// <returns>A list of data source details.</returns> public async Task <List <DataSourceDetails> > GetDetails(BasicDataSourceInfo info) { return(await GetDetails(info, false)); }
/// <summary> /// A search query which looks to see if and locations intersect the specified Geography. /// </summary> /// <param name="info">Basic information about the data source.</param> public IntersectionSearchRequest(BasicDataSourceInfo info) { this.QueryUrl = info.QueryUrl; this.MasterKey = info.MasterKey; this.QueryKey = info.QueryKey; }