/// <summary> /// Convert to service model /// </summary> /// <returns></returns> public static JobRequestModel ToServiceModel( this JobRequestApiModel model) { if (model == null) { return(null); } return(new JobRequestModel { Capabilities = model.Capabilities? .ToDictionary(k => k.Key, v => v.Value) }); }
public async Task <JobProcessingInstructionApiModel> GetAvailableJobAsync( string workerId, [FromBody] JobRequestApiModel request) { if (string.IsNullOrEmpty(workerId)) { throw new ArgumentNullException(nameof(workerId)); } if (request == null) { throw new ArgumentNullException(nameof(request)); } var job = await _orchestrator.GetAvailableJobAsync( workerId, request.ToServiceModel()); return(job.ToApiModel()); }