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 GET endpoints for object upload and download to Instill API #26

Merged
merged 1 commit into from
Oct 18, 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
5 changes: 5 additions & 0 deletions src/libs/Instill/Generated/Instill.IInstillClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@ public partial interface IInstillClient : global::System.IDisposable
/// </summary>
public CatalogClient Catalog { get; }

/// <summary>
///
/// </summary>
public ObjectClient Object { get; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#nullable enable

namespace Instill
{
public partial interface IObjectClient
{
/// <summary>
/// Get Object Download URL
/// </summary>
/// <param name="namespaceId"></param>
/// <param name="objectUid"></param>
/// <param name="objectName"></param>
/// <param name="expirationTime"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Instill.GetObjectDownloadURLResponse> GetObjectDownloadURLAsync(
string namespaceId,
string? objectUid = default,
string? objectName = default,
int? expirationTime = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#nullable enable

namespace Instill
{
public partial interface IObjectClient
{
/// <summary>
/// Get Object Upload URL
/// </summary>
/// <param name="namespaceId"></param>
/// <param name="objectName"></param>
/// <param name="expirationTime"></param>
/// <param name="lastModifiedTime"></param>
/// <param name="objectExpireDays"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Instill.GetObjectUploadURLResponse> GetObjectUploadURLAsync(
string namespaceId,
string objectName,
int? expirationTime = default,
global::System.DateTime? lastModifiedTime = default,
int? objectExpireDays = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
19 changes: 19 additions & 0 deletions src/libs/Instill/Generated/Instill.IObjectClient.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

#nullable enable

namespace Instill
{
/// <summary>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
public partial interface IObjectClient : global::System.IDisposable
{
/// <summary>
///
/// </summary>
global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; }


}
}
8 changes: 8 additions & 0 deletions src/libs/Instill/Generated/Instill.InstillClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ public sealed partial class InstillClient : global::Instill.IInstillClient, glob
JsonSerializerContext = JsonSerializerContext,
};

/// <summary>
///
/// </summary>
public ObjectClient Object => new ObjectClient(_httpClient, authorizations: _authorizations)
{
JsonSerializerContext = JsonSerializerContext,
};

/// <summary>
/// Creates a new instance of the InstillClient.
/// If no httpClient is provided, a new one will be created.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

#nullable enable

namespace Instill
{
/// <summary>
///
/// </summary>
public sealed partial class GetObjectDownloadURLResponse
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("downloadUrl")]
public string? DownloadUrl { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("urlExpireAt")]
public global::System.DateTime? UrlExpireAt { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("object")]
public global::Instill.Object? Object { 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>
/// 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.GetObjectDownloadURLResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Instill.GetObjectDownloadURLResponse),
jsonSerializerContext) as global::Instill.GetObjectDownloadURLResponse;
}

/// <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.GetObjectDownloadURLResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Instill.GetObjectDownloadURLResponse>(
json,
jsonSerializerOptions);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

#nullable enable

namespace Instill
{
/// <summary>
///
/// </summary>
public sealed partial class GetObjectDownloadURLResponse2
{

/// <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>
/// 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.GetObjectDownloadURLResponse2? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Instill.GetObjectDownloadURLResponse2),
jsonSerializerContext) as global::Instill.GetObjectDownloadURLResponse2;
}

/// <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.GetObjectDownloadURLResponse2? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Instill.GetObjectDownloadURLResponse2>(
json,
jsonSerializerOptions);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

#nullable enable

namespace Instill
{
/// <summary>
///
/// </summary>
public sealed partial class GetObjectUploadURLResponse
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("uploadUrl")]
public string? UploadUrl { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("urlExpireAt")]
public global::System.DateTime? UrlExpireAt { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("object")]
public global::Instill.Object? Object { 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>
/// 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.GetObjectUploadURLResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Instill.GetObjectUploadURLResponse),
jsonSerializerContext) as global::Instill.GetObjectUploadURLResponse;
}

/// <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.GetObjectUploadURLResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Instill.GetObjectUploadURLResponse>(
json,
jsonSerializerOptions);
}

}
}
Loading
Loading