Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Add new schemas and update OpenAPI specification for Instill AI API #58

Merged
merged 1 commit into from
Nov 28, 2024
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
18 changes: 9 additions & 9 deletions src/libs/Instill/Generated/Instill.Models.AppV1alphaMessage.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public sealed partial class AppV1alphaMessage
/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("chunks")]
public global::System.Collections.Generic.IList<global::Instill.Chunk>? Chunks { get; set; }
[global::System.Text.Json.Serialization.JsonPropertyName("standaloneQuestion")]
public string? StandaloneQuestion { get; set; }

/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("standaloneQuestion")]
public string? StandaloneQuestion { get; set; }
[global::System.Text.Json.Serialization.JsonPropertyName("citations")]
public global::System.Collections.Generic.IList<global::Instill.Citation>? Citations { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down Expand Up @@ -107,10 +107,10 @@ public sealed partial class AppV1alphaMessage
/// <param name="msgSenderUid">
/// Included only in responses
/// </param>
/// <param name="chunks">
/// <param name="standaloneQuestion">
/// Included only in responses
/// </param>
/// <param name="standaloneQuestion">
/// <param name="citations">
/// Included only in responses
/// </param>
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
Expand All @@ -124,8 +124,8 @@ public AppV1alphaMessage(
global::System.DateTime? createTime,
global::System.DateTime? updateTime,
string? msgSenderUid,
global::System.Collections.Generic.IList<global::Instill.Chunk>? chunks,
string? standaloneQuestion)
string? standaloneQuestion,
global::System.Collections.Generic.IList<global::Instill.Citation>? citations)
{
this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content));
this.Role = role ?? throw new global::System.ArgumentNullException(nameof(role));
Expand All @@ -136,8 +136,8 @@ public AppV1alphaMessage(
this.CreateTime = createTime;
this.UpdateTime = updateTime;
this.MsgSenderUid = msgSenderUid;
this.Chunks = chunks;
this.StandaloneQuestion = standaloneQuestion;
this.Citations = citations;
}

/// <summary>
Expand Down
92 changes: 92 additions & 0 deletions src/libs/Instill/Generated/Instill.Models.Citation.Json.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#nullable enable

namespace Instill
{
public sealed partial class Citation
{
/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#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)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::Instill.Citation? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Instill.Citation),
jsonSerializerContext) as global::Instill.Citation;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#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::Instill.Citation? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Instill.Citation>(
json,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerContext.
/// </summary>
public static async global::System.Threading.Tasks.ValueTask<global::Instill.Citation?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
jsonStream,
typeof(global::Instill.Citation),
jsonSerializerContext).ConfigureAwait(false)) as global::Instill.Citation;
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerOptions.
/// </summary>
#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<global::Instill.Citation?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::Instill.Citation?>(
jsonStream,
jsonSerializerOptions);
}
}
}
86 changes: 86 additions & 0 deletions src/libs/Instill/Generated/Instill.Models.Citation.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

#nullable enable

namespace Instill
{
/// <summary>
///
/// </summary>
public sealed partial class Citation
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("type")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Instill.JsonConverters.CitationsTypeJsonConverter))]
public global::Instill.CitationsType? Type { get; set; }

/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }

/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("url")]
public string? Url { get; set; }

/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("chunkUid")]
public string? ChunkUid { get; set; }

/// <summary>
/// Included only in responses
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("fileUid")]
public string? FileUid { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();

/// <summary>
/// Initializes a new instance of the <see cref="Citation" /> class.
/// </summary>
/// <param name="type"></param>
/// <param name="name">
/// Included only in responses
/// </param>
/// <param name="url">
/// Included only in responses
/// </param>
/// <param name="chunkUid">
/// Included only in responses
/// </param>
/// <param name="fileUid">
/// Included only in responses
/// </param>
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
public Citation(
global::Instill.CitationsType? type,
string? name,
string? url,
string? chunkUid,
string? fileUid)
{
this.Type = type;
this.Name = name;
this.Url = url;
this.ChunkUid = chunkUid;
this.FileUid = fileUid;
}

/// <summary>
/// Initializes a new instance of the <see cref="Citation" /> class.
/// </summary>
public Citation()
{
}
}
}
52 changes: 52 additions & 0 deletions src/libs/Instill/Generated/Instill.Models.CitationsType.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

#nullable enable

namespace Instill
{
/// <summary>
/// - CITATIONS_TYPE_CHUNK: Chunk-based citation<br/>
/// - CITATIONS_TYPE_URL: URL-based citation
/// </summary>
public enum CitationsType
{
/// <summary>
/// Chunk-based citation
/// </summary>
CHUNK,
/// <summary>
/// URL-based citation
/// </summary>
URL,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class CitationsTypeExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this CitationsType value)
{
return value switch
{
CitationsType.CHUNK => "CITATIONS_TYPE_CHUNK",
CitationsType.URL => "CITATIONS_TYPE_URL",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static CitationsType? ToEnum(string value)
{
return value switch
{
"CITATIONS_TYPE_CHUNK" => CitationsType.CHUNK,
"CITATIONS_TYPE_URL" => CitationsType.URL,
_ => null,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#nullable enable

namespace Instill
{
public sealed partial class LookUpConnectionAdminResponse
{
/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#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)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::Instill.LookUpConnectionAdminResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Instill.LookUpConnectionAdminResponse),
jsonSerializerContext) as global::Instill.LookUpConnectionAdminResponse;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#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::Instill.LookUpConnectionAdminResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Instill.LookUpConnectionAdminResponse>(
json,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerContext.
/// </summary>
public static async global::System.Threading.Tasks.ValueTask<global::Instill.LookUpConnectionAdminResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
jsonStream,
typeof(global::Instill.LookUpConnectionAdminResponse),
jsonSerializerContext).ConfigureAwait(false)) as global::Instill.LookUpConnectionAdminResponse;
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerOptions.
/// </summary>
#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<global::Instill.LookUpConnectionAdminResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::Instill.LookUpConnectionAdminResponse?>(
jsonStream,
jsonSerializerOptions);
}
}
}
Loading
Loading