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
31 changes: 15 additions & 16 deletions src/libs/Replicate/Generated/OneOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,36 @@ namespace Replicate
/// <summary>
///
/// </summary>
public static implicit operator OneOf<T1, T2>(T1 value) => new OneOf<T1, T2>((T1?)value);
#if NET6_0_OR_GREATER
public T2? Value2 { get; init; }
#else
public T2? Value2 { get; }
#endif

/// <summary>
///
/// </summary>
public static implicit operator T1?(OneOf<T1, T2> @this) => @this.Value1;

#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
#endif
public bool IsValue2 => Value2 != null;
/// <summary>
///
/// </summary>
public OneOf(T1? value)
{
Value1 = value;
}
public static implicit operator OneOf<T1, T2>(T1 value) => new OneOf<T1, T2>((T1?)value);

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
public T2? Value2 { get; init; }
#else
public T2? Value2 { get; }
#endif
public static implicit operator T1?(OneOf<T1, T2> @this) => @this.Value1;

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
#endif
public bool IsValue2 => Value2 != null;
public OneOf(T1? value)
{
Value1 = value;
}

/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace Replicate
typeof(global::Replicate.JsonConverters.ModelsListSortByNullableJsonConverter),
typeof(global::Replicate.JsonConverters.ModelsListSortDirectionJsonConverter),
typeof(global::Replicate.JsonConverters.ModelsListSortDirectionNullableJsonConverter),
typeof(global::Replicate.JsonConverters.PredictionsListSourceJsonConverter),
typeof(global::Replicate.JsonConverters.PredictionsListSourceNullableJsonConverter),
typeof(global::Replicate.JsonConverters.AccountGetResponseTypeJsonConverter),
typeof(global::Replicate.JsonConverters.AccountGetResponseTypeNullableJsonConverter),
typeof(global::Replicate.JsonConverters.OneOfJsonConverter<string, global::Replicate.SchemasPredictionResponseVersion?>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public partial interface IReplicateApi
/// Use a data URL when:<br/>
/// - you have a small file &lt;= 256kb<br/>
/// - you don't want to upload and host the file somewhere<br/>
/// - you don't need to use the file again (Replicate will not store it)
/// - you don't need to use the file again (Replicate will not store it)<br/>
/// Example: {"prompt":"Tell me a joke","system_prompt":"You are a helpful assistant"}
/// </param>
/// <param name="stream">
/// **This field is deprecated.**<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public partial interface IReplicateApi
/// Use a data URL when:<br/>
/// - you have a small file &lt;= 256kb<br/>
/// - you don't want to upload and host the file somewhere<br/>
/// - you don't need to use the file again (Replicate will not store it)
/// - you don't need to use the file again (Replicate will not store it)<br/>
/// Example: {"prompt":"Tell me a joke","system_prompt":"You are a helpful assistant"}
/// </param>
/// <param name="stream">
/// **This field is deprecated.**<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public partial interface IReplicateApi
/// Use a data URL when:<br/>
/// - you have a small file &lt;= 256kb<br/>
/// - you don't want to upload and host the file somewhere<br/>
/// - you don't need to use the file again (Replicate will not store it)
/// - you don't need to use the file again (Replicate will not store it)<br/>
/// Example: {"text":"Alice"}
/// </param>
/// <param name="stream">
/// **This field is deprecated.**<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ public partial interface IReplicateApi
/// `version` will be the unique ID of model version used to create the prediction.<br/>
/// `data_removed` will be `true` if the input and output data has been deleted.
/// </summary>
/// <param name="createdAfter"></param>
/// <param name="createdBefore"></param>
/// <param name="createdAfter">
/// Example: 2025-01-01T00:00:00.0000000+00:00
/// </param>
/// <param name="createdBefore">
/// Example: 2025-02-01T00:00:00.0000000+00:00
/// </param>
/// <param name="source"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.PredictionsListResponse> PredictionsListAsync(
global::System.DateTime? createdAfter = default,
global::System.DateTime? createdBefore = default,
global::Replicate.PredictionsListSource? source = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Replicate.PredictionsListSource? 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::Replicate.PredictionsListSourceExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,74 +298,78 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::Replicate.AccountGetResponse? Type68 { get; set; }
public global::Replicate.PredictionsListSource? Type68 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.AccountGetResponseType? Type69 { get; set; }
public global::Replicate.AccountGetResponse? Type69 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.DeploymentsListResponse? Type70 { get; set; }
public global::Replicate.AccountGetResponseType? Type70 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::Replicate.SchemasDeploymentResponse>? Type71 { get; set; }
public global::Replicate.DeploymentsListResponse? Type71 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.FilesListResponse? Type72 { get; set; }
public global::System.Collections.Generic.IList<global::Replicate.SchemasDeploymentResponse>? Type72 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::Replicate.SchemasFileResponse>? Type73 { get; set; }
public global::Replicate.FilesListResponse? Type73 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.FilesCreateResponse? Type74 { get; set; }
public global::System.Collections.Generic.IList<global::Replicate.SchemasFileResponse>? Type74 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.FilesDeleteResponse? Type75 { get; set; }
public global::Replicate.FilesCreateResponse? Type75 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.FilesGetResponse? Type76 { get; set; }
public global::Replicate.FilesDeleteResponse? Type76 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.FilesDownloadResponse? Type77 { get; set; }
public global::Replicate.FilesGetResponse? Type77 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::Replicate.HardwareListResponseItem>? Type78 { get; set; }
public global::Replicate.FilesDownloadResponse? Type78 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.HardwareListResponseItem? Type79 { get; set; }
public global::System.Collections.Generic.IList<global::Replicate.HardwareListResponseItem>? Type79 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.PredictionsListResponse? Type80 { get; set; }
public global::Replicate.HardwareListResponseItem? Type80 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.SearchResponse? Type81 { get; set; }
public global::Replicate.PredictionsListResponse? Type81 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.SearchResponse2? Type82 { get; set; }
public global::Replicate.SearchResponse? Type82 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.TrainingsListResponse? Type83 { get; set; }
public global::Replicate.SearchResponse2? Type83 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::Replicate.SchemasTrainingResponse>? Type84 { get; set; }
public global::Replicate.TrainingsListResponse? Type84 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.WebhooksDefaultSecretGetResponse? Type85 { get; set; }
public global::System.Collections.Generic.IList<global::Replicate.SchemasTrainingResponse>? Type85 { get; set; }
/// <summary>
///
/// </summary>
public global::Replicate.WebhooksDefaultSecretGetResponse? Type86 { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

#nullable enable

namespace Replicate
{
/// <summary>
///
/// </summary>
public enum PredictionsListSource
{
/// <summary>
///
/// </summary>
Web,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class PredictionsListSourceExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this PredictionsListSource value)
{
return value switch
{
PredictionsListSource.Web => "web",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static PredictionsListSource? ToEnum(string value)
{
return value switch
{
"web" => PredictionsListSource.Web,
_ => null,
};
}
}
}
Loading