/// <summary> /// For args.Limit see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit /// For args.SearchCriteria see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-range /// </summary> /// <param name="args">See http://data-connector-api.readthedocs.org/en/latest/before-you-start.html for guidance</param> /// <param name="properties"></param> /// <returns></returns> public async Task <IEnumerable <MediaUser> > GetMediaForUsersAsync(MediaForUsersArgs args, DataConnectorProperties properties) { /* * Note for Integration Engineer: * * It is crucial that you incorporate and honour the args.Limit property. Please let Coach dictate how many recordings it needs. * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit * It is also crucial you implement a filter on a date range. Without a date filter you will always return the same set of recordings * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-rang */ var result = new List <MediaUser>(); MediaForUserArgs userArgs = CreateMediaForUserArgs(args); foreach (var userId in args.UserIds) { IEnumerable <Media> media = await this.GetMediaForUserAsync(userId, userArgs, properties); IEnumerable <MediaUser> mediaUsers = media.Select(x => new MediaUser { MediaId = x.Id, RecorderUserId = x.RecorderUserId }).ToList(); result.AddRange(mediaUsers); media.ToList().Clear(); mediaUsers.ToList().Clear(); } return(result); }
public async Task<IEnumerable<Media>> PostAsync(string userId, MediaForUserArgs args) { var client = NinjectWebCommon.Kernel.Get<IRecorderApiFacade>(); try { return await client.GetMediaForUserAsync(userId, args, this.GetDataConnectorProperties()); } catch (Exception ex) { Trace.TraceError("connector : [{0}]", ex.Message); } return await Task.FromResult(new List<Media>()); }
public async Task <IEnumerable <Media> > PostAsync(string userId, MediaForUserArgs args) { var client = NinjectWebCommon.Kernel.Get <IRecorderApiFacade>(); try { return(await client.GetMediaForUserAsync(userId, args, this.GetDataConnectorProperties())); } catch (Exception ex) { Trace.TraceError("connector : [{0}]", ex.Message); } return(await Task.FromResult(new List <Media>())); }
/// <summary> /// For args.Limit see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit /// For args.SearchCriteria see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-range /// </summary> /// <param name="userId"></param> /// <param name="args">See http://data-connector-api.readthedocs.org/en/latest/before-you-start.html for guidance</param> /// <param name="properties"></param> /// <returns></returns> public async Task <IEnumerable <Media> > GetMediaForUserAsync(string userId, MediaForUserArgs args, DataConnectorProperties properties) { /* * Note for Integration Engineer: * * It is crucial that you incorporate and honour the args.Limit property. Please let Coach dictate how many recordings it needs. * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit * It is also crucial you implement a filter on a date range. Without a date filter you will always return the same set of recordings * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-rang */ int recordingsProcessedSoFar = 0; var list = new List <Media>(); PurgeOldRecordings(); for (var i = 0; i < 1000; i++) { var media = new Media { RecorderUserId = userId, Id = Guid.NewGuid().ToString(), // i.ToString(), Date = DateTime.Now.AddDays(-1), Metadata = "{ \"metadata\" : [{\"label\" : \"Claim No\", \"value\" : \"123456\", \"field\" : \"claim_no\", \"type\" : \"number\"},{\"label\" : \"Caller Id\", \"value\" : \"004401232312311\", \"field\" : \"caller_id\", \"type\" : \"number\" }, {\"label\" : \"Account No\", \"value\" : \"12121231314AB\", \"field\" : \"account_no\", \"type\" : \"string\" }, {\"label\" : \"A really long label description\", \"value\" : \"A really long piece of call metadata information 1234567890 1234567890\", \"field\" : \"notes\", \"type\" : \"string\" }] }", FileName = ConvertAgentIdToMediaFile(userId) }; _agentRecordingsLookup.Add(new AgentRecordingLookup(userId, media.Id, media.FileName)); list.Add(media); recordingsProcessedSoFar++; if (recordingsProcessedSoFar > args.Limit) { break; } } return(await Task.FromResult(list));; }
/// <summary> /// For args.Limit see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit /// For args.SearchCriteria see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-range /// </summary> /// <param name="userId"></param> /// <param name="args">See http://data-connector-api.readthedocs.org/en/latest/before-you-start.html for guidance</param> /// <param name="properties"></param> /// <returns></returns> public async Task<IEnumerable<Media>> GetMediaForUserAsync(string userId, MediaForUserArgs args, DataConnectorProperties properties) { /* * Note for Integration Engineer: * * It is crucial that you incorporate and honour the args.Limit property. Please let Coach dictate how many recordings it needs. * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#limit * It is also crucial you implement a filter on a date range. Without a date filter you will always return the same set of recordings * - see http://data-connector-api.readthedocs.org/en/latest/before-you-start.html#date-rang */ int recordingsProcessedSoFar = 0; var list = new List<Media>(); PurgeOldRecordings(); for (var i = 0; i < 1000; i++) { var media = new Media { RecorderUserId = userId, Id = Guid.NewGuid().ToString(), // i.ToString(), Date = DateTime.Now.AddDays(-1), Metadata = "{ \"metadata\" : [{\"label\" : \"Claim No\", \"value\" : \"123456\", \"field\" : \"claim_no\", \"type\" : \"number\"},{\"label\" : \"Caller Id\", \"value\" : \"004401232312311\", \"field\" : \"caller_id\", \"type\" : \"number\" }, {\"label\" : \"Account No\", \"value\" : \"12121231314AB\", \"field\" : \"account_no\", \"type\" : \"string\" }, {\"label\" : \"A really long label description\", \"value\" : \"A really long piece of call metadata information 1234567890 1234567890\", \"field\" : \"notes\", \"type\" : \"string\" }] }", FileName = ConvertAgentIdToMediaFile(userId) }; _agentRecordingsLookup.Add(new AgentRecordingLookup(userId, media.Id, media.FileName)); list.Add(media); recordingsProcessedSoFar++; if (recordingsProcessedSoFar > args.Limit) break; } return await Task.FromResult(list); ; }