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

Add binary request example #1865

Merged
merged 4 commits into from
Nov 1, 2024
Merged

Add binary request example #1865

merged 4 commits into from
Nov 1, 2024

Conversation

heaths
Copy link
Member

@heaths heaths commented Oct 23, 2024

Also refactors FileStream from azure_core to typespec_client_core, plus some trait implementations on necessary request structures to make it all work.

@heaths
Copy link
Member Author

heaths commented Oct 23, 2024

I need to play around with this some. Track 1 didn't have a fully asynchronous answer either. I'm thinking the answer is to convert from a Body to RequestContent<T>, and add support for Stream into Body. We have a tokio-based FileStream already that I need to migrate to typespec_client_core (if necessary; might be outdated, actually).

Basically, it'd go:

let file_stream = FileStream::new(tokio::fs::File::open("data.bin")?);
let body: Body = file_stream.into();
client.put_data(&ctx, body, None).await?;

/cc @analogrelay @demoray @cataggar

Also refactors `FileStream` from `azure_core` to `typespec_client_core`, plus some trait implementations on necessary request structures to make it all work.
@heaths heaths changed the title Add binary data request example Add binary request example Oct 23, 2024
@heaths heaths marked this pull request as ready for review October 23, 2024 22:29
@heaths heaths enabled auto-merge (squash) November 1, 2024 00:06
@heaths heaths merged commit 1f5ed78 into Azure:main Nov 1, 2024
15 of 26 checks passed
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.

4 participants