public async Task <IEnumerable <JobServiceModel> > GetJobsAsync( JobType?jobType, JobStatus?jobStatus, int?pageSize, string queryFrom, string queryTo) { var from = DateTimeOffsetExtension.Parse(queryFrom, DateTimeOffset.MinValue); var to = DateTimeOffsetExtension.Parse(queryTo, DateTimeOffset.MaxValue); var data = await this.client.GetAllAsync(DEVICE_JOBS_COLLECTION_ID); var Coverteddata = data.Items.Select(CreatejobServiceModel); //var query = this.jobClient.CreateQuery( // JobServiceModel.ToJobTypeAzureModel(jobType), // JobServiceModel.ToJobStatusAzureModel(jobStatus), // pageSize); var results = new List <JobServiceModel>(); results.AddRange(Coverteddata .Where(j => j.CreatedTimeUtc >= from && j.CreatedTimeUtc <= to && (jobType == null || j.Type.ToString() == JobServiceModel.ToJobTypeAzureModel(jobType).ToString()) && (jobStatus == null || j.Status.ToString() == JobServiceModel.ToJobStatusAzureModel(jobStatus).ToString())) .Select(r => r)); //while (query.HasMoreResults) //{ // var jobs = await query.GetNextAsJobResponseAsync(); //} return(results); }
public async Task <IEnumerable <JobServiceModel> > GetJobsAsync( JobType?jobType, JobStatus?jobStatus, int?pageSize, string queryFrom, string queryTo) { var from = DateTimeOffsetExtension.Parse(queryFrom, DateTimeOffset.MinValue); var to = DateTimeOffsetExtension.Parse(queryTo, DateTimeOffset.MaxValue); var query = this.jobClient.CreateQuery( JobServiceModel.ToJobTypeAzureModel(jobType), JobServiceModel.ToJobStatusAzureModel(jobStatus), pageSize); var results = new List <JobServiceModel>(); while (query.HasMoreResults) { var jobs = await query.GetNextAsJobResponseAsync(); results.AddRange(jobs .Where(j => j.CreatedTimeUtc >= from && j.CreatedTimeUtc <= to) .Select(r => new JobServiceModel(r))); } return(results); }
/// <summary> /// Initializes a new instance of the Job class. /// </summary> /// <param name="type">Possible values include: 'read', 'write', /// 'profiling', 'qualityCheck'</param> public Job(string name, string id = default(string), int?version = default(int?), string description = default(string), Schedule schedule = default(Schedule), string connectionId = default(string), string schemaId = default(string), string shapeId = default(string), string agentId = default(string), bool?canRunInCloud = default(bool?), int?dataVersion = default(int?), IList <PropertyMapping> propertyMappings = default(IList <PropertyMapping>), JobType?type = default(JobType?), bool?isPaused = default(bool?), Writeback writeback = default(Writeback), Filter filter = default(Filter), JobStatus status = default(JobStatus), Batch latestBatch = default(Batch), System.DateTime?createdAt = default(System.DateTime?), string createdBy = default(string), System.DateTime?updatedAt = default(System.DateTime?), string updatedBy = default(string), System.DateTime?deletedAt = default(System.DateTime?), string deletedBy = default(string)) { Id = id; Version = version; Name = name; Description = description; Schedule = schedule; ConnectionId = connectionId; SchemaId = schemaId; ShapeId = shapeId; AgentId = agentId; CanRunInCloud = canRunInCloud; DataVersion = dataVersion; PropertyMappings = propertyMappings; Type = type; IsPaused = isPaused; Writeback = writeback; Filter = filter; Status = status; LatestBatch = latestBatch; CreatedAt = createdAt; CreatedBy = createdBy; UpdatedAt = updatedAt; UpdatedBy = updatedBy; DeletedAt = deletedAt; DeletedBy = deletedBy; CustomInit(); }
private async Task <QueryResult> GetJobsAsync(JobType?jobType, JobStatus?jobStatus, int?pageSize, string continuationToken, CancellationToken cancellationToken) { Logging.Enter(this, $"jobType=[{jobType}], jobStatus=[{jobStatus}], pageSize=[{pageSize}]", nameof(GetJobsAsync)); try { EnsureInstanceNotClosed(); var customHeaders = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(continuationToken)) { customHeaders.Add(ContinuationTokenHeader, continuationToken); } if (pageSize != null) { customHeaders.Add(PageSizeHeader, pageSize.ToString()); } HttpResponseMessage response = await _httpClientHelper.GetAsync <HttpResponseMessage>( BuildQueryJobUri(jobType, jobStatus), null, customHeaders, cancellationToken).ConfigureAwait(false); return(await QueryResult.FromHttpResponseAsync(response).ConfigureAwait(false)); } finally { Logging.Exit(this, $"jobType=[{jobType}], jobStatus=[{jobStatus}], pageSize=[{pageSize}]", nameof(GetJobsAsync)); } }
public async Task <IEnumerable <JobApiModel> > GetAsync( [FromQuery] JobType?jobType, [FromQuery] JobStatus?jobStatus, [FromQuery] int?pageSize, [FromQuery] string from, [FromQuery] string to) { var result = await this.jobs.GetJobsAsync(jobType, jobStatus, pageSize, from, to); return(result.Select(r => new JobApiModel(r))); }
/// <summary>A jobs stats request must specify "jobs-stats" for the action parameter in addition to the other required parameters, and then can optionally scope the search using the parameters below.</summary> /// <remarks>See: http://www.glassdoor.com/api/jobsApiActions.htm </remarks> /// <param name="callback">If json is the requested format, you may specify a jsonp callback here, allowing you to make cross-domain calls to the glassdoor API from your client-side javascript.</param> /// <param name="queryPhrase">Query phrase to search for - can be any combination of employer or occupation, but location should be in l param.</param> /// <param name="employer">Scope the search to a specific employer by specifying the name here.</param> /// <param name="location">Scope the search to a specific location by specifying it here - city, state, or country.</param> /// <param name="city">Scope the search to a specific city by specifying it here.</param> /// <param name="state">Scope the search to a specific state by specifying it here.</param> /// <param name="country">Scope the search to a specific country by specifying it here.</param> /// <param name="fromAgeDays">Scope the search to jobs that are less than X days old (-1 = show all jobs (default), 1 = 1 day old, 7 = 1 week old, 14 = 2 weeks old, etc.)</param> /// <param name="jobType">Scope the search to certain job types. Valid values are all (default), fulltime, parttime, internship, contract, internship, temporary</param> /// <param name="minRating">Scope the search to jobs of companies with rating >= minRating (0 = returns all (default), 1 = more than 1 star, 2 = more than 2 stars, 3 = more than 3 stars, 4 = more than 4 stars)</param> /// <param name="radius">Scope the search to jobs within a certain radius, in miles, of the location specified.</param> /// <param name="jobTitle">Scope the search to a specific job title by specifying it here.</param> /// <param name="jobCategory">Job category id to scope the search to - see the Job Category table below - note you must pass the id. This can be a comma separated list of ids if you desire to select more than one category.</param> /// <param name="returnCities">Results will include geographical data (job counts) broken down by city.</param> /// <param name="returnStates">Results will include geographical data (job counts, score) broken down by the type of geographical district specified in parameter admLevelRequested.</param> /// <param name="returnJobTitles">Results will include job data broken down by job title.</param> /// <param name="returnEmployers">Results will include job data broken down by employer.</param> /// <param name="admLevelRequested">Geographic district type requested when returnStates is true (1 = states, 2 = counties)</param> /// <param name="userIp">The IP address of the end user to whom the API results will be shown. /// This is an optional user IP that will be applied to all subsequent calls unless the userIp parameter is set in that specific call.</param> /// <param name="userAgent">The User-Agent (browser) of the end user to whom the API results will be shown. Note that you can can obtain this from the "User-Agent" HTTP request header from the end-user. /// This probably doesn't apply here as this SDK is intended for Windows applications.</param> /// <returns></returns> public async Task <JobsStats> GetJobsStatsAsync(string callback = null, string queryPhrase = null, string employer = null, string location = null, int?city = null, string state = null, string country = null, string fromAgeDays = null, JobType?jobType = null, byte?minRating = null, int?radius = null, string jobTitle = null, JobCategory?jobCategory = null, bool?returnCities = null, bool?returnStates = null, bool?returnJobTitles = null, bool?returnEmployers = null, byte?admLevelRequested = null, string userIp = null, string userAgent = "") { var url = "http://api.glassdoor.com/api/api.htm".Parameters("action", "jobs-stats", "v", "1", "format", "json", "t.p", PartnerId, "t.k", Key, "userip", DetermineUserIp(userIp), "useragent", userAgent, "callback", callback, "q", queryPhrase, "e", employer.ToStringIfNotNull(), "l", location, "city", city.ToStringIfNotNull(), "state", state.ToStringIfNotNull(), "country", country, "fromAge", fromAgeDays, "jobType", jobType.ToStringIfNotNull(), "minRating", minRating.ToStringIfNotNull(), "jt", jobTitle, "jc", jobCategory.ToStringIfNotNull(), "returnCities", returnCities.ToStringIfNotNull(), "returnStates", returnStates.ToStringIfNotNull(), "returnJobTitles", returnJobTitles.ToStringIfNotNull(), "returnEmployers", returnEmployers.ToStringIfNotNull(), "admLevelRequested", admLevelRequested.ToStringIfNotNull()); return(await WebRequester.GetAsync <JobsStats>(url)); }
public static Azure.Devices.JobType? ToJobTypeAzureModel(JobType? jobType) { if (!jobType.HasValue) { return null; } switch (jobType.Value) { case JobType.ScheduleDeviceMethod: case JobType.ScheduleUpdateTwin: return (Azure.Devices.JobType)jobType.Value; default: return (Azure.Devices.JobType)JobType.Unknown; } }
private static Uri BuildQueryJobUri(JobType?jobType, JobStatus?jobStatus) { var stringBuilder = new StringBuilder(JobsQueryFormat.FormatInvariant(ClientApiVersionHelper.ApiVersionQueryString)); if (jobType != null) { stringBuilder.Append("&jobType={0}".FormatInvariant(WebUtility.UrlEncode(jobType.ToString()))); } if (jobStatus != null) { stringBuilder.Append("&jobStatus={0}".FormatInvariant(WebUtility.UrlEncode(jobStatus.ToString()))); } return(new Uri(stringBuilder.ToString(), UriKind.Relative)); }
/// <summary> /// Initializes a new instance of the PutJobProperties class. /// </summary> public PutJobProperties(string location, string storageAccountName, JobType?type, string storageAccountKey = default(string), string containerSas = default(string), string friendlyName = default(string), string description = default(string), string metadata = default(string), ReturnAddress returnAddress = default(ReturnAddress), ReturnShipping returnShipping = default(ReturnShipping), string importExportStatesPath = default(string), bool?enableVerboseLog = default(bool?), bool?backupDriveManifest = default(bool?)) { Location = location; StorageAccountName = storageAccountName; StorageAccountKey = storageAccountKey; ContainerSas = containerSas; Type = type; FriendlyName = friendlyName; Description = description; Metadata = metadata; ReturnAddress = returnAddress; ReturnShipping = returnShipping; ImportExportStatesPath = importExportStatesPath; EnableVerboseLog = enableVerboseLog; BackupDriveManifest = backupDriveManifest; }
private static void ShowUsage(JobType?jobType, OptionSet options) { var jobFactory = jobType == null ? null : SelectFactory(jobType.Value); var codeBase = Bootstrap.GetEntryAssemblyUri().LocalPath; if (jobFactory == null) { Console.Error.WriteLine($"Usage: {Path.GetFileName(codeBase)} <mode> [options]"); Console.Error.WriteLine(" where mode is one of: showstacks, showheap, dumpmemory"); } else { var convenientJobTypeString = jobType.ToString().ToLower(); Console.Error.WriteLine($"Usage: {Path.GetFileName(codeBase)} {convenientJobTypeString} [options]"); } options.WriteOptionDescriptions(Console.Error); }
public static Microsoft.Azure.Devices.JobType?ToJobTypeAzureModel(JobType? jobType) { if (!jobType.HasValue) { return(null); } switch (jobType.Value) { case JobType.ScheduleDeviceMethod: case JobType.ScheduleUpdateTwin: return((Microsoft.Azure.Devices.JobType)jobType.Value); default: return((Microsoft.Azure.Devices.JobType)JobType.Unknown); } }
private IEnumerable <SpecificationReport> GetReportMetadata( IEnumerable <IListBlobItem> listBlobItems, JobType?metadataJobType = null, string targetFundingPeriodId = null) { return(listBlobItems.Select(b => { ICloudBlob cloudBlob = (ICloudBlob)b; cloudBlob.Metadata.TryGetValue("file_name", out string fileName); cloudBlob.Metadata.TryGetValue("funding_period_id", out string fundingPeriodId); ByteSize fileLength = ByteSize.FromBytes(cloudBlob.Properties.Length); string fileSuffix = Path.GetExtension(b.Uri.AbsolutePath).Replace(".", string.Empty); JobType jobType = metadataJobType.GetValueOrDefault(); if (!string.IsNullOrWhiteSpace(targetFundingPeriodId) && !string.IsNullOrWhiteSpace(fundingPeriodId) && fundingPeriodId != targetFundingPeriodId) { return null; } if (!metadataJobType.HasValue) { cloudBlob.Metadata.TryGetValue("job_type", out string metadataJobTypeString); bool reportTypeParseResult = Enum.TryParse(metadataJobTypeString, true, out jobType); if (!reportTypeParseResult) { return null; } } return new SpecificationReport { Name = fileName, SpecificationReportIdentifier = EncodeReportId(GetReportId(cloudBlob.Metadata)), Category = GetReportCategory(jobType).ToString(), LastModified = cloudBlob.Properties.LastModified, Format = fileSuffix.ToUpperInvariant(), Size = $"{fileLength.LargestWholeNumberDecimalValue:0.#} {fileLength.LargestWholeNumberDecimalSymbol}" }; }).Where(_ => _ != null).OrderByDescending(_ => _.LastModified)); }
public Job(int authorId, string title, string description, int?salaryMin, int?salaryMax, SalaryType?salaryType, DateTime datePosted, string location, bool isRemote, ExperienceLevel?experienceLevel, JobType?jobType) { AuthorId = authorId; Title = title ?? throw new ArgumentNullException(nameof(title)); Description = description ?? throw new ArgumentNullException(nameof(description)); SalaryMin = salaryMin; SalaryMax = salaryMax; SalaryType = salaryType; DatePosted = datePosted; Location = location ?? throw new ArgumentNullException(nameof(location)); IsRemote = isRemote; ExperienceLevel = experienceLevel; JobType = jobType; if ((salaryMin.HasValue || salaryMax.HasValue) && !salaryType.HasValue) { throw new ArgumentException("Salary type is required if salary is setted"); } }
private async Task <IEnumerable <DJobMessage> > GetJobMessages ( int?userId, int?offset, int?limit, JobType?jobType = JobType.None, bool?hidden = null, bool?addFinished = true, bool?doNotFetchResult = false) { var param = new DynamicParameters(); param.Add("@hidden", hidden); param.Add("@userId", userId); param.Add("@projectId"); param.Add("@addFinished", addFinished); param.Add("@receiverJobServiceId"); param.Add("@doNotFetchResult", doNotFetchResult); param.Add("@offset", offset ?? 0); param.Add("@limit", limit ?? ServiceConstants.JobsDefaultPageSize); param.Add("@jobTypeFilter", jobType != JobType.None ? jobType : null); try { return((await _connectionWrapper.QueryAsync <DJobMessage>("GetJobMessagesNova", param, commandType: CommandType.StoredProcedure)).ToList()); } catch (SqlException sqlException) { switch (sqlException.Number) { // Sql timeout error case ErrorCodes.SqlTimeoutNumber: throw new SqlTimeoutException("Server did not respond with a response in the allocated time. Please try again later.", ErrorCodes.Timeout); } throw; } }
/// <summary> /// Initializes a new instance of the JobProperties class. /// </summary> public JobProperties(string location = default(string), JobType?type = default(JobType?), string friendlyName = default(string), string description = default(string), string metadata = default(string), string state = default(string), bool?cancelRequested = default(bool?), int?percentComplete = default(int?), ReturnAddress returnAddress = default(ReturnAddress), ReturnShipping returnShipping = default(ReturnShipping), ShippingInformation shippingInformation = default(ShippingInformation), PackageInfomation deliveryPackage = default(PackageInfomation), PackageInfomation returnPackage = default(PackageInfomation), string importExportStatesPath = default(string), bool?enableVerboseLog = default(bool?), bool?backupDriveManifest = default(bool?), string incompleteBlobListUri = default(string), string verboseLogUri = default(string), string errorLogUri = default(string), string manifestUri = default(string)) { Location = location; Type = type; FriendlyName = friendlyName; Description = description; Metadata = metadata; State = state; CancelRequested = cancelRequested; PercentComplete = percentComplete; ReturnAddress = returnAddress; ReturnShipping = returnShipping; ShippingInformation = shippingInformation; DeliveryPackage = deliveryPackage; ReturnPackage = returnPackage; ImportExportStatesPath = importExportStatesPath; EnableVerboseLog = enableVerboseLog; BackupDriveManifest = backupDriveManifest; IncompleteBlobListUri = incompleteBlobListUri; VerboseLogUri = verboseLogUri; ErrorLogUri = errorLogUri; ManifestUri = manifestUri; }
async Task <QueryResult> GetJobsAsync(JobType?jobType, JobStatus?jobStatus, int?pageSize, string continuationToken, CancellationToken cancellationToken) { this.EnsureInstanceNotClosed(); var customHeaders = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(continuationToken)) { customHeaders.Add(ContinuationTokenHeader, continuationToken); } if (pageSize != null) { customHeaders.Add(PageSizeHeader, pageSize.ToString()); } HttpResponseMessage response = await this.httpClientHelper.GetAsync <HttpResponseMessage>( BuildQueryJobUri(jobType, jobStatus), null, customHeaders, cancellationToken); return(await QueryResult.FromHttpResponseAsync(response)); }
public override IQuery CreateQuery(JobType?jobType, JobStatus?jobStatus, int?pageSize) { return(new Query((token) => GetJobsAsync(jobType, jobStatus, pageSize, token, CancellationToken.None))); }
internal static string ToSerializedValue(this JobType?value) { return(value == null ? null : ((JobType)value).ToSerializedValue()); }
public override IQuery CreateQuery(JobType?jobType, JobStatus?jobStatus) { return(CreateQuery(jobType, jobStatus, null)); }
private IEnumerable <SpecificationReport> GetReportMetadata(string fileNamePrefix, string containerName, JobType?reportType = null, string targetFundingPeriodId = null) { IEnumerable <IListBlobItem> listBlobItems = _blobClient.ListBlobs(fileNamePrefix, containerName, true, BlobListingDetails.Metadata).ToList(); return(GetReportMetadata(listBlobItems, reportType, targetFundingPeriodId)); }
/// <summary> /// List active and completed jobs for a storage account in a subscription. /// </summary> /// <param name="storageAccountName">Name of the storage account you want to operate on.</param> /// <param name="jobType">Optional. List jobs with the job type.</param> /// <returns></returns> public IList <ListJobsResponseValueItem> ListJobs(string storageAccountName, JobType?jobType = null) { var jobList = client.ListJobs(storageAccountName, jobType); return(jobList.Value); }
/// <summary> /// Get IQuery through which job responses for specified jobType and jobStatus are retrieved page by page /// </summary> /// <param name="jobType">The job type to query. Could be null if not querying.</param> /// <param name="jobStatus">The job status to query. Could be null if not querying.</param> /// <returns></returns> public abstract IQuery CreateQuery(JobType?jobType, JobStatus?jobStatus);
/// <summary> /// Get IQuery through which job responses for specified jobType and jobStatus are retrieved page by page /// </summary> /// <param name="jobType">The job type to query. Could be null if not querying.</param> /// <param name="jobStatus">The job status to query. Could be null if not querying.</param> /// <returns></returns> public virtual IQuery CreateQuery(JobType?jobType, JobStatus?jobStatus) { return(CreateQuery(jobType, jobStatus, null)); }
/// <summary> /// List active and completed jobs for a storage account in a subscription /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='storageAccountName'> /// The name of the storage account where data will be imported to or exported /// from. /// </param> /// <param name='type'> /// Indicates whether this is an import job or an export job. . Possible /// values include: 'Import', 'Export' /// </param> /// <param name='fromParameter'> /// Specifies that only jobs created at the specified time or later should be /// returned. /// </param> /// <param name='to'> /// Specifies that only jobs created at the specified time or earlier should /// be returned. /// </param> /// <param name='states'> /// Optional. Specifies that only jobs whose state matches the specified value /// should be returned. Valid values are Creating, Shipping, Transferring, /// Packaging, and Completed. Values are case-sensitive. To specify multiple /// states, separate values with a comma, without spaces. /// </param> /// <param name='top'> /// An integer value that specifies how many jobs should be returned. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ListJobsResponse> ListJobsAsync(this IStorageImportExportLib operations, string storageAccountName, JobType?type = default(JobType?), string fromParameter = default(string), string to = default(string), string states = default(string), int?top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListJobsWithHttpMessagesAsync(storageAccountName, type, fromParameter, to, states, top, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Get IQuery through which job responses for specified jobType and jobStatus are retrieved page by page, /// and specify page size /// </summary> /// <param name="jobType">The job type to query. Could be null if not querying.</param> /// <param name="jobStatus">The job status to query. Could be null if not querying.</param> /// <param name="pageSize">Number of job responses in a page</param> /// <returns></returns> public abstract IQuery CreateQuery(JobType?jobType, JobStatus?jobStatus, int?pageSize);
/// <summary> /// List active and completed jobs for a storage account in a subscription /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='storageAccountName'> /// The name of the storage account where data will be imported to or exported /// from. /// </param> /// <param name='type'> /// Indicates whether this is an import job or an export job. . Possible /// values include: 'Import', 'Export' /// </param> /// <param name='fromParameter'> /// Specifies that only jobs created at the specified time or later should be /// returned. /// </param> /// <param name='to'> /// Specifies that only jobs created at the specified time or earlier should /// be returned. /// </param> /// <param name='states'> /// Optional. Specifies that only jobs whose state matches the specified value /// should be returned. Valid values are Creating, Shipping, Transferring, /// Packaging, and Completed. Values are case-sensitive. To specify multiple /// states, separate values with a comma, without spaces. /// </param> /// <param name='top'> /// An integer value that specifies how many jobs should be returned. /// </param> public static ListJobsResponse ListJobs(this IStorageImportExportLib operations, string storageAccountName, JobType?type = default(JobType?), string fromParameter = default(string), string to = default(string), string states = default(string), int?top = default(int?)) { return(Task.Factory.StartNew(s => ((IStorageImportExportLib)s).ListJobsAsync(storageAccountName, type, fromParameter, to, states, top), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }