From 363388043f5fff27aa59e97f94219edfd2840672 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 22 Oct 2026 21:16:59 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ....AudioToVideoInterfaceStaticAudioPost.g.cs | 8 + ...nt.DeleteAssetAssetsKindAssetIdDelete.g.cs | 36 + ....ISimliClient.ListAssetsAssetsKindGet.g.cs | 32 + ...rtAudioToVideoSessionComposeTokenPost.g.cs | 8 + ...SimliClient.UploadAssetAssetsKindPost.g.cs | 99 + .../Simli.JsonConverters.AssetKind.g.cs | 53 + ...imli.JsonConverters.AssetKindNullable.g.cs | 60 + .../Simli.JsonConverters.ListedAsset.g.cs | 116 ++ .../Simli.JsonSerializerContext.g.cs | 14 + .../Simli.JsonSerializerContextTypes.g.cs | 74 +- .../Generated/Simli.Models.Asset.Json.g.cs | 141 ++ .../Simli/Generated/Simli.Models.Asset.g.cs | 103 + .../Generated/Simli.Models.AssetKind.g.cs | 51 + ...VideoInterfaceStaticAudioPostResponse.g.cs | 4 +- .../Simli.Models.AudioToVideoRequest.g.cs | 24 +- ...ls.BodyUploadAssetAssetsKindPost.Json.g.cs | 141 ++ ....Models.BodyUploadAssetAssetsKindPost.g.cs | 59 + ...mli.Models.ConfigurableSessionRequest.g.cs | 24 +- ...ecatSessionTokenAutoTokenPostResponse.g.cs | 4 +- .../Generated/Simli.Models.GoogleModels.g.cs | 22 +- .../Simli.Models.ListedAsset.Json.g.cs | 141 ++ .../Generated/Simli.Models.ListedAsset.g.cs | 295 +++ ...Simli.Models.ListedAssetVariant2.Json.g.cs | 141 ++ .../Simli.Models.ListedAssetVariant2.g.cs | 58 + .../Simli.Models.SessionDetails.g.cs | 4 +- ...oVideoSessionComposeTokenPostResponse.g.cs | 4 +- ...i.Models.StartStreamingSessionRequest.g.cs | 24 +- .../Generated/Simli.Models.TokenRequest.g.cs | 24 +- ....AudioToVideoInterfaceStaticAudioPost.g.cs | 10 + ...nt.DeleteAssetAssetsKindAssetIdDelete.g.cs | 513 +++++ ...i.SimliClient.ListAssetsAssetsKindGet.g.cs | 495 +++++ ...rtAudioToVideoSessionComposeTokenPost.g.cs | 10 + ...SimliClient.UploadAssetAssetsKindPost.g.cs | 1841 +++++++++++++++++ src/libs/Simli/asyncapi.yaml | 83 + src/libs/Simli/openapi.yaml | 320 ++- 35 files changed, 4975 insertions(+), 61 deletions(-) create mode 100644 src/libs/Simli/Generated/Simli.ISimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs create mode 100644 src/libs/Simli/Generated/Simli.ISimliClient.ListAssetsAssetsKindGet.g.cs create mode 100644 src/libs/Simli/Generated/Simli.ISimliClient.UploadAssetAssetsKindPost.g.cs create mode 100644 src/libs/Simli/Generated/Simli.JsonConverters.AssetKind.g.cs create mode 100644 src/libs/Simli/Generated/Simli.JsonConverters.AssetKindNullable.g.cs create mode 100644 src/libs/Simli/Generated/Simli.JsonConverters.ListedAsset.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.Asset.Json.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.Asset.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.AssetKind.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.Json.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.ListedAsset.Json.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.ListedAsset.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.Json.g.cs create mode 100644 src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.g.cs create mode 100644 src/libs/Simli/Generated/Simli.SimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs create mode 100644 src/libs/Simli/Generated/Simli.SimliClient.ListAssetsAssetsKindGet.g.cs create mode 100644 src/libs/Simli/Generated/Simli.SimliClient.UploadAssetAssetsKindPost.g.cs diff --git a/src/libs/Simli/Generated/Simli.ISimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs b/src/libs/Simli/Generated/Simli.ISimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs index 6d1144d..30a47ef 100644 --- a/src/libs/Simli/Generated/Simli.ISimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs +++ b/src/libs/Simli/Generated/Simli.ISimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs @@ -69,6 +69,12 @@ public partial interface ISimliClient /// /// The camera the video starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the video uses the avatar's own. An image is not accepted: upload it first. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -85,6 +91,8 @@ public partial interface ISimliClient double? avatarPositionX = default, double? avatarPositionY = default, global::Simli.CameraSetting? camera = default, + global::System.Guid? backgroundId = default, + global::System.Guid? foregroundId = default, global::Simli.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Simli/Generated/Simli.ISimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs b/src/libs/Simli/Generated/Simli.ISimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs new file mode 100644 index 0000000..09b506b --- /dev/null +++ b/src/libs/Simli/Generated/Simli.ISimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Simli +{ + public partial interface ISimliClient + { + /// + /// Delete a Background or Foreground
+ /// Deletes one of your uploaded backgrounds or foregrounds. This can not be undone. A token or agent that names it starts with the avatar's own instead. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAssetAssetsKindAssetIdDeleteAsync( + global::Simli.AssetKind kind, + global::System.Guid id, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a Background or Foreground
+ /// Deletes one of your uploaded backgrounds or foregrounds. This can not be undone. A token or agent that names it starts with the avatar's own instead. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAssetAssetsKindAssetIdDeleteAsResponseAsync( + global::Simli.AssetKind kind, + global::System.Guid id, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.ISimliClient.ListAssetsAssetsKindGet.g.cs b/src/libs/Simli/Generated/Simli.ISimliClient.ListAssetsAssetsKindGet.g.cs new file mode 100644 index 0000000..91f778d --- /dev/null +++ b/src/libs/Simli/Generated/Simli.ISimliClient.ListAssetsAssetsKindGet.g.cs @@ -0,0 +1,32 @@ +#nullable enable + +namespace Simli +{ + public partial interface ISimliClient + { + /// + /// List Backgrounds or Foregrounds
+ /// Your uploaded backgrounds or foregrounds, newest first, each with a signed URL that reads the image (a PNG) until url_expires_at, an hour on. Anyone holding the URL can read that one image until then, so keep it to your own app. List again for fresh URLs. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListAssetsAssetsKindGetAsync( + global::Simli.AssetKind kind, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Backgrounds or Foregrounds
+ /// Your uploaded backgrounds or foregrounds, newest first, each with a signed URL that reads the image (a PNG) until url_expires_at, an hour on. Anyone holding the URL can read that one image until then, so keep it to your own app. List again for fresh URLs. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ListAssetsAssetsKindGetAsResponseAsync( + global::Simli.AssetKind kind, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.ISimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs b/src/libs/Simli/Generated/Simli.ISimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs index 296c34e..d0823ab 100644 --- a/src/libs/Simli/Generated/Simli.ISimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs +++ b/src/libs/Simli/Generated/Simli.ISimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs @@ -73,6 +73,12 @@ public partial interface ISimliClient /// /// The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. A streaming session can change it afterwards with BG_ messages. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. A streaming session can change it afterwards with FG_ messages. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -90,6 +96,8 @@ public partial interface ISimliClient double? avatarPositionX = default, double? avatarPositionY = default, global::Simli.CameraSetting? camera = default, + global::System.Guid? backgroundId = default, + global::System.Guid? foregroundId = default, global::Simli.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Simli/Generated/Simli.ISimliClient.UploadAssetAssetsKindPost.g.cs b/src/libs/Simli/Generated/Simli.ISimliClient.UploadAssetAssetsKindPost.g.cs new file mode 100644 index 0000000..734a2a0 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.ISimliClient.UploadAssetAssetsKindPost.g.cs @@ -0,0 +1,99 @@ +#nullable enable + +namespace Simli +{ + public partial interface ISimliClient + { + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + + global::Simli.BodyUploadAssetAssetsKindPost request, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadAssetAssetsKindPostAsResponseAsync( + global::Simli.AssetKind kind, + + global::Simli.BodyUploadAssetAssetsKindPost request, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + byte[] image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + global::System.IO.Stream image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadAssetAssetsKindPostAsResponseAsync( + global::Simli.AssetKind kind, + global::System.IO.Stream image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.JsonConverters.AssetKind.g.cs b/src/libs/Simli/Generated/Simli.JsonConverters.AssetKind.g.cs new file mode 100644 index 0000000..7e80968 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.JsonConverters.AssetKind.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Simli.JsonConverters +{ + /// + public sealed class AssetKindJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Simli.AssetKind Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Simli.AssetKindExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Simli.AssetKind)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Simli.AssetKind); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Simli.AssetKind value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Simli.AssetKindExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.JsonConverters.AssetKindNullable.g.cs b/src/libs/Simli/Generated/Simli.JsonConverters.AssetKindNullable.g.cs new file mode 100644 index 0000000..541fdf2 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.JsonConverters.AssetKindNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Simli.JsonConverters +{ + /// + public sealed class AssetKindNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Simli.AssetKind? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Simli.AssetKindExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Simli.AssetKind)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Simli.AssetKind?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Simli.AssetKind? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Simli.AssetKindExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Simli/Generated/Simli.JsonConverters.ListedAsset.g.cs b/src/libs/Simli/Generated/Simli.JsonConverters.ListedAsset.g.cs new file mode 100644 index 0000000..f7b3205 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.JsonConverters.ListedAsset.g.cs @@ -0,0 +1,116 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Simli.JsonConverters +{ + /// + public class ListedAssetJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Simli.ListedAsset Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); + var __rawJson = __jsonDocument.RootElement.GetRawText(); + + global::Simli.Asset? asset = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Simli.Asset), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Simli.Asset).Name}"); + asset = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { + } + catch (global::System.ArgumentOutOfRangeException __enumTokenException) when (__enumTokenException.ParamName == "reader") + { + // Legacy enum converters signal an incompatible JSON token with this exception. + } + + global::Simli.ListedAssetVariant2? listedAssetVariant2 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Simli.ListedAssetVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Simli.ListedAssetVariant2).Name}"); + listedAssetVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { + } + catch (global::System.ArgumentOutOfRangeException __enumTokenException) when (__enumTokenException.ParamName == "reader") + { + // Legacy enum converters signal an incompatible JSON token with this exception. + } + var __value = new global::Simli.ListedAsset( + asset, + + listedAssetVariant2 + ); + + return __value; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Simli.ListedAsset value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); + if (value.IsAsset) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Simli.Asset), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Simli.Asset).Name}"); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickAsset(), typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } + } + if (value.IsListedAssetVariant2) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Simli.ListedAssetVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Simli.ListedAssetVariant2).Name}"); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickListedAssetVariant2(), typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } + } + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.JsonSerializerContext.g.cs b/src/libs/Simli/Generated/Simli.JsonSerializerContext.g.cs index 8b4fecc..40b80e8 100644 --- a/src/libs/Simli/Generated/Simli.JsonSerializerContext.g.cs +++ b/src/libs/Simli/Generated/Simli.JsonSerializerContext.g.cs @@ -67,6 +67,10 @@ namespace Simli typeof(global::Simli.JsonConverters.CharacterVersionNullableJsonConverter), + typeof(global::Simli.JsonConverters.AssetKindJsonConverter), + + typeof(global::Simli.JsonConverters.AssetKindNullableJsonConverter), + typeof(global::Simli.JsonConverters.TrinityGenerationStateJsonConverter), typeof(global::Simli.JsonConverters.TrinityGenerationStateNullableJsonConverter), @@ -75,6 +79,8 @@ namespace Simli typeof(global::Simli.JsonConverters.TrinityVersionNullableJsonConverter), + typeof(global::Simli.JsonConverters.ListedAssetJsonConverter), + typeof(global::Simli.JsonConverters.AnyOfJsonConverter), typeof(global::Simli.JsonConverters.AnyOfJsonConverter), @@ -133,6 +139,12 @@ namespace Simli [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.CharacterVersion), TypeInfoPropertyName = "CharacterVersion2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.BodyEnqueueGSAGenerationFacesGsCreatePost))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.BodyPreprocessImageFacesTrinityPreprocessPost))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.AssetKind), TypeInfoPropertyName = "AssetKind2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.Asset))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(long))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.ListedAsset), TypeInfoPropertyName = "ListedAsset2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.ListedAssetVariant2))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.BodyUploadAssetAssetsKindPost))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.TrinityGenerationState), TypeInfoPropertyName = "TrinityGenerationState2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.TrinityGeneration))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.TrinityGenerationStatus))] @@ -146,6 +158,7 @@ namespace Simli [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.AudioToVideoInterfaceStaticAudioPostResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.EnqueueGSAGenerationFacesGsCreatePostResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.InitIntegrationsLivekitAgentsPostResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Simli.GetHistorySessionsResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] @@ -158,6 +171,7 @@ namespace Simli [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] public sealed partial class SourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext diff --git a/src/libs/Simli/Generated/Simli.JsonSerializerContextTypes.g.cs b/src/libs/Simli/Generated/Simli.JsonSerializerContextTypes.g.cs index 38ea420..b993c7a 100644 --- a/src/libs/Simli/Generated/Simli.JsonSerializerContextTypes.g.cs +++ b/src/libs/Simli/Generated/Simli.JsonSerializerContextTypes.g.cs @@ -229,79 +229,107 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Simli.TrinityGenerationState? Type49 { get; set; } + public global::Simli.AssetKind? Type49 { get; set; } /// /// /// - public global::Simli.TrinityGeneration? Type50 { get; set; } + public global::Simli.Asset? Type50 { get; set; } /// /// /// - public global::Simli.TrinityGenerationStatus? Type51 { get; set; } + public long? Type51 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type52 { get; set; } + public global::Simli.ListedAsset? Type52 { get; set; } /// /// /// - public global::Simli.TrinityVersion? Type53 { get; set; } + public global::Simli.ListedAssetVariant2? Type53 { get; set; } /// /// /// - public float? Type54 { get; set; } + public global::Simli.BodyUploadAssetAssetsKindPost? Type54 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type55 { get; set; } + public global::Simli.TrinityGenerationState? Type55 { get; set; } /// /// /// - public global::Simli.GetIceServersComposeIceGetResponseItem? Type56 { get; set; } + public global::Simli.TrinityGeneration? Type56 { get; set; } /// /// /// - public global::Simli.StartAudioToVideoSessionComposeTokenPostResponse? Type57 { get; set; } + public global::Simli.TrinityGenerationStatus? Type57 { get; set; } /// /// /// - public global::Simli.StartAudioToVideoSessionComposeTokenPostResponse2? Type58 { get; set; } + public global::System.Collections.Generic.IList? Type58 { get; set; } /// /// /// - public global::Simli.AudioToVideoInterfaceStaticAudioPostResponse? Type59 { get; set; } + public global::Simli.TrinityVersion? Type59 { get; set; } /// /// /// - public global::Simli.EnqueueGSAGenerationFacesGsCreatePostResponse? Type60 { get; set; } + public float? Type60 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type61 { get; set; } + public global::System.Collections.Generic.IList? Type61 { get; set; } /// /// /// - public global::Simli.InitIntegrationsLivekitAgentsPostResponse? Type62 { get; set; } + public global::Simli.GetIceServersComposeIceGetResponseItem? Type62 { get; set; } /// /// /// - public global::Simli.GetHistorySessionsResponse? Type63 { get; set; } + public global::Simli.StartAudioToVideoSessionComposeTokenPostResponse? Type63 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type64 { get; set; } + public global::Simli.StartAudioToVideoSessionComposeTokenPostResponse2? Type64 { get; set; } /// /// /// - public global::Simli.GetRatelimiterSessionsResponse? Type65 { get; set; } + public global::Simli.AudioToVideoInterfaceStaticAudioPostResponse? Type65 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type66 { get; set; } + public global::Simli.EnqueueGSAGenerationFacesGsCreatePostResponse? Type66 { get; set; } /// /// /// - public global::Simli.CreatePipecatSessionTokenAutoTokenPostResponse? Type67 { get; set; } + public global::System.Collections.Generic.IList? Type67 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type68 { get; set; } + /// + /// + /// + public global::Simli.InitIntegrationsLivekitAgentsPostResponse? Type69 { get; set; } + /// + /// + /// + public global::Simli.GetHistorySessionsResponse? Type70 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type71 { get; set; } + /// + /// + /// + public global::Simli.GetRatelimiterSessionsResponse? Type72 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type73 { get; set; } + /// + /// + /// + public global::Simli.CreatePipecatSessionTokenAutoTokenPostResponse? Type74 { get; set; } /// /// @@ -330,10 +358,14 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::System.Collections.Generic.List? ListType6 { get; set; } + public global::System.Collections.Generic.List? ListType6 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType7 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType7 { get; set; } + public global::System.Collections.Generic.List? ListType8 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.Models.Asset.Json.g.cs b/src/libs/Simli/Generated/Simli.Models.Asset.Json.g.cs new file mode 100644 index 0000000..432546a --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.Asset.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Simli +{ + public sealed partial class Asset + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Simli.Asset? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Simli.Asset), + jsonSerializerContext) as global::Simli.Asset; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Simli.Asset? FromJson( + string json) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Simli.Asset? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Simli.Asset), + jsonSerializerContext).ConfigureAwait(false)) as global::Simli.Asset; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.Models.Asset.g.cs b/src/libs/Simli/Generated/Simli.Models.Asset.g.cs new file mode 100644 index 0000000..4c89d27 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.Asset.g.cs @@ -0,0 +1,103 @@ + +#nullable enable + +namespace Simli +{ + /// + /// + /// + public sealed partial class Asset + { + /// + /// What background_id / foreground_id and BG_ / FG_ take. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Guid Id { get; set; } + + /// + /// The uploaded file's name. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("width")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Width { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("height")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Height { get; set; } + + /// + /// The stored PNG's size. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("size_bytes")] + [global::System.Text.Json.Serialization.JsonRequired] + public required long SizeBytes { get; set; } + + /// + /// Unix time, in seconds. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int CreatedAt { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// What background_id / foreground_id and BG_ / FG_ take. + /// + /// + /// The uploaded file's name. + /// + /// + /// + /// + /// The stored PNG's size. + /// + /// + /// Unix time, in seconds. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public Asset( + global::System.Guid id, + string name, + int width, + int height, + long sizeBytes, + int createdAt) + { + this.Id = id; + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Width = width; + this.Height = height; + this.SizeBytes = sizeBytes; + this.CreatedAt = createdAt; + } + + /// + /// Initializes a new instance of the class. + /// + public Asset() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.Models.AssetKind.g.cs b/src/libs/Simli/Generated/Simli.Models.AssetKind.g.cs new file mode 100644 index 0000000..f78bddb --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.AssetKind.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Simli +{ + /// + /// + /// + public enum AssetKind + { + /// + /// + /// + Backgrounds, + /// + /// + /// + Foregrounds, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class AssetKindExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this AssetKind value) + { + return value switch + { + AssetKind.Backgrounds => "backgrounds", + AssetKind.Foregrounds => "foregrounds", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static AssetKind? ToEnum(string value) + { + return value switch + { + "backgrounds" => AssetKind.Backgrounds, + "foregrounds" => AssetKind.Foregrounds, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.Models.AudioToVideoInterfaceStaticAudioPostResponse.g.cs b/src/libs/Simli/Generated/Simli.Models.AudioToVideoInterfaceStaticAudioPostResponse.g.cs index a126e35..692dc0a 100644 --- a/src/libs/Simli/Generated/Simli.Models.AudioToVideoInterfaceStaticAudioPostResponse.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.AudioToVideoInterfaceStaticAudioPostResponse.g.cs @@ -23,7 +23,7 @@ public sealed partial class AudioToVideoInterfaceStaticAudioPostResponse public string? Mp4Url { get; set; } /// - /// Camera fields outside their supported range. The video is made with them regardless. + /// Camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The video is made regardless. /// [global::System.Text.Json.Serialization.JsonPropertyName("warnings")] public global::System.Collections.Generic.IList? Warnings { get; set; } @@ -44,7 +44,7 @@ public sealed partial class AudioToVideoInterfaceStaticAudioPostResponse /// Example: https://api.simli.ai/mp4/path-to-file/output.mp4 /// /// - /// Camera fields outside their supported range. The video is made with them regardless. + /// Camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The video is made regardless. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/Simli/Generated/Simli.Models.AudioToVideoRequest.g.cs b/src/libs/Simli/Generated/Simli.Models.AudioToVideoRequest.g.cs index baa6fdd..dd1e194 100644 --- a/src/libs/Simli/Generated/Simli.Models.AudioToVideoRequest.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.AudioToVideoRequest.g.cs @@ -89,6 +89,18 @@ public sealed partial class AudioToVideoRequest [global::System.Text.Json.Serialization.JsonPropertyName("camera")] public global::Simli.CameraSetting? Camera { get; set; } + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the video uses the avatar's own. An image is not accepted: upload it first. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("background_id")] + public global::System.Guid? BackgroundId { get; set; } + + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("foreground_id")] + public global::System.Guid? ForegroundId { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -133,6 +145,12 @@ public sealed partial class AudioToVideoRequest /// /// The camera the video starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the video uses the avatar's own. An image is not accepted: upload it first. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -148,7 +166,9 @@ public AudioToVideoRequest( int? streamingHeight, double? avatarPositionX, double? avatarPositionY, - global::Simli.CameraSetting? camera) + global::Simli.CameraSetting? camera, + global::System.Guid? backgroundId, + global::System.Guid? foregroundId) { this.FaceId = faceId ?? throw new global::System.ArgumentNullException(nameof(faceId)); this.AudioBase64 = audioBase64 ?? throw new global::System.ArgumentNullException(nameof(audioBase64)); @@ -162,6 +182,8 @@ public AudioToVideoRequest( this.AvatarPositionX = avatarPositionX; this.AvatarPositionY = avatarPositionY; this.Camera = camera; + this.BackgroundId = backgroundId; + this.ForegroundId = foregroundId; } /// diff --git a/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.Json.g.cs b/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.Json.g.cs new file mode 100644 index 0000000..505718b --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Simli +{ + public sealed partial class BodyUploadAssetAssetsKindPost + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Simli.BodyUploadAssetAssetsKindPost? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Simli.BodyUploadAssetAssetsKindPost), + jsonSerializerContext) as global::Simli.BodyUploadAssetAssetsKindPost; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Simli.BodyUploadAssetAssetsKindPost? FromJson( + string json) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Simli.BodyUploadAssetAssetsKindPost? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Simli.BodyUploadAssetAssetsKindPost), + jsonSerializerContext).ConfigureAwait(false)) as global::Simli.BodyUploadAssetAssetsKindPost; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.g.cs b/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.g.cs new file mode 100644 index 0000000..9ea9977 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.BodyUploadAssetAssetsKindPost.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Simli +{ + /// + /// + /// + public sealed partial class BodyUploadAssetAssetsKindPost + { + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Image { get; set; } + + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("imagename")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Imagename { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public BodyUploadAssetAssetsKindPost( + byte[] image, + string imagename) + { + this.Image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); + } + + /// + /// Initializes a new instance of the class. + /// + public BodyUploadAssetAssetsKindPost() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.Models.ConfigurableSessionRequest.g.cs b/src/libs/Simli/Generated/Simli.Models.ConfigurableSessionRequest.g.cs index ccc3821..c18852e 100644 --- a/src/libs/Simli/Generated/Simli.Models.ConfigurableSessionRequest.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.ConfigurableSessionRequest.g.cs @@ -141,6 +141,18 @@ public sealed partial class ConfigurableSessionRequest [global::System.Text.Json.Serialization.JsonPropertyName("camera")] public global::Simli.CameraSetting? Camera { get; set; } + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. Your app can change it in the session by sending the room an app message {"type": "simli-background", "id": "<background id>"}. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("background_id")] + public global::System.Guid? BackgroundId { get; set; } + + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. Your app can change it with {"type": "simli-foreground", "id": "<foreground id>"}. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("foreground_id")] + public global::System.Guid? ForegroundId { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -212,6 +224,12 @@ public sealed partial class ConfigurableSessionRequest /// /// The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. Your app can change it in the session by sending the room an app message {"type": "simli-background", "id": "<background id>"}. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. Your app can change it with {"type": "simli-foreground", "id": "<foreground id>"}. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -236,7 +254,9 @@ public ConfigurableSessionRequest( int? streamingHeight, double? avatarPositionX, double? avatarPositionY, - global::Simli.CameraSetting? camera) + global::Simli.CameraSetting? camera, + global::System.Guid? backgroundId, + global::System.Guid? foregroundId) { this.FaceId = faceId; this.TtsProvider = ttsProvider; @@ -259,6 +279,8 @@ public ConfigurableSessionRequest( this.AvatarPositionX = avatarPositionX; this.AvatarPositionY = avatarPositionY; this.Camera = camera; + this.BackgroundId = backgroundId; + this.ForegroundId = foregroundId; } /// diff --git a/src/libs/Simli/Generated/Simli.Models.CreatePipecatSessionTokenAutoTokenPostResponse.g.cs b/src/libs/Simli/Generated/Simli.Models.CreatePipecatSessionTokenAutoTokenPostResponse.g.cs index 1f3d191..e20358d 100644 --- a/src/libs/Simli/Generated/Simli.Models.CreatePipecatSessionTokenAutoTokenPostResponse.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.CreatePipecatSessionTokenAutoTokenPostResponse.g.cs @@ -15,7 +15,7 @@ public sealed partial class CreatePipecatSessionTokenAutoTokenPostResponse public string? SessionToken { get; set; } /// - /// Starting camera fields outside their supported range. The token is minted regardless. + /// Starting camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The token is minted regardless. /// [global::System.Text.Json.Serialization.JsonPropertyName("warnings")] public global::System.Collections.Generic.IList? Warnings { get; set; } @@ -31,7 +31,7 @@ public sealed partial class CreatePipecatSessionTokenAutoTokenPostResponse /// /// /// - /// Starting camera fields outside their supported range. The token is minted regardless. + /// Starting camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The token is minted regardless. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/Simli/Generated/Simli.Models.GoogleModels.g.cs b/src/libs/Simli/Generated/Simli.Models.GoogleModels.g.cs index f01c3f9..171973d 100644 --- a/src/libs/Simli/Generated/Simli.Models.GoogleModels.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.GoogleModels.g.cs @@ -4,22 +4,14 @@ namespace Simli { /// - /// + /// Gemini 2.5 and older are retired: they're still accepted, and run on gemini-3.8-flash. /// public enum GoogleModels { /// - /// + /// they're still accepted, and run on gemini-3.8-flash. /// - Gemini25Flash, - /// - /// - /// - Gemini25FlashLitePreview0617, - /// - /// - /// - Gemini25Pro, + Gemini38Flash, } /// @@ -34,9 +26,7 @@ public static string ToValueString(this GoogleModels value) { return value switch { - GoogleModels.Gemini25Flash => "gemini-2.5-flash", - GoogleModels.Gemini25FlashLitePreview0617 => "gemini-2.5-flash-lite-preview-06-17", - GoogleModels.Gemini25Pro => "gemini-2.5-pro", + GoogleModels.Gemini38Flash => "gemini-3.8-flash", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -47,9 +37,7 @@ public static string ToValueString(this GoogleModels value) { return value switch { - "gemini-2.5-flash" => GoogleModels.Gemini25Flash, - "gemini-2.5-flash-lite-preview-06-17" => GoogleModels.Gemini25FlashLitePreview0617, - "gemini-2.5-pro" => GoogleModels.Gemini25Pro, + "gemini-3.8-flash" => GoogleModels.Gemini38Flash, _ => null, }; } diff --git a/src/libs/Simli/Generated/Simli.Models.ListedAsset.Json.g.cs b/src/libs/Simli/Generated/Simli.Models.ListedAsset.Json.g.cs new file mode 100644 index 0000000..d1b346d --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.ListedAsset.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Simli +{ + public readonly partial struct ListedAsset + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Simli.ListedAsset? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Simli.ListedAsset), + jsonSerializerContext) as global::Simli.ListedAsset?; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Simli.ListedAsset? FromJson( + string json) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Simli.ListedAsset? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Simli.ListedAsset), + jsonSerializerContext).ConfigureAwait(false)) as global::Simli.ListedAsset?; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.Models.ListedAsset.g.cs b/src/libs/Simli/Generated/Simli.Models.ListedAsset.g.cs new file mode 100644 index 0000000..6df70a4 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.ListedAsset.g.cs @@ -0,0 +1,295 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Simli +{ + /// + /// + /// + public readonly partial struct ListedAsset : global::System.IEquatable + { + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Simli.Asset? Asset { get; init; } +#else + public global::Simli.Asset? Asset { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Asset))] +#endif + public bool IsAsset => Asset != null; + + /// + /// + /// + public bool TryPickAsset( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Simli.Asset? value) + { + value = Asset; + return IsAsset; + } + + /// + /// + /// + public global::Simli.Asset PickAsset() => Asset is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'Asset' but the value was {ToString()}."); + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Simli.ListedAssetVariant2? ListedAssetVariant2 { get; init; } +#else + public global::Simli.ListedAssetVariant2? ListedAssetVariant2 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ListedAssetVariant2))] +#endif + public bool IsListedAssetVariant2 => ListedAssetVariant2 != null; + + /// + /// + /// + public bool TryPickListedAssetVariant2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Simli.ListedAssetVariant2? value) + { + value = ListedAssetVariant2; + return IsListedAssetVariant2; + } + + /// + /// + /// + public global::Simli.ListedAssetVariant2 PickListedAssetVariant2() => ListedAssetVariant2 is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'ListedAssetVariant2' but the value was {ToString()}."); + /// + /// + /// + public static implicit operator ListedAsset(global::Simli.Asset value) => new ListedAsset((global::Simli.Asset?)value); + + /// + /// + /// + public static implicit operator global::Simli.Asset?(ListedAsset @this) => @this.Asset; + + /// + /// + /// + public ListedAsset(global::Simli.Asset? value) + { + Asset = value; + } + + /// + /// + /// + public static ListedAsset FromAsset(global::Simli.Asset? value) => new ListedAsset(value); + + /// + /// + /// + public static implicit operator ListedAsset(global::Simli.ListedAssetVariant2 value) => new ListedAsset((global::Simli.ListedAssetVariant2?)value); + + /// + /// + /// + public static implicit operator global::Simli.ListedAssetVariant2?(ListedAsset @this) => @this.ListedAssetVariant2; + + /// + /// + /// + public ListedAsset(global::Simli.ListedAssetVariant2? value) + { + ListedAssetVariant2 = value; + } + + /// + /// + /// + public static ListedAsset FromListedAssetVariant2(global::Simli.ListedAssetVariant2? value) => new ListedAsset(value); + + /// + /// + /// + public ListedAsset( + global::Simli.Asset? asset, + global::Simli.ListedAssetVariant2? listedAssetVariant2 + ) + { + Asset = asset; + ListedAssetVariant2 = listedAssetVariant2; + } + + /// + /// + /// + public object? Object => + ListedAssetVariant2 as object ?? + Asset as object + ; + + /// + /// + /// + public override string? ToString() => + Asset?.ToString() ?? + ListedAssetVariant2?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsAsset && IsListedAssetVariant2; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? asset = null, + global::System.Func? listedAssetVariant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Asset is { } __value0 && asset != null) + { + return asset(__value0); + } + else if (ListedAssetVariant2 is { } __value1 && listedAssetVariant2 != null) + { + return listedAssetVariant2(__value1); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? asset = null, + + global::System.Action? listedAssetVariant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Asset is { } __value0) + { + asset?.Invoke(__value0); + } + else if (ListedAssetVariant2 is { } __value1) + { + listedAssetVariant2?.Invoke(__value1); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? asset = null, + global::System.Action? listedAssetVariant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Asset is { } __value0) + { + asset?.Invoke(__value0); + } + else if (ListedAssetVariant2 is { } __value1) + { + listedAssetVariant2?.Invoke(__value1); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Asset, + typeof(global::Simli.Asset), + ListedAssetVariant2, + typeof(global::Simli.ListedAssetVariant2), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ListedAsset other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Asset, other.Asset) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ListedAssetVariant2, other.ListedAssetVariant2) + ; + } + + /// + /// + /// + public static bool operator ==(ListedAsset obj1, ListedAsset obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ListedAsset obj1, ListedAsset obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ListedAsset o && Equals(o); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.Json.g.cs b/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.Json.g.cs new file mode 100644 index 0000000..4405d43 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Simli +{ + public sealed partial class ListedAssetVariant2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Simli.ListedAssetVariant2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Simli.ListedAssetVariant2), + jsonSerializerContext) as global::Simli.ListedAssetVariant2; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Simli.ListedAssetVariant2? FromJson( + string json) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Simli.ListedAssetVariant2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Simli.ListedAssetVariant2), + jsonSerializerContext).ConfigureAwait(false)) as global::Simli.ListedAssetVariant2; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Simli.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.g.cs b/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.g.cs new file mode 100644 index 0000000..7e9feea --- /dev/null +++ b/src/libs/Simli/Generated/Simli.Models.ListedAssetVariant2.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Simli +{ + /// + /// + /// + public sealed partial class ListedAssetVariant2 + { + /// + /// A signed URL that GETs the image until url_expires_at; usable as an <img> src. Null if one couldn't be made just then. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Unix time, in seconds, when url stops working. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("url_expires_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int UrlExpiresAt { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Unix time, in seconds, when url stops working. + /// + /// + /// A signed URL that GETs the image until url_expires_at; usable as an <img> src. Null if one couldn't be made just then. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ListedAssetVariant2( + int urlExpiresAt, + string? url) + { + this.Url = url; + this.UrlExpiresAt = urlExpiresAt; + } + + /// + /// Initializes a new instance of the class. + /// + public ListedAssetVariant2() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.Models.SessionDetails.g.cs b/src/libs/Simli/Generated/Simli.Models.SessionDetails.g.cs index 1c11759..f3aabb5 100644 --- a/src/libs/Simli/Generated/Simli.Models.SessionDetails.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.SessionDetails.g.cs @@ -23,7 +23,7 @@ public sealed partial class SessionDetails public required string SessionId { get; set; } /// - /// Deprecations, and starting camera fields outside their supported range. The session starts regardless. + /// Deprecations, starting camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The session starts regardless. /// [global::System.Text.Json.Serialization.JsonPropertyName("warnings")] public global::System.Collections.Generic.IList? Warnings { get; set; } @@ -40,7 +40,7 @@ public sealed partial class SessionDetails /// /// /// - /// Deprecations, and starting camera fields outside their supported range. The session starts regardless. + /// Deprecations, starting camera fields outside their supported range, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The session starts regardless. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/Simli/Generated/Simli.Models.StartAudioToVideoSessionComposeTokenPostResponse.g.cs b/src/libs/Simli/Generated/Simli.Models.StartAudioToVideoSessionComposeTokenPostResponse.g.cs index 80fa345..649155e 100644 --- a/src/libs/Simli/Generated/Simli.Models.StartAudioToVideoSessionComposeTokenPostResponse.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.StartAudioToVideoSessionComposeTokenPostResponse.g.cs @@ -15,7 +15,7 @@ public sealed partial class StartAudioToVideoSessionComposeTokenPostResponse public string? SessionToken { get; set; } /// - /// Starting camera fields outside their supported range, and region overrides. The token is minted regardless. + /// Starting camera fields outside their supported range, region overrides, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The token is minted regardless. /// [global::System.Text.Json.Serialization.JsonPropertyName("warnings")] public global::System.Collections.Generic.IList? Warnings { get; set; } @@ -31,7 +31,7 @@ public sealed partial class StartAudioToVideoSessionComposeTokenPostResponse /// /// /// - /// Starting camera fields outside their supported range, and region overrides. The token is minted regardless. + /// Starting camera fields outside their supported range, region overrides, and background_id / foreground_id dropped as not your account's (the avatar's own is used). The token is minted regardless. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/Simli/Generated/Simli.Models.StartStreamingSessionRequest.g.cs b/src/libs/Simli/Generated/Simli.Models.StartStreamingSessionRequest.g.cs index 4803b1a..54dd63e 100644 --- a/src/libs/Simli/Generated/Simli.Models.StartStreamingSessionRequest.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.StartStreamingSessionRequest.g.cs @@ -91,6 +91,18 @@ public sealed partial class StartStreamingSessionRequest [global::System.Text.Json.Serialization.JsonPropertyName("camera")] public global::Simli.CameraSetting? Camera { get; set; } + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. A streaming session can change it afterwards with BG_ messages. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("background_id")] + public global::System.Guid? BackgroundId { get; set; } + + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. A streaming session can change it afterwards with FG_ messages. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("foreground_id")] + public global::System.Guid? ForegroundId { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -139,6 +151,12 @@ public sealed partial class StartStreamingSessionRequest /// /// The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. A streaming session can change it afterwards with BG_ messages. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. A streaming session can change it afterwards with FG_ messages. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -155,7 +173,9 @@ public StartStreamingSessionRequest( int? streamingHeight, double? avatarPositionX, double? avatarPositionY, - global::Simli.CameraSetting? camera) + global::Simli.CameraSetting? camera, + global::System.Guid? backgroundId, + global::System.Guid? foregroundId) { this.FaceId = faceId ?? throw new global::System.ArgumentNullException(nameof(faceId)); this.ApiVersion = apiVersion; @@ -170,6 +190,8 @@ public StartStreamingSessionRequest( this.AvatarPositionX = avatarPositionX; this.AvatarPositionY = avatarPositionY; this.Camera = camera; + this.BackgroundId = backgroundId; + this.ForegroundId = foregroundId; } /// diff --git a/src/libs/Simli/Generated/Simli.Models.TokenRequest.g.cs b/src/libs/Simli/Generated/Simli.Models.TokenRequest.g.cs index c538a03..6440b5e 100644 --- a/src/libs/Simli/Generated/Simli.Models.TokenRequest.g.cs +++ b/src/libs/Simli/Generated/Simli.Models.TokenRequest.g.cs @@ -79,6 +79,18 @@ public sealed partial class TokenRequest [global::System.Text.Json.Serialization.JsonPropertyName("camera")] public global::Simli.CameraSetting? Camera { get; set; } + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. The agent's session starts with it: agents store none of their own. Your app can change it in the session by sending the room an app message {"type": "simli-background", "id": "<background id>"}. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("background_id")] + public global::System.Guid? BackgroundId { get; set; } + + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. Your app can change it with {"type": "simli-foreground", "id": "<foreground id>"}. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("foreground_id")] + public global::System.Guid? ForegroundId { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -119,6 +131,12 @@ public sealed partial class TokenRequest /// /// The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. The agent's session starts with it: agents store none of their own. Your app can change it in the session by sending the room an app message {"type": "simli-background", "id": "<background id>"}. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. Your app can change it with {"type": "simli-foreground", "id": "<foreground id>"}. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -133,7 +151,9 @@ public TokenRequest( int? streamingHeight, double? avatarPositionX, double? avatarPositionY, - global::Simli.CameraSetting? camera) + global::Simli.CameraSetting? camera, + global::System.Guid? backgroundId, + global::System.Guid? foregroundId) { this.ExpiryStamp = expiryStamp; this.SimliAPIKey = simliAPIKey ?? throw new global::System.ArgumentNullException(nameof(simliAPIKey)); @@ -146,6 +166,8 @@ public TokenRequest( this.AvatarPositionX = avatarPositionX; this.AvatarPositionY = avatarPositionY; this.Camera = camera; + this.BackgroundId = backgroundId; + this.ForegroundId = foregroundId; } /// diff --git a/src/libs/Simli/Generated/Simli.SimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs b/src/libs/Simli/Generated/Simli.SimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs index 35038d7..82f705f 100644 --- a/src/libs/Simli/Generated/Simli.SimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs +++ b/src/libs/Simli/Generated/Simli.SimliClient.AudioToVideoInterfaceStaticAudioPost.g.cs @@ -509,6 +509,12 @@ partial void ProcessAudioToVideoInterfaceStaticAudioPostResponseContent( /// /// The camera the video starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the video uses the avatar's own. An image is not accepted: upload it first. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -525,6 +531,8 @@ partial void ProcessAudioToVideoInterfaceStaticAudioPostResponseContent( double? avatarPositionX = default, double? avatarPositionY = default, global::Simli.CameraSetting? camera = default, + global::System.Guid? backgroundId = default, + global::System.Guid? foregroundId = default, global::Simli.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { @@ -542,6 +550,8 @@ partial void ProcessAudioToVideoInterfaceStaticAudioPostResponseContent( AvatarPositionX = avatarPositionX, AvatarPositionY = avatarPositionY, Camera = camera, + BackgroundId = backgroundId, + ForegroundId = foregroundId, }; return await AudioToVideoInterfaceStaticAudioPostAsync( diff --git a/src/libs/Simli/Generated/Simli.SimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs b/src/libs/Simli/Generated/Simli.SimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs new file mode 100644 index 0000000..ac0983b --- /dev/null +++ b/src/libs/Simli/Generated/Simli.SimliClient.DeleteAssetAssetsKindAssetIdDelete.g.cs @@ -0,0 +1,513 @@ + +#nullable enable + +namespace Simli +{ + public partial class SimliClient + { + + + private static readonly global::Simli.EndPointSecurityRequirement s_DeleteAssetAssetsKindAssetIdDeleteSecurityRequirement0 = + new global::Simli.EndPointSecurityRequirement + { + Authorizations = new global::Simli.EndPointAuthorizationRequirement[] + { new global::Simli.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXSimliApiKey", + Location = "Header", + Name = "x-simli-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Simli.EndPointSecurityRequirement[] s_DeleteAssetAssetsKindAssetIdDeleteSecurityRequirements = + new global::Simli.EndPointSecurityRequirement[] + { s_DeleteAssetAssetsKindAssetIdDeleteSecurityRequirement0, + }; + partial void PrepareDeleteAssetAssetsKindAssetIdDeleteArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::Simli.AssetKind kind, + ref global::System.Guid id); + partial void PrepareDeleteAssetAssetsKindAssetIdDeleteRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Simli.AssetKind kind, + global::System.Guid id); + partial void ProcessDeleteAssetAssetsKindAssetIdDeleteResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Delete a Background or Foreground
+ /// Deletes one of your uploaded backgrounds or foregrounds. This can not be undone. A token or agent that names it starts with the avatar's own instead. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteAssetAssetsKindAssetIdDeleteAsync( + global::Simli.AssetKind kind, + global::System.Guid id, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteAssetAssetsKindAssetIdDeleteAsResponseAsync( + kind: kind, + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete a Background or Foreground
+ /// Deletes one of your uploaded backgrounds or foregrounds. This can not be undone. A token or agent that names it starts with the avatar's own instead. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteAssetAssetsKindAssetIdDeleteAsResponseAsync( + global::Simli.AssetKind kind, + global::System.Guid id, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareDeleteAssetAssetsKindAssetIdDeleteArguments( + httpClient: HttpClient, + kind: ref kind, + id: ref id); + + + var __authorizations = global::Simli.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_DeleteAssetAssetsKindAssetIdDeleteSecurityRequirements, + operationName: "DeleteAssetAssetsKindAssetIdDeleteAsync"); + + using var __timeoutCancellationTokenSource = global::Simli.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Simli.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Simli.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Simli.PathBuilder( + path: $"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Simli.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Simli.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteAssetAssetsKindAssetIdDeleteRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + kind: kind, + id: id); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Simli.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteAssetAssetsKindAssetIdDelete", + methodName: "DeleteAssetAssetsKindAssetIdDeleteAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteAssetAssetsKindAssetIdDelete", + methodName: "DeleteAssetAssetsKindAssetIdDeleteAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Simli.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteAssetAssetsKindAssetIdDelete", + methodName: "DeleteAssetAssetsKindAssetIdDeleteAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessDeleteAssetAssetsKindAssetIdDeleteResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteAssetAssetsKindAssetIdDelete", + methodName: "DeleteAssetAssetsKindAssetIdDeleteAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteAssetAssetsKindAssetIdDelete", + methodName: "DeleteAssetAssetsKindAssetIdDeleteAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}/{id}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Simli.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); + } + catch (global::System.Exception __ex) + { + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.SimliClient.ListAssetsAssetsKindGet.g.cs b/src/libs/Simli/Generated/Simli.SimliClient.ListAssetsAssetsKindGet.g.cs new file mode 100644 index 0000000..dcb9828 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.SimliClient.ListAssetsAssetsKindGet.g.cs @@ -0,0 +1,495 @@ + +#nullable enable + +namespace Simli +{ + public partial class SimliClient + { + + + private static readonly global::Simli.EndPointSecurityRequirement s_ListAssetsAssetsKindGetSecurityRequirement0 = + new global::Simli.EndPointSecurityRequirement + { + Authorizations = new global::Simli.EndPointAuthorizationRequirement[] + { new global::Simli.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXSimliApiKey", + Location = "Header", + Name = "x-simli-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Simli.EndPointSecurityRequirement[] s_ListAssetsAssetsKindGetSecurityRequirements = + new global::Simli.EndPointSecurityRequirement[] + { s_ListAssetsAssetsKindGetSecurityRequirement0, + }; + partial void PrepareListAssetsAssetsKindGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::Simli.AssetKind kind); + partial void PrepareListAssetsAssetsKindGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Simli.AssetKind kind); + partial void ProcessListAssetsAssetsKindGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListAssetsAssetsKindGetResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Backgrounds or Foregrounds
+ /// Your uploaded backgrounds or foregrounds, newest first, each with a signed URL that reads the image (a PNG) until url_expires_at, an hour on. Anyone holding the URL can read that one image until then, so keep it to your own app. List again for fresh URLs. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListAssetsAssetsKindGetAsync( + global::Simli.AssetKind kind, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListAssetsAssetsKindGetAsResponseAsync( + kind: kind, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Backgrounds or Foregrounds
+ /// Your uploaded backgrounds or foregrounds, newest first, each with a signed URL that reads the image (a PNG) until url_expires_at, an hour on. Anyone holding the URL can read that one image until then, so keep it to your own app. List again for fresh URLs. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ListAssetsAssetsKindGetAsResponseAsync( + global::Simli.AssetKind kind, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListAssetsAssetsKindGetArguments( + httpClient: HttpClient, + kind: ref kind); + + + var __authorizations = global::Simli.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListAssetsAssetsKindGetSecurityRequirements, + operationName: "ListAssetsAssetsKindGetAsync"); + + using var __timeoutCancellationTokenSource = global::Simli.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Simli.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Simli.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Simli.PathBuilder( + path: $"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Simli.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Simli.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListAssetsAssetsKindGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + kind: kind); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Simli.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListAssetsAssetsKindGet", + methodName: "ListAssetsAssetsKindGetAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListAssetsAssetsKindGet", + methodName: "ListAssetsAssetsKindGetAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Simli.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListAssetsAssetsKindGet", + methodName: "ListAssetsAssetsKindGetAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListAssetsAssetsKindGetResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListAssetsAssetsKindGet", + methodName: "ListAssetsAssetsKindGetAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListAssetsAssetsKindGet", + methodName: "ListAssetsAssetsKindGetAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Simli.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListAssetsAssetsKindGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Simli.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Simli.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Simli/Generated/Simli.SimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs b/src/libs/Simli/Generated/Simli.SimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs index 5e00d53..484e0a7 100644 --- a/src/libs/Simli/Generated/Simli.SimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs +++ b/src/libs/Simli/Generated/Simli.SimliClient.StartAudioToVideoSessionComposeTokenPost.g.cs @@ -550,6 +550,12 @@ partial void ProcessStartAudioToVideoSessionComposeTokenPostResponseContent( /// /// The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. /// + /// + /// One of your uploaded backgrounds, by the id POST /assets/backgrounds returned, to show behind the avatar, cropped to fill the canvas. Trinity-2 only. Leave it out for the avatar's own. An id that is not one of your account's is dropped with a warning, and the session uses the avatar's own. An image is not accepted: upload it first. A streaming session can change it afterwards with BG_ messages. + /// + /// + /// One of your uploaded foregrounds, by the id POST /assets/foregrounds returned, laid over the avatar through its transparency and cropped to fill the canvas. Trinity-2 only; otherwise as background_id. A streaming session can change it afterwards with FG_ messages. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -567,6 +573,8 @@ partial void ProcessStartAudioToVideoSessionComposeTokenPostResponseContent( double? avatarPositionX = default, double? avatarPositionY = default, global::Simli.CameraSetting? camera = default, + global::System.Guid? backgroundId = default, + global::System.Guid? foregroundId = default, global::Simli.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { @@ -585,6 +593,8 @@ partial void ProcessStartAudioToVideoSessionComposeTokenPostResponseContent( AvatarPositionX = avatarPositionX, AvatarPositionY = avatarPositionY, Camera = camera, + BackgroundId = backgroundId, + ForegroundId = foregroundId, }; return await StartAudioToVideoSessionComposeTokenPostAsync( diff --git a/src/libs/Simli/Generated/Simli.SimliClient.UploadAssetAssetsKindPost.g.cs b/src/libs/Simli/Generated/Simli.SimliClient.UploadAssetAssetsKindPost.g.cs new file mode 100644 index 0000000..ae9a072 --- /dev/null +++ b/src/libs/Simli/Generated/Simli.SimliClient.UploadAssetAssetsKindPost.g.cs @@ -0,0 +1,1841 @@ + +#nullable enable + +namespace Simli +{ + public partial class SimliClient + { + + + private static readonly global::Simli.EndPointSecurityRequirement s_UploadAssetAssetsKindPostSecurityRequirement0 = + new global::Simli.EndPointSecurityRequirement + { + Authorizations = new global::Simli.EndPointAuthorizationRequirement[] + { new global::Simli.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXSimliApiKey", + Location = "Header", + Name = "x-simli-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Simli.EndPointSecurityRequirement[] s_UploadAssetAssetsKindPostSecurityRequirements = + new global::Simli.EndPointSecurityRequirement[] + { s_UploadAssetAssetsKindPostSecurityRequirement0, + }; + partial void PrepareUploadAssetAssetsKindPostArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::Simli.AssetKind kind, + global::Simli.BodyUploadAssetAssetsKindPost request); + partial void PrepareUploadAssetAssetsKindPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Simli.AssetKind kind, + global::Simli.BodyUploadAssetAssetsKindPost request); + partial void ProcessUploadAssetAssetsKindPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessUploadAssetAssetsKindPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + + global::Simli.BodyUploadAssetAssetsKindPost request, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadAssetAssetsKindPostAsResponseAsync( + kind: kind, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UploadAssetAssetsKindPostAsResponseAsync( + global::Simli.AssetKind kind, + + global::Simli.BodyUploadAssetAssetsKindPost request, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareUploadAssetAssetsKindPostArguments( + httpClient: HttpClient, + kind: ref kind, + request: request); + + + var __authorizations = global::Simli.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadAssetAssetsKindPostSecurityRequirements, + operationName: "UploadAssetAssetsKindPostAsync"); + + using var __timeoutCancellationTokenSource = global::Simli.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Simli.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Simli.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Simli.PathBuilder( + path: $"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Simli.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Simli.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadAssetAssetsKindPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + kind: kind, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Simli.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Simli.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadAssetAssetsKindPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 413) + { + string? __content_413 = null; + global::System.Exception? __exception_413 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_413 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_413 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_413, + responseBody: __content_413, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Simli.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadAssetAssetsKindPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Simli.Asset.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Simli.Asset.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + byte[] image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Simli.BodyUploadAssetAssetsKindPost + { + Image = image, + Imagename = imagename, + }; + + return await UploadAssetAssetsKindPostAsync( + kind: kind, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UploadAssetAssetsKindPostAsync( + global::Simli.AssetKind kind, + global::System.IO.Stream image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Simli.BodyUploadAssetAssetsKindPost + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadAssetAssetsKindPostArguments( + httpClient: HttpClient, + kind: ref kind, + request: request); + + + var __authorizations = global::Simli.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadAssetAssetsKindPostSecurityRequirements, + operationName: "UploadAssetAssetsKindPostAsync"); + + using var __timeoutCancellationTokenSource = global::Simli.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Simli.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Simli.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Simli.PathBuilder( + path: $"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Simli.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Simli.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadAssetAssetsKindPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + kind: kind, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Simli.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Simli.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadAssetAssetsKindPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 413) + { + string? __content_413 = null; + global::System.Exception? __exception_413 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_413 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_413 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_413, + responseBody: __content_413, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Simli.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadAssetAssetsKindPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Simli.Asset.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Simli.Asset.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upload Background or Foreground
+ /// Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message. + ///
+ /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// + /// JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A foreground needs transparency (a PNG or WEBP with an alpha channel). EXIF orientation is applied; metadata is dropped. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UploadAssetAssetsKindPostAsResponseAsync( + global::Simli.AssetKind kind, + global::System.IO.Stream image, + string imagename, + global::Simli.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Simli.BodyUploadAssetAssetsKindPost + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadAssetAssetsKindPostArguments( + httpClient: HttpClient, + kind: ref kind, + request: request); + + + var __authorizations = global::Simli.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadAssetAssetsKindPostSecurityRequirements, + operationName: "UploadAssetAssetsKindPostAsync"); + + using var __timeoutCancellationTokenSource = global::Simli.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Simli.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Simli.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Simli.PathBuilder( + path: $"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Simli.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Simli.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadAssetAssetsKindPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + kind: kind, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Simli.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Simli.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Simli.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Simli.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadAssetAssetsKindPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Simli.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Simli.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadAssetAssetsKindPost", + methodName: "UploadAssetAssetsKindPostAsync", + pathTemplate: "$\"/assets/{(global::System.Uri.EscapeDataString(kind.ToValueString()))}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 413) + { + string? __content_413 = null; + global::System.Exception? __exception_413 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_413 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_413 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_413, + responseBody: __content_413, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Simli.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Simli.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadAssetAssetsKindPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Simli.Asset.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Simli.Asset.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Simli.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Simli.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Simli.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Simli/asyncapi.yaml b/src/libs/Simli/asyncapi.yaml index 66794ba..79742a7 100644 --- a/src/libs/Simli/asyncapi.yaml +++ b/src/libs/Simli/asyncapi.yaml @@ -39,6 +39,12 @@ channels: $ref: "#/components/messages/camera" camera_notice: $ref: "#/components/messages/camera_notice" + background: + $ref: "#/components/messages/background" + foreground: + $ref: "#/components/messages/foreground" + asset_notice: + $ref: "#/components/messages/asset_notice" event: $ref: "#/components/messages/event" error: @@ -65,6 +71,12 @@ channels: $ref: "#/components/messages/camera" camera_notice: $ref: "#/components/messages/camera_notice" + background: + $ref: "#/components/messages/background" + foreground: + $ref: "#/components/messages/foreground" + asset_notice: + $ref: "#/components/messages/asset_notice" event: $ref: "#/components/messages/event" error: @@ -113,6 +125,24 @@ operations: $ref: "#/channels/peer_to_peer" messages: - $ref: "#/channels/peer_to_peer/messages/camera_notice" + sendBackground_peer_to_peer: + action: send + channel: + $ref: "#/channels/peer_to_peer" + messages: + - $ref: "#/channels/peer_to_peer/messages/background" + sendForeground_peer_to_peer: + action: send + channel: + $ref: "#/channels/peer_to_peer" + messages: + - $ref: "#/channels/peer_to_peer/messages/foreground" + assetNotice_peer_to_peer: + action: receive + channel: + $ref: "#/channels/peer_to_peer" + messages: + - $ref: "#/channels/peer_to_peer/messages/asset_notice" event_peer_to_peer: action: receive channel: @@ -163,6 +193,24 @@ operations: $ref: "#/channels/livekit" messages: - $ref: "#/channels/livekit/messages/camera_notice" + sendBackground_livekit: + action: send + channel: + $ref: "#/channels/livekit" + messages: + - $ref: "#/channels/livekit/messages/background" + sendForeground_livekit: + action: send + channel: + $ref: "#/channels/livekit" + messages: + - $ref: "#/channels/livekit/messages/foreground" + assetNotice_livekit: + action: receive + channel: + $ref: "#/channels/livekit" + messages: + - $ref: "#/channels/livekit/messages/asset_notice" event_livekit: action: receive channel: @@ -249,6 +297,41 @@ components: - const: "Selected model does not support camera overrides" description: "The face is not Trinity-2. The camera is unchanged." example: "WARNING: camera zoom 6.0 is outside its supported range (0.0, 4.0]; applied as is" + background: + description: | + Puts one of your uploaded backgrounds behind the avatar, Trinity-2 faces only: the ASCII prefix `BG_` and the background's id, as `POST /assets/backgrounds` returned it, 36 characters (hyphens included, either case). Text or binary; 39 characters in all, nothing else is accepted. An image can't be sent: upload it first. The background is cropped to fill the session's canvas. + + Only your own backgrounds: an id that isn't one of your account's is ignored. It replaces the one the session started with (the session token's `background_id`) a moment later, once loaded; audio keeps playing meanwhile, and the last one sent wins. See asset_notice. + + `BG_00000000-0000-0000-0000-000000000000` (the nil UUID) goes back to the avatar's own background, at once. + payload: + schema: + type: string + pattern: '^BG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$' + example: "BG_6f1c2a9e-1b2c-4d3e-8f90-0123456789ab" + foreground: + description: | + Lays one of your uploaded foregrounds over the avatar through its transparency, Trinity-2 faces only: the ASCII prefix `FG_` and the foreground's id, as `POST /assets/foregrounds` returned it, 36 characters. Text or binary; 39 characters in all, nothing else is accepted, an image least of all. Otherwise as background, in place of the session token's `foreground_id`. `FG_00000000-0000-0000-0000-000000000000` (the nil UUID) takes the foreground away. + payload: + schema: + type: string + pattern: '^FG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$' + example: "FG_6f1c2a9e-1b2c-4d3e-8f90-0123456789ab" + asset_notice: + description: "Server replies to a background or foreground message, sent as text; a message that is applied gets none. None of them end the session, and the avatar keeps what it had." + payload: + schema: + type: string + oneOf: + - pattern: '^Invalid (background|foreground) message: .+$' + description: "Not `BG_`/`FG_` and an id of 36 characters (an image, say)." + - pattern: '^(background|foreground) \S+ is not one of your uploaded (backgrounds|foregrounds), ignoring$' + description: "No such id among your account's uploads of that kind: never uploaded, deleted, or another account's." + - pattern: "^Couldn't load (background|foreground) \\S+, ignoring$" + description: "It couldn't be fetched or read just now; send it again." + - pattern: '^Selected model does not support a custom (background|foreground)$' + description: "The face is not Trinity-2." + example: "background 6f1c2a9e-1b2c-4d3e-8f90-0123456789ab is not one of your uploaded backgrounds, ignoring" event: description: "Server sent signals" diff --git a/src/libs/Simli/openapi.yaml b/src/libs/Simli/openapi.yaml index 5c3ce21..f3fffdc 100644 --- a/src/libs/Simli/openapi.yaml +++ b/src/libs/Simli/openapi.yaml @@ -64,8 +64,10 @@ paths: items: type: string description: >- - Starting camera fields outside their supported range, and region - overrides. The token is minted regardless. + Starting camera fields outside their supported range, region + overrides, and background_id / foreground_id dropped as not + your account's (the avatar's own is used). The token is minted + regardless. "400": description: Invalid Data content: @@ -116,8 +118,9 @@ paths: items: type: string description: >- - Camera fields outside their supported range. The video is made - with them regardless. + Camera fields outside their supported range, and background_id / + foreground_id dropped as not your account's (the avatar's own is + used). The video is made regardless. "422": description: Validation Error content: @@ -418,6 +421,119 @@ paths: description: Invalid input "401": description: Unauthorized + /assets/{kind}: + post: + summary: Upload Background or Foreground + description: >- + Uploads an image to show behind your avatars (a background) or over them + (a foreground). It goes through a content safety check first, which takes + a few seconds, and one it flags is refused. Stored as PNG, private to your + account: only your own sessions can use it, by its id, as a session + token's, a static video's or an Auto session's background_id / + foreground_id, or in a streaming session's BG_ / FG_ message. + operationId: uploadAsset_assets__kind__post + parameters: + - name: kind + in: path + required: true + schema: + $ref: "#/components/schemas/AssetKind" + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/Body_uploadAsset_assets__kind__post" + responses: + "201": + description: Stored + content: + application/json: + schema: + $ref: "#/components/schemas/Asset" + "400": + description: >- + The image can't be used: not a JPEG, PNG or WEBP, not 16:9, 9:16 or + 1:1, outside the size limits, a foreground without transparency, or + flagged by the content safety check. detail says which. + "401": + description: Unauthorized + "413": + description: The image is 5MB or more + "422": + description: Validation Error + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + "503": + description: >- + The content safety check is unavailable, so nothing was stored. Try + again. + get: + summary: List Backgrounds or Foregrounds + description: >- + Your uploaded backgrounds or foregrounds, newest first, each with a + signed URL that reads the image (a PNG) until url_expires_at, an hour + on. Anyone holding the URL can read that one image until then, so keep + it to your own app. List again for fresh URLs. + operationId: listAssets_assets__kind__get + parameters: + - name: kind + in: path + required: true + schema: + $ref: "#/components/schemas/AssetKind" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/ListedAsset" + "401": + description: Unauthorized + "422": + description: Validation Error + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + /assets/{kind}/{id}: + delete: + summary: Delete a Background or Foreground + description: >- + Deletes one of your uploaded backgrounds or foregrounds. This can not be + undone. A token or agent that names it starts with the avatar's own + instead. + operationId: deleteAsset_assets__kind___asset_id__delete + parameters: + - name: kind + in: path + required: true + schema: + $ref: "#/components/schemas/AssetKind" + - name: id + in: path + required: true + schema: + type: string + format: uuid + responses: + "204": + description: Deleted + "401": + description: Unauthorized + "404": + description: Not one of your backgrounds / foregrounds + "422": + description: Validation Error + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" /integrations/livekit/agents: post: security: [] @@ -715,8 +831,9 @@ paths: items: type: string description: >- - Starting camera fields outside their supported range. The token - is minted regardless. + Starting camera fields outside their supported range, and + background_id / foreground_id dropped as not your account's + (the avatar's own is used). The token is minted regardless. "422": description: Validation Error @@ -1187,6 +1304,29 @@ components: The camera the video starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. + background_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Background Id + description: >- + One of your uploaded backgrounds, by the id POST /assets/backgrounds + returned, to show behind the avatar, cropped to fill the canvas. + Trinity-2 only. Leave it out for the avatar's own. An id that is not + one of your account's is dropped with a warning, and the video uses + the avatar's own. An image is not accepted: upload it first. + foreground_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Foreground Id + description: >- + One of your uploaded foregrounds, by the id POST /assets/foregrounds + returned, laid over the avatar through its transparency and cropped + to fill the canvas. Trinity-2 only; otherwise as + background_id. type: object required: - faceId @@ -1363,6 +1503,32 @@ components: The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. + background_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Background Id + description: >- + One of your uploaded backgrounds, by the id POST /assets/backgrounds + returned, to show behind the avatar, cropped to fill the canvas. + Trinity-2 only. Leave it out for the avatar's own. An id that is not + one of your account's is dropped with a warning, and the session uses + the avatar's own. An image is not accepted: upload it first. + Your app can change it in the session by sending the room an app + message {"type": "simli-background", "id": ""}. + foreground_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Foreground Id + description: >- + One of your uploaded foregrounds, by the id POST /assets/foregrounds + returned, laid over the avatar through its transparency and cropped + to fill the canvas. Trinity-2 only; otherwise as + background_id. Your app can change it with + {"type": "simli-foreground", "id": ""}. type: object title: ConfigurableSessionRequest CustomLLMConfig: @@ -1384,10 +1550,11 @@ components: title: CustomLLMConfig Google_Models: type: string + description: >- + Gemini 2.5 and older are retired: they're still accepted, and run on + gemini-3.8-flash. enum: - - gemini-2.5-pro - - gemini-2.5-flash - - gemini-2.5-flash-lite-preview-06-17 + - gemini-3.8-flash title: Google_Models HTTPValidationError: properties: @@ -1482,8 +1649,9 @@ components: items: type: string description: >- - Deprecations, and starting camera fields outside their supported - range. The session starts regardless. + Deprecations, starting camera fields outside their supported range, + and background_id / foreground_id dropped as not your account's (the + avatar's own is used). The session starts regardless. type: object required: - roomUrl @@ -1572,6 +1740,31 @@ components: The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. + background_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Background Id + description: >- + One of your uploaded backgrounds, by the id POST /assets/backgrounds + returned, to show behind the avatar, cropped to fill the canvas. + Trinity-2 only. Leave it out for the avatar's own. An id that is not + one of your account's is dropped with a warning, and the session uses + the avatar's own. An image is not accepted: upload it first. + A streaming session can change it afterwards with BG_ messages. + foreground_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Foreground Id + description: >- + One of your uploaded foregrounds, by the id POST /assets/foregrounds + returned, laid over the avatar through its transparency and cropped + to fill the canvas. Trinity-2 only; otherwise as + background_id. A streaming session can change it afterwards + with FG_ messages. type: object required: - faceId @@ -1663,6 +1856,33 @@ components: The camera the session starts with, on top of the avatar's own framing. Trinity-2 only. Leave it out to keep the avatar's framing. A streaming session can move it afterwards with CAM_ messages. + background_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Background Id + description: >- + One of your uploaded backgrounds, by the id POST /assets/backgrounds + returned, to show behind the avatar, cropped to fill the canvas. + Trinity-2 only. Leave it out for the avatar's own. An id that is not + one of your account's is dropped with a warning, and the session uses + the avatar's own. An image is not accepted: upload it first. + The agent's session starts with it: agents store none of their own. + Your app can change it in the session by sending the room an app + message {"type": "simli-background", "id": ""}. + foreground_id: + anyOf: + - type: string + format: uuid + - type: "null" + title: Foreground Id + description: >- + One of your uploaded foregrounds, by the id POST /assets/foregrounds + returned, laid over the avatar through its transparency and cropped + to fill the canvas. Trinity-2 only; otherwise as + background_id. Your app can change it with + {"type": "simli-foreground", "id": ""}. type: object required: - simliAPIKey @@ -1782,6 +2002,84 @@ components: required: - image title: Body_preprocess_image_faces_trinity_preprocess_post + AssetKind: + type: string + enum: + - backgrounds + - foregrounds + title: AssetKind + Asset: + properties: + id: + type: string + format: uuid + title: Id + description: What background_id / foreground_id and BG_ / FG_ take. + name: + type: string + title: Name + description: The uploaded file's name. + width: + type: integer + title: Width + height: + type: integer + title: Height + size_bytes: + type: integer + title: Size Bytes + description: The stored PNG's size. + created_at: + type: integer + title: Created At + description: Unix time, in seconds. + type: object + required: + - id + - name + - width + - height + - size_bytes + - created_at + title: Asset + ListedAsset: + allOf: + - $ref: "#/components/schemas/Asset" + - type: object + properties: + url: + anyOf: + - type: string + format: uri + - type: "null" + title: Url + description: >- + A signed URL that GETs the image until url_expires_at; usable as + an src. Null if one couldn't be made just then. + url_expires_at: + type: integer + title: Url Expires At + description: Unix time, in seconds, when url stops working. + required: + - url + - url_expires_at + title: ListedAsset + Body_uploadAsset_assets__kind__post: + properties: + image: + type: string + format: binary + title: Image + description: >- + JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases' + shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its + shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A + foreground needs transparency (a PNG or WEBP with an alpha channel). + EXIF orientation is applied; metadata is dropped. + type: object + required: + - image + title: Body_uploadAsset_assets__kind__post TrinityGenerationState: type: string enum: