Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ public partial interface ISimliClient
/// </summary>
/// <param name="destination"></param>
/// <param name="file"></param>
/// <returns>The response metadata and an unbuffered body stream. The caller must dispose Body to release the HTTP response.</returns>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Simli.AutoSDKHttpResponse<global::System.IO.Stream>> GetCachedVideoMp4StaticMp4MachineIPFileGetAsStreamAsResponseAsync(
string destination,
string file,
global::Simli.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Get MP4 of Generated Video
/// </summary>
/// <param name="destination"></param>
/// <param name="file"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ public partial interface ISimliClient
/// </summary>
/// <param name="destination"></param>
/// <param name="file"></param>
/// <returns>The response metadata and an unbuffered body stream. The caller must dispose Body to release the HTTP response.</returns>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Simli.AutoSDKHttpResponse<global::System.IO.Stream>> GetCachedVideoStaticHlsMachineIPFileGetAsStreamAsResponseAsync(
string destination,
string file,
global::Simli.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Get HLS Segment<br/>
/// Get HLS Stream of Generated Video
/// </summary>
/// <param name="destination"></param>
/// <param name="file"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ public partial interface ISimliClient
/// Default Value: false
/// </param>
/// <param name="request"></param>
/// <returns>The response metadata and an unbuffered body stream. The caller must dispose Body to release the HTTP response.</returns>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Simli.AutoSDKHttpResponse<global::System.IO.Stream>> PreprocessImageFacesTrinityPreprocessPostAsStreamAsResponseAsync(

global::Simli.BodyPreprocessImageFacesTrinityPreprocessPost request,
global::Simli.TrinityVersion? gsVersion = default,
bool? retry = default,
global::Simli.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Preprocess Trinity Face Image<br/>
/// Reframes a portrait to the framing its generation expects, and returns the reframed PNG. GSA_1.0: the head centred with equal padding above and below, squared to the camera, on a simplified version of the image's own background. GSA_2.0: the person waist-up, with the torso and both hands, on the image's own background. Either way, the image needs someone facing the camera.
/// </summary>
/// <param name="gsVersion">
/// Default Value: GSA_1.0
/// </param>
/// <param name="retry">
/// Default Value: false
/// </param>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
Expand Down Expand Up @@ -162,6 +184,33 @@ public partial interface ISimliClient
/// <param name="imagename">
/// JPEG, PNG or WEBP, under 5MB, at least 512x512. It must contain a person facing the camera whose head is at least 15% of the image height - a head smaller than that carries too few pixels to keep the likeness, and is rejected. Where several people are present, the largest camera-facing head is treated as the subject.
/// </param>
/// <returns>The response metadata and an unbuffered body stream. The caller must dispose Body to release the HTTP response.</returns>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Simli.AutoSDKHttpResponse<global::System.IO.Stream>> PreprocessImageFacesTrinityPreprocessPostAsStreamAsResponseAsync(
global::System.IO.Stream image,
string imagename,
global::Simli.TrinityVersion? gsVersion = default,
bool? retry = default,
global::Simli.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Preprocess Trinity Face Image<br/>
/// Reframes a portrait to the framing its generation expects, and returns the reframed PNG. GSA_1.0: the head centred with equal padding above and below, squared to the camera, on a simplified version of the image's own background. GSA_2.0: the person waist-up, with the torso and both hands, on the image's own background. Either way, the image needs someone facing the camera.
/// </summary>
/// <param name="gsVersion">
/// Default Value: GSA_1.0
/// </param>
/// <param name="retry">
/// Default Value: false
/// </param>
/// <param name="image">
/// JPEG, PNG or WEBP, under 5MB, at least 512x512. It must contain a person facing the camera whose head is at least 15% of the image height - a head smaller than that carries too few pixels to keep the likeness, and is rejected. Where several people are present, the largest camera-facing head is treated as the subject.
/// </param>
/// <param name="imagename">
/// JPEG, PNG or WEBP, under 5MB, at least 512x512. It must contain a person facing the camera whose head is at least 15% of the image height - a head smaller than that carries too few pixels to keep the likeness, and is rejected. Where several people are present, the largest camera-facing head is treated as the subject.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Simli.ApiException"></exception>
Expand Down
66 changes: 44 additions & 22 deletions src/libs/Simli/Generated/Simli.ResponseStream.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal sealed class ResponseStream : global::System.IO.Stream
{
private readonly global::System.Net.Http.HttpResponseMessage _response;
private readonly global::System.IO.Stream _stream;
private bool _disposed;
private int _disposed;

public ResponseStream(
global::System.Net.Http.HttpResponseMessage response,
Expand Down Expand Up @@ -47,21 +47,51 @@ public override int WriteTimeout
global::System.Threading.CancellationToken cancellationToken) =>
_stream.FlushAsync(cancellationToken);

public override int Read(byte[] buffer, int offset, int count) =>
_stream.Read(buffer, offset, count);
public override int Read(byte[] buffer, int offset, int count)
{
try
{
return _stream.Read(buffer, offset, count);
}
catch
{
Dispose();
throw;
}
}

public override global::System.Threading.Tasks.Task<int> ReadAsync(
public override async global::System.Threading.Tasks.Task<int> ReadAsync(
byte[] buffer,
int offset,
int count,
global::System.Threading.CancellationToken cancellationToken) =>
_stream.ReadAsync(buffer, offset, count, cancellationToken);
global::System.Threading.CancellationToken cancellationToken)
{
try
{
return await _stream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
}
catch
{
Dispose();
throw;
}
}

#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER || NET5_0_OR_GREATER
public override global::System.Threading.Tasks.ValueTask<int> ReadAsync(
public override async global::System.Threading.Tasks.ValueTask<int> ReadAsync(
global::System.Memory<byte> buffer,
global::System.Threading.CancellationToken cancellationToken = default) =>
_stream.ReadAsync(buffer, cancellationToken);
global::System.Threading.CancellationToken cancellationToken = default)
{
try
{
return await _stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
}
catch
{
Dispose();
throw;
}
}
#endif

public override long Seek(long offset, global::System.IO.SeekOrigin origin) =>
Expand Down Expand Up @@ -89,28 +119,20 @@ public override void Write(byte[] buffer, int offset, int count) =>

protected override void Dispose(bool disposing)
{
if (!_disposed && disposing)
if (disposing && global::System.Threading.Interlocked.Exchange(ref _disposed, 1) == 0)
{
_disposed = true;
_stream.Dispose();
// The response content owns the underlying stream; disposing both would close it twice.
_response.Dispose();
}

base.Dispose(disposing);
}

#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER || NET5_0_OR_GREATER
public override async global::System.Threading.Tasks.ValueTask DisposeAsync()
public override global::System.Threading.Tasks.ValueTask DisposeAsync()
{
if (_disposed)
{
return;
}

_disposed = true;
await _stream.DisposeAsync().ConfigureAwait(false);
_response.Dispose();
await base.DisposeAsync().ConfigureAwait(false);
Dispose();
return default;
}
#endif
}
Expand Down
Loading
Loading