Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(voice): Fixed response types on file downloads #864

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

dragonmantank
Copy link
Contributor

Description

Fixed the response type expectations when downloading recordings and transcriptions.

This also adds a downloadTranscription() method to voice to make it easier to download transcriptions.

Motivation and Context

By default, the server-client clients expect a response in JSON. This is fine for API calls as we almost always expect JSON responses, but voice recordings and transcriptions should be treated as buffers instead. This change lets recordings be downloaded using res.buffer() and transcripts be downloaded using res.text() decoding.

Note that the FileClient by itself could have worked directly by overriding the config option as "text" since text just act like a generic buffer, but adding a stream response type is semantically more clear.

Testing Details

Manual testing

Example Output or Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Merging #864 (445400e) into 3.x (3f94c41) will decrease coverage by 0.46%.
The diff coverage is 16.66%.

@@            Coverage Diff             @@
##              3.x     #864      +/-   ##
==========================================
- Coverage   84.33%   83.87%   -0.46%     
==========================================
  Files         121      121              
  Lines        1609     1619      +10     
  Branches      310      311       +1     
==========================================
+ Hits         1357     1358       +1     
- Misses        251      260       +9     
  Partials        1        1              
Files Changed Coverage Δ
packages/vetch/lib/vetch.ts 92.50% <0.00%> (-2.38%) ⬇️
packages/voice/lib/voice.ts 82.89% <0.00%> (-8.41%) ⬇️
packages/server-client/lib/client.ts 98.48% <100.00%> (+0.02%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dragonmantank dragonmantank merged commit 0446638 into 3.x Sep 8, 2023
11 checks passed
@dragonmantank dragonmantank deleted the fix-download-files branch September 8, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants