public EventMetadataResolver(IAuthenticatedApi api, Func <double, double> analysisDurationSeconds, int parallelism) { this.AnalysisDurationSeconds = analysisDurationSeconds; this.audioRecordingService = new AudioRecordingService(api); this.acousticEventService = new AcousticEventService(api); this.maxDegreeOfParallelism = parallelism; }
public void Initialize() { this.authenticatedApi = AuthenticatedApi.Merge(Api.Default, "dummy", "dummyToken"); this.preparer = new RemoteSourcePreparer(this.authenticatedApi); this.settings = new AnalysisSettings(); this.audioRecording = AudioRecordingFactory.Create(); this.audioRecording.DurationSeconds = 240.113; }
public AuthenticatedApiTests() { _fakeHttpMessageHandler = new FakeHttpMessageHandler(); _httpClient = new HttpClient(_fakeHttpMessageHandler, true); var apiClient = new AuthenticatedApiClient(Options.Create(new ExmoOptions { PublicKey = string.Empty, SecretKey = string.Empty }), _httpClient); _authenticatedApi = new AuthenticatedApi(apiClient); }
/// <summary> /// Perform a request to an API and get a response back. /// </summary> /// <param name="api">The API to call.</param> /// <param name="request">The request to pass to the API.</param> /// <typeparam name="TReq">The API request type.</typeparam> /// <typeparam name="TRes">The API response type.</typeparam> /// <returns>A deserialized API response.</returns> public async Task <TRes> PerformApiRequestAsync <TReq, TRes>(IAuthenticatedApi <TReq, TRes> api, TReq request) where TReq : IRestRequest where TRes : IResponse { var client = GetHttpClient(); var req = request.ToHttpRequestMessage(api.ResourceUrl); foreach (var header in token.Headers) { req.Headers.Add(header.Name, header.Value); } var response = await client.SendAsync(req); return(await HandleResponseAsync <TRes>(response)); }
protected Service(IAuthenticatedApi authenticatedApi) : this((IApi)authenticatedApi) { this.AuthenticatedApi = authenticatedApi; AddAuthTokenHeader(this.HttpClient.DefaultRequestHeaders, authenticatedApi.Token); }
public RemoteSourcePreparer(IAuthenticatedApi authenticatedApi, bool allowSegmentcutting = true) { this.allowSegmentcutting = allowSegmentcutting; this.mediaService = new MediaService(authenticatedApi); }
public MediaService(IAuthenticatedApi authenticatedApi) : base(authenticatedApi) { }
public AcousticEventService(IAuthenticatedApi api) : base(api) { }
public AudioRecordingService(IAuthenticatedApi authenticatedApi) : base(authenticatedApi) { }