Skip to content
Open
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
121 changes: 121 additions & 0 deletions src/libs/Replicate/Generated/Replicate.AutoSDKHttpResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

#nullable enable

namespace Replicate
{
/// <summary>
/// Represents a successful HTTP response with status code and headers.
/// </summary>
public partial class AutoSDKHttpResponse
{
/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers)
: this(
statusCode: statusCode,
headers: headers,
requestUri: null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
global::System.Uri? requestUri)
{
StatusCode = statusCode;
Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers));
RequestUri = requestUri;
}

/// <summary>
/// Gets the HTTP status code.
/// </summary>
public global::System.Net.HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets the response headers.
/// </summary>
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> Headers { get; }
/// <summary>
/// Gets the final request URI associated with the response.
/// </summary>
public global::System.Uri? RequestUri { get; }

internal static global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> CreateHeaders(
global::System.Net.Http.HttpResponseMessage response)
{
response = response ?? throw new global::System.ArgumentNullException(nameof(response));

var headers = global::System.Linq.Enumerable.ToDictionary(
response.Headers,
static header => header.Key,
static header => (global::System.Collections.Generic.IEnumerable<string>)global::System.Linq.Enumerable.ToArray(header.Value),
global::System.StringComparer.OrdinalIgnoreCase);

if (response.Content?.Headers == null)
{
return headers;
}

foreach (var header in response.Content.Headers)
{
if (headers.TryGetValue(header.Key, out var existingValues))
{
headers[header.Key] = global::System.Linq.Enumerable.ToArray(
global::System.Linq.Enumerable.Concat(existingValues, header.Value));
}
else
{
headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value);
}
}

return headers;
}
}

/// <summary>
/// Represents a successful HTTP response with status code, headers, and body.
/// </summary>
public partial class AutoSDKHttpResponse<T> : AutoSDKHttpResponse
{
/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
T body)
: this(
statusCode: statusCode,
headers: headers,
requestUri: null,
body: body)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
global::System.Uri? requestUri,
T body)
: base(statusCode, headers, requestUri)
{
Body = body;
}

