Exemple #1
0
 public OcrTextSnippet(string title, IEnumerable<Tuple<string, Bitmap>> transcriptions) : base(title, "")
 {
     foreach (var (content, bitmap) in transcriptions)
     {
         Transcriptions.Add(new Tuple<string, string>(content, BitmapToBase64Converter.Convert(bitmap)));
     }
 }
        /// <summary>
        /// The file HATEOAS link has the appropriate URI for downloading a text file for the transcription.
        /// The file is accessible only if you provide the correct API access key for your account and the transcription is for a recording/leg/call in your account.
        /// </summary>
        /// <param name="callId">The unique ID of a call generated upon creation.</param>
        /// <param name="legId">The unique ID of a leg generated upon creation.</param>
        /// <param name="recordingId">The unique ID of a recording generated upon creation.</param>
        /// <param name="transcriptionId">The unique ID of a transcription generated upon creation.</param>
        public Stream DownloadTranscription(string callId, string legId, string recordingId, string transcriptionId)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");
            ParameterValidator.IsNotNullOrWhiteSpace(transcriptionId, "transcriptionId");

            var resource = new Transcriptions(new Transcription {
                CallId = callId, LegId = legId, RecordingId = recordingId, Id = transcriptionId
            });

            return(restClient.PerformHttpRequest(resource.DownloadUri, HttpStatusCode.OK, resource.BaseUrl));
        }
        /// <summary>
        /// This request retrieves a transcription resource. The parameters are the unique ID of the transcription, the recording, the leg and the call with which the transcription is associated.
        /// If successful, this request returns an object with a data property, which is an array that has a single transcription object.
        /// If the request failed, an error object will be returned.
        /// </summary>
        /// <param name="callId">The unique ID of a call generated upon creation.</param>
        /// <param name="legId">The unique ID of a leg generated upon creation.</param>
        /// <param name="recordingId">The unique ID of a recording generated upon creation.</param>
        /// /// <param name="transcriptionId">The unique ID of a transcription generated upon creation.</param>
        /// <returns>VoiceResponse -Recording-</returns>
        public VoiceResponse <Transcription> ViewTranscription(string callId, string legId, string recordingId, string transcriptionId)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");
            ParameterValidator.IsNotNullOrWhiteSpace(transcriptionId, "transcriptionId");

            var resource = new Transcriptions(new Transcription {
                CallId = callId, LegId = legId, RecordingId = recordingId, Id = transcriptionId
            });
            var result = restClient.Retrieve(resource);

            return((VoiceResponse <Transcription>)result.Object);
        }
        /// <summary>
        /// This request creates a transcription.
        /// </summary>
        /// <param name="callId">The unique ID of a call generated upon creation.</param>
        /// <param name="legId">The unique ID of a leg generated upon creation.</param>
        /// <param name="recordingId">The unique ID of a recording generated upon creation.</param>
        /// <param name="language">The language of the recording that is to be transcribed.</param>
        /// <returns>If successful, this request will return an object with a data property, which is an array that has a single transcription object. If the request failed, an error object will be returned.</returns>
        public VoiceResponse <Transcription> CreateTranscription(string callId, string legId, string recordingId, string language)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");
            ParameterValidator.IsNotNullOrWhiteSpace(language, "language");

            var resource = new Transcriptions(new Transcription {
                CallId = callId, LegId = legId, RecordingId = recordingId, Language = language
            });
            var result = restClient.Create(resource);

            return((VoiceResponse <Transcription>)result.Object);
        }