blazzy / podman-rest-client

MIT License
6 stars 1 forks source link

Image pull API fails. v0.9.0 when quiet is false #8

Closed beckend closed 3 months ago

beckend commented 4 months ago
let client = ...;

client
    .images_api()
    .image_pull_libpod(
      Some(&name_image),
      Some(false),
      None,
      None,
      None,
      None,
      None,
      None,
      None,
      None,
    )
    .await
    .map_err(|err| eyre!("Failed to pull image: {name_image} - {err:?}"))?;
?;
Error: Failed to pull image: mirror.gcr.io/mccutchen/go-httpbin:latest - Serde(Error("trailing characters", line: 2, column: 1))
beckend commented 4 months ago

quiet flag = Some(true) works. when false, throws this error.

beckend commented 4 months ago

Most likely because silent false is a streaming response, giving a lot of progress data.

blazzy commented 4 months ago

Makes sense. The only response types supported by the rust code generator at the moment are complete json encoded strings.

blazzy commented 4 months ago

I'm surprised this was the default behavior.

Maybe the right thing to do for now is to hack the generated code to remove the quiet option for the user and pass true through in the underlying request.

beckend commented 4 months ago

Or just leave it be and make the user aware of it, it would more ideal to have some workaround where the API client is called manually to the endpoint and handle the stream.