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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal static class RecipesApiGroupCommand
public static Command Create()
{
var command = new Command(@"recipes", @"Recipes endpoint commands.");
command.Subcommands.Add(RecipesCreateRecipesAdLocalizationCommandApiCommand.Create());
command.Subcommands.Add(RecipesCreateRecipesMarketingStockImageCommandApiCommand.Create());
command.Subcommands.Add(RecipesCreateRecipesMultiShotVideoCommandApiCommand.Create());
command.Subcommands.Add(RecipesCreateRecipesProductAdCommandApiCommand.Create());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace Runway.Cli.GeneratedApi.Commands;

internal static partial class RecipesCreateRecipesAdLocalizationCommandApiCommand
{
private static Option<string> XRunwayVersion { get; } = new(
name: @"--x-runway-version")
{
Description = @"The version of the RunwayML API being used. You can read more about versioning [here](/api-details/versioning).",
DefaultValueFactory = _ => "2024-11-06",
};

private static Option<global::Runway.CreateRecipesAdLocalizationRequestVersion> Version { get; } = new(
name: @"--version")
{
Description = @"Workflow version. Use a dated version (e.g. ""2026-06"") to pin behavior, or ""unsafe-latest"" to track the newest stable version (may break without notice).",
Required = true,
};

private static Option<global::Runway.CreateRecipesAdLocalizationRequestReferenceImage> ReferenceImage { get; } = new(
name: @"--reference-image")
{
Description = @"Reference ad image to localize. See [our docs](/assets/inputs#images) on image inputs.",
Required = true,
};

private static Option<global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage> TargetLanguage { get; } = new(
name: @"--target-language")
{
Description = @"Target language for the localized ad. Use ISO-style codes (e.g. ""ja"" for Japanese, ""es"" for Spanish).",
Required = true,
};

private static string FormatResponse(ParseResult parseResult, global::Runway.CreateRecipesAdLocalizationResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Runway.CreateRecipesAdLocalizationResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


public static Command Create()
{
var command = new Command(@"create-recipes-ad-localization", @"Localize an ad image
Localize an existing ad image for a target language, preserving visual creative while adapting on-screen messaging.");
command.Options.Add(XRunwayVersion);
command.Options.Add(Version);
command.Options.Add(ReferenceImage);
command.Options.Add(TargetLanguage);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var xRunwayVersion = parseResult.GetRequiredValue(XRunwayVersion);
var version = parseResult.GetRequiredValue(Version);
var referenceImage = parseResult.GetRequiredValue(ReferenceImage);
var targetLanguage = parseResult.GetRequiredValue(TargetLanguage);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Recipes.CreateRecipesAdLocalizationAsync(
xRunwayVersion: xRunwayVersion,
version: version,
referenceImage: referenceImage,
targetLanguage: targetLanguage,
cancellationToken: cancellationToken).ConfigureAwait(false);


await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::Runway.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
return command;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#nullable enable

namespace Runway
{
public partial interface IRecipesClient
{
/// <summary>
/// Localize an ad image<br/>
/// Localize an existing ad image for a target language, preserving visual creative while adapting on-screen messaging.
/// </summary>
/// <param name="xRunwayVersion">
/// Default Value: 2024-11-06
/// </param>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Runway.ApiException"></exception>
/// <remarks>
/// // npm install --save @runwayml/sdk<br/>
/// import RunwayML from '@runwayml/sdk';<br/>
/// const client = new RunwayML();<br/>
/// const task = await client.recipes.adLocalization({<br/>
/// version: '2026-06',<br/>
/// referenceImage: { uri: 'https://example.com/source-ad.jpg' },<br/>
/// targetLanguage: 'ja',<br/>
/// });<br/>
/// console.log(task);
/// </remarks>
global::System.Threading.Tasks.Task<global::Runway.CreateRecipesAdLocalizationResponse> CreateRecipesAdLocalizationAsync(

global::Runway.CreateRecipesAdLocalizationRequest request,
string xRunwayVersion = "2024-11-06",
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Localize an ad image<br/>
/// Localize an existing ad image for a target language, preserving visual creative while adapting on-screen messaging.
/// </summary>
/// <param name="xRunwayVersion">
/// Default Value: 2024-11-06
/// </param>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Runway.ApiException"></exception>
/// <remarks>
/// // npm install --save @runwayml/sdk<br/>
/// import RunwayML from '@runwayml/sdk';<br/>
/// const client = new RunwayML();<br/>
/// const task = await client.recipes.adLocalization({<br/>
/// version: '2026-06',<br/>
/// referenceImage: { uri: 'https://example.com/source-ad.jpg' },<br/>
/// targetLanguage: 'ja',<br/>
/// });<br/>
/// console.log(task);
/// </remarks>
global::System.Threading.Tasks.Task<global::Runway.AutoSDKHttpResponse<global::Runway.CreateRecipesAdLocalizationResponse>> CreateRecipesAdLocalizationAsResponseAsync(

global::Runway.CreateRecipesAdLocalizationRequest request,
string xRunwayVersion = "2024-11-06",
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Localize an ad image<br/>
/// Localize an existing ad image for a target language, preserving visual creative while adapting on-screen messaging.
/// </summary>
/// <param name="xRunwayVersion">
/// Default Value: 2024-11-06
/// </param>
/// <param name="version">
/// Workflow version. Use a dated version (e.g. "2026-06") to pin behavior, or "unsafe-latest" to track the newest stable version (may break without notice).
/// </param>
/// <param name="referenceImage">
/// Reference ad image to localize. See [our docs](/assets/inputs#images) on image inputs.
/// </param>
/// <param name="targetLanguage">
/// Target language for the localized ad. Use ISO-style codes (e.g. "ja" for Japanese, "es" for Spanish).
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Runway.CreateRecipesAdLocalizationResponse> CreateRecipesAdLocalizationAsync(
global::Runway.CreateRecipesAdLocalizationRequestVersion version,
global::Runway.CreateRecipesAdLocalizationRequestReferenceImage referenceImage,
global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage targetLanguage,
string xRunwayVersion = "2024-11-06",
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateRecipesAdLocalizationRequestTargetLanguageJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage>
{
/// <inheritdoc />
public override global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage 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::Runway.CreateRecipesAdLocalizationRequestTargetLanguageExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Runway.CreateRecipesAdLocalizationRequestTargetLanguageExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateRecipesAdLocalizationRequestTargetLanguageNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage?>
{
/// <inheritdoc />
public override global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage? 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::Runway.CreateRecipesAdLocalizationRequestTargetLanguageExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateRecipesAdLocalizationRequestTargetLanguage? 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::Runway.CreateRecipesAdLocalizationRequestTargetLanguageExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateRecipesAdLocalizationRequestVersionJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateRecipesAdLocalizationRequestVersion>
{
/// <inheritdoc />
public override global::Runway.CreateRecipesAdLocalizationRequestVersion 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::Runway.CreateRecipesAdLocalizationRequestVersionExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateRecipesAdLocalizationRequestVersion)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateRecipesAdLocalizationRequestVersion);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateRecipesAdLocalizationRequestVersion value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Runway.CreateRecipesAdLocalizationRequestVersionExtensions.ToValueString(value));
}
}
}
Loading
Loading