/// <summary>
/// Gets the response body.
/// </summary>
public T Body { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,36 @@ public partial interface IReplicateClient
/// }<br/>
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AccountGetResponse> AccountGetAsync(
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Get the authenticated account<br/>
/// Returns information about the user or organization associated with the provided API token.<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// https://api.replicate.com/v1/account<br/>
/// ```<br/>
/// The response will be a JSON object describing the account:<br/>
/// ```json<br/>
/// {<br/>
/// "type": "organization",<br/>
/// "username": "acme",<br/>
/// "name": "Acme Corp, Inc.",<br/>
/// "github_url": "https://github.com/acme",<br/>
/// }<br/>
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AutoSDKHttpResponse<global::Replicate.AccountGetResponse>> AccountGetAsResponseAsync(
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,39 @@ public partial interface IReplicateClient
/// ```
/// </summary>
/// <param name="collectionSlug"></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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.SchemasCollectionResponse> CollectionsGetAsync(
string collectionSlug,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Get a collection of models<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// https://api.replicate.com/v1/collections/super-resolution<br/>
/// ```<br/>
/// The response will be a collection object with a nested list of the models in that collection:<br/>
/// ```json<br/>
/// {<br/>
/// "name": "Super resolution",<br/>
/// "slug": "super-resolution",<br/>
/// "description": "Upscaling models that create high-quality images from low-quality images.",<br/>
/// "full_description": "## Overview\n\nThese models generate high-quality images from low-quality images. Many of these models are based on **advanced upscaling techniques**.\n\n### Key Features\n\n- Enhance image resolution\n- Restore fine details\n- Improve overall image quality",<br/>
/// "models": [...]<br/>
/// }<br/>
/// ```
/// </summary>
/// <param name="collectionSlug"></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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AutoSDKHttpResponse<global::Replicate.SchemasCollectionResponse>> CollectionsGetAsResponseAsync(
string collectionSlug,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,40 @@ public partial interface IReplicateClient
/// }<br/>
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.SchemasPaginatedCollectionResponse> CollectionsListAsync(
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// List collections of models<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// https://api.replicate.com/v1/collections<br/>
/// ```<br/>
/// The response will be a paginated JSON list of collection objects:<br/>
/// ```json<br/>
/// {<br/>
/// "next": "null",<br/>
/// "previous": null,<br/>
/// "results": [<br/>
/// {<br/>
/// "name": "Super resolution",<br/>
/// "slug": "super-resolution",<br/>
/// "description": "Upscaling models that create high-quality images from low-quality images."<br/>
/// }<br/>
/// ]<br/>
/// }<br/>
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AutoSDKHttpResponse<global::Replicate.SchemasPaginatedCollectionResponse>> CollectionsListAsResponseAsync(
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,67 @@ public partial interface IReplicateClient
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.SchemasDeploymentResponse> DeploymentsCreateAsync(

global::Replicate.DeploymentsCreateRequest request,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Create a deployment<br/>
/// Create a new deployment:<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s \<br/>
/// -X POST \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H "Content-Type: application/json" \<br/>
/// -d '{<br/>
/// "name": "my-app-image-generator",<br/>
/// "model": "stability-ai/sdxl",<br/>
/// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",<br/>
/// "hardware": "gpu-t4",<br/>
/// "min_instances": 0,<br/>
/// "max_instances": 3<br/>
/// }' \<br/>
/// https://api.replicate.com/v1/deployments<br/>
/// ```<br/>
/// The response will be a JSON object describing the deployment:<br/>
/// ```json<br/>
/// {<br/>
/// "owner": "acme",<br/>
/// "name": "my-app-image-generator",<br/>
/// "current_release": {<br/>
/// "number": 1,<br/>
/// "model": "stability-ai/sdxl",<br/>
/// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",<br/>
/// "created_at": "2024-02-15T16:32:57.018467Z",<br/>
/// "created_by": {<br/>
/// "type": "organization",<br/>
/// "username": "acme",<br/>
/// "name": "Acme Corp, Inc.",<br/>
/// "avatar_url": "https://cdn.replicate.com/avatars/acme.png",<br/>
/// "github_url": "https://github.com/acme"<br/>
/// },<br/>
/// "configuration": {<br/>
/// "hardware": "gpu-t4",<br/>
/// "min_instances": 1,<br/>
/// "max_instances": 5<br/>
/// }<br/>
/// }<br/>
/// }<br/>
/// ```
/// </summary>
/// <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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AutoSDKHttpResponse<global::Replicate.SchemasDeploymentResponse>> DeploymentsCreateAsResponseAsync(

global::Replicate.DeploymentsCreateRequest request,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Create a deployment<br/>
Expand Down Expand Up @@ -119,6 +175,7 @@ public partial interface IReplicateClient
/// <param name="version">
/// The 64-character string ID of the model version that you want to deploy.
/// </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::Replicate.SchemasDeploymentResponse> DeploymentsCreateAsync(
Expand All @@ -128,6 +185,7 @@ public partial interface IReplicateClient
string model,
string name,
string version,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,36 @@ public partial interface IReplicateClient
/// </summary>
/// <param name="deploymentOwner"></param>
/// <param name="deploymentName"></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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task DeploymentsDeleteAsync(
string deploymentOwner,
string deploymentName,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Delete a deployment<br/>
/// Delete a deployment<br/>
/// Deployment deletion has some restrictions:<br/>
/// - You can only delete deployments that have been offline and unused for at least 15 minutes.<br/>
/// Example cURL request:<br/>
/// ```command<br/>
/// curl -s -X DELETE \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator<br/>
/// ```<br/>
/// The response will be an empty 204, indicating the deployment has been deleted.
/// </summary>
/// <param name="deploymentOwner"></param>
/// <param name="deploymentName"></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::Replicate.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Replicate.AutoSDKHttpResponse> DeploymentsDeleteAsResponseAsync(
string deploymentOwner,
string deploymentName,
global::Replicate.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Loading