diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml new file mode 100644 index 0000000..ea4b6fa --- /dev/null +++ b/.github/workflows/auto-update.yml @@ -0,0 +1,63 @@ +name: Opens a new PR if there are OpenAPI updates +on: + schedule: + - cron: '0 */3 * * *' + +permissions: + contents: write + pull-requests: write + actions: write + +jobs: + check-openapi-updates: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Git user + run: | + git config --local user.email "bot@openai.com" + git config --local user.name "github-actions[bot]" + + - name: Generate branch name + id: branch + run: echo "branch_name=bot/update-openapi_$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT + + - name: Create branch + run: | + git checkout -b ${{ steps.branch.outputs.branch_name }} origin/main + git rebase main + + - name: Generate code + run: | + cd src/libs/Replicate + chmod +x ./generate.sh + ./generate.sh + + - name: Check for changes + id: changes + run: | + CHANGED=$(git diff --name-only) + if [ -z "$CHANGED" ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo "has_changes=true" >> $GITHUB_OUTPUT + fi + + - name: Push changes + if: steps.changes.outputs.has_changes == 'true' + run: | + git add . + git commit -m "feat: Updated OpenAPI spec" + git push --force-with-lease -u origin ${{ steps.branch.outputs.branch_name }} + + - name: Wait for 15 seconds + if: steps.changes.outputs.has_changes == 'true' + run: sleep 15 + + - name: Create pull request + if: steps.changes.outputs.has_changes == 'true' + run: gh pr create -B main -H ${{ steps.branch.outputs.branch_name }} --title 'feat:@coderabbitai' --body '@coderabbitai summary' + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index dc66f20..768d607 100755 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,16 +1,38 @@ -name: Build, test and publish +name: Publish on: push: branches: - main + tags: + - v* + +permissions: + contents: write jobs: - build-test-publish: - name: Build, test and publish + publish: + name: Publish uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main with: generate-build-number: false conventional-commits-publish-conditions: false + enable-caching: false additional-test-arguments: '--logger GitHubActions' secrets: - nuget-key: ${{ secrets.NUGET_KEY }} \ No newline at end of file + nuget-key: ${{ secrets.NUGET_KEY }} + + release: + name: Release + runs-on: ubuntu-latest + needs: [publish] + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create release + run: gh release create ${{ github.ref_name }} + --title "${{ github.ref_name }}" + --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 0000000..44b610b --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -0,0 +1,56 @@ +name: MKDocs Deploy +on: + push: + branches: + - main + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'examples/**' + - 'src/helpers/GenerateDocs/**' + - '.github/workflows/mkdocs.yml' + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Install dependencies + run: pip install mkdocs-material + + - name: Generate docs + run: dotnet run --project src/helpers/GenerateDocs/GenerateDocs.csproj . + + - name: Build with MkDocs + run: mkdocs build -d ./_site + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/Replicate.sln b/Replicate.sln index accf1a1..4b81cf1 100755 --- a/Replicate.sln +++ b/Replicate.sln @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md docs\openapi.json = docs\openapi.json .github\workflows\pull-request.yml = .github\workflows\pull-request.yml + .github\workflows\auto-update.yml = .github\workflows\auto-update.yml + .github\workflows\mkdocs.yml = .github\workflows\mkdocs.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{61E7E11E-4558-434C-ACE8-06316A3097B3}" @@ -26,7 +28,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replicate", "src\libs\Repli EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replicate.IntegrationTests", "src\tests\Replicate.IntegrationTests\Replicate.IntegrationTests.csproj", "{592ADBC9-C951-4AF7-A163-B6C63B970B19}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replicate.Models", "src\libs\Replicate.Models\Replicate.Models.csproj", "{B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helpers", "helpers", "{4A7E933D-CAA6-4A0E-A762-BE49BE291515}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixOpenApiSpec", "src\helpers\FixOpenApiSpec\FixOpenApiSpec.csproj", "{51395B9A-1474-4263-AB97-CFBEED8BAD3F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateDocs", "src\helpers\GenerateDocs\GenerateDocs.csproj", "{2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrimmingHelper", "src\helpers\TrimmingHelper\TrimmingHelper.csproj", "{AF5820E5-E366-4DB2-B9D6-A7811637CE0B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -42,10 +50,18 @@ Global {592ADBC9-C951-4AF7-A163-B6C63B970B19}.Debug|Any CPU.Build.0 = Debug|Any CPU {592ADBC9-C951-4AF7-A163-B6C63B970B19}.Release|Any CPU.ActiveCfg = Release|Any CPU {592ADBC9-C951-4AF7-A163-B6C63B970B19}.Release|Any CPU.Build.0 = Release|Any CPU - {B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B}.Release|Any CPU.Build.0 = Release|Any CPU + {51395B9A-1474-4263-AB97-CFBEED8BAD3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51395B9A-1474-4263-AB97-CFBEED8BAD3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51395B9A-1474-4263-AB97-CFBEED8BAD3F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51395B9A-1474-4263-AB97-CFBEED8BAD3F}.Release|Any CPU.Build.0 = Release|Any CPU + {2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA}.Release|Any CPU.Build.0 = Release|Any CPU + {AF5820E5-E366-4DB2-B9D6-A7811637CE0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF5820E5-E366-4DB2-B9D6-A7811637CE0B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF5820E5-E366-4DB2-B9D6-A7811637CE0B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF5820E5-E366-4DB2-B9D6-A7811637CE0B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -53,7 +69,9 @@ Global GlobalSection(NestedProjects) = preSolution {0028BC85-0064-4CE8-A21A-C1F5E922BD59} = {61E7E11E-4558-434C-ACE8-06316A3097B3} {592ADBC9-C951-4AF7-A163-B6C63B970B19} = {AAA11B78-2764-4520-A97E-46AA7089A588} - {B5C719C1-9F51-4874-9FBF-2D62CCCDBD1B} = {61E7E11E-4558-434C-ACE8-06316A3097B3} + {51395B9A-1474-4263-AB97-CFBEED8BAD3F} = {4A7E933D-CAA6-4A0E-A762-BE49BE291515} + {2E3D948F-EDC6-4B62-9ED1-0ABADABD4EAA} = {4A7E933D-CAA6-4A0E-A762-BE49BE291515} + {AF5820E5-E366-4DB2-B9D6-A7811637CE0B} = {4A7E933D-CAA6-4A0E-A762-BE49BE291515} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CED9A020-DBA5-4BE6-8096-75E528648EC1} diff --git a/docs/css/extra.css b/docs/css/extra.css new file mode 100644 index 0000000..f217483 --- /dev/null +++ b/docs/css/extra.css @@ -0,0 +1,102 @@ +/* Logo title */ +.md-header__topic:first-child { + font-weight: initial !important; +} + +/* Code font size in
*/ +details .linenos, details code { + font-size: inherit !important; +} + +/* Code block / tab in details */ +details > summary + .highlight:last-child, details > summary + .tabbed-set:last-child { margin: 0 -0.6rem !important; } +details > summary + .highlight:last-child > .highlighttable { margin: 0 !important; } + +/* Table full width */ +.md-typeset__table { display: block !important; } +.md-typeset table:not(.highlighttable) { display: table !important; } + +.md-typeset table:not([class]) th { + min-width: 0rem; +} + +.headerlink { transform: translateY(-2.5px); } + +.md-nav__link[for=__toc] .md-icon { margin-left: auto !important; } + +blockquote.page-time { + margin: 20px 0 !important; + border-left-color: #64b5f6 !important; /* Just change the color value and that's it*/ +} +blockquote.page-copyright { + margin: 20px 0 !important; + border-left-color: #ff1700 !important; /* Just change the color value and that's it*/ +} +blockquote.page-copyright i.md-icon { + display: inline-block; + margin-right: 5px; + transform: translateY(3.5px); + width: 18px; +} + +#myBtn { + display: none; + position: fixed; + bottom: 100px; + right: 16px; + z-index: 99; + border: none; + outline: none; + color: #8590a6; + cursor: pointer; + padding: .7rem; + border-radius: .4rem; +} + +#myBtn:hover { + background-color: #d3d3d3; +} + +#color-button > button { + cursor: pointer; + transition: opacity .25s; + display: inline-block; + width: 6.5rem; + margin-bottom: 0.2rem; + padding: 1.2rem 0.4rem 0.2rem; + font-size: 0.64rem; + text-align: left; +} + +#color-button > button[data-md-color-primary] { + background-color: var(--md-primary-fg-color); + color: var(--md-primary-bg-color); +} +#color-button > button[data-md-color-primary=white] { + box-shadow: inset 0 0 0.05rem rgb(0 0 0 / 54%); +} + +#color-button > button[data-md-color-accent] { + background-color: var(--md-accent-fg-color); + color: var(--md-code-bg-color); +} + +mjx-container > img { + width: 0; + height: 0; +} + +[data-md-color-scheme="slate"] { + --md-primary-fg-color: #2e303e; + --md-accent-fg-color: #00bda4; + --md-typeset-a-color: #526cfe; +} + +[data-md-color-scheme="slate"] .md-typeset img { + background: white; + filter: brightness(0.9); +} + +[data-md-color-scheme="slate"] .md-typeset img[src$=".svg"] { + border: 4px solid white; +} \ No newline at end of file diff --git a/docs/media/icon128.png b/docs/media/icon128.png new file mode 100644 index 0000000..05d2b17 Binary files /dev/null and b/docs/media/icon128.png differ diff --git a/global.json b/global.json new file mode 100644 index 0000000..eafb435 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..3797080 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,108 @@ +site_name: OpenAI .NET Documentation +nav: +- Overview: index.md +# EXAMPLES # + +# - Quick Start: QuickStart.md +# - Architecture: Architecture.md +# - FAQ: FAQ.md +# - Contributing Guide: ContributingGuide.md +# - Tutorials: +# - Configure the native library loading: Tutorials/NativeLibraryConfig.md +# - Use executors: Tutorials/Executors.md +# - Use ChatSession: Tutorials/ChatSession.md +# - Understand LLamaContext: Tutorials/UnderstandLLamaContext.md +# - Get embeddings: Tutorials/GetEmbeddings.md +# - Quantize the model: Tutorials/Quantization.md +# +# - Advanced Tutorials: +# - Customize the native library loading: AdvancedTutorials/CustomizeNativeLibraryLoading.md +# +# - Integrations: +# - semantic-kernel integration: Integrations/semantic-kernel.md +# - kernel-memory integration: Integrations/kernel-memory.md +# - BotSharp integration: Integrations/BotSharp.md +# - Langchain integration: Integrations/Langchain.md +# +# - Examples: +# - Bacthed executor - multi-output to one input: Examples/BatchedExecutorFork.md +# - Batched executor - basic guidance: Examples/BatchedExecutorGuidance.md +# - Batched executor - rewinding to an earlier state: Examples/BatchedExecutorRewind.md + +theme: + name: material + static_templates: + - 404.html + language: 'en' + palette: + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: white + accent: red + toggle: + icon: material/weather-sunny + name: Switch to dark mode + + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: blue + accent: blue + toggle: + icon: material/weather-night + name: Switch to light mode + include_search_page: false + search_index_only: true + favicon: 'media/icon128.png' + icon: + logo: 'material/file-document' + features: + - content.action.edit + - navigation.instant + font: + text: 'Fira Sans' + code: 'Fira Mono' + +extra: + version: + provider: mike + +extra_css: + - 'css/extra.css?v=14' + +markdown_extensions: + - admonition + - def_list + - footnotes + - meta + - toc: + permalink: "" + slugify: !!python/name:pymdownx.slugs.uslugify + - pymdownx.arithmatex: + generic: true + - pymdownx.caret + - pymdownx.critic + - pymdownx.details + - pymdownx.emoji: + emoji_generator: !!python/name:pymdownx.emoji.to_svg + - pymdownx.highlight: + linenums: true + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.magiclink + - pymdownx.mark + - pymdownx.snippets: + check_paths: true + - pymdownx.progressbar + - pymdownx.smartsymbols + - pymdownx.superfences: + custom_fences: + - name: math + class: arithmatex + format: !!python/name:pymdownx.arithmatex.fence_mathjax_format + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde + - pymdownx.tabbed: + alternate_style: true \ No newline at end of file diff --git a/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj b/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj new file mode 100644 index 0000000..deaad92 --- /dev/null +++ b/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + Exe + preview + enable + enable + + + + + + + diff --git a/src/helpers/FixOpenApiSpec/Program.cs b/src/helpers/FixOpenApiSpec/Program.cs new file mode 100644 index 0000000..ad9a6ea --- /dev/null +++ b/src/helpers/FixOpenApiSpec/Program.cs @@ -0,0 +1,30 @@ +using Microsoft.OpenApi; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Readers; + +var path = args[0]; +var text = await File.ReadAllTextAsync(path); + +text = text + .Replace("\"openapi\":\"3.1.0\"", "\"openapi\":\"3.0.1\"") + ; + +var openApiDocument = new OpenApiStringReader().Read(text, out var diagnostics); + +//openApiDocument.Components.Schemas["CreateEmbeddingRequest"]!.Properties["dimensions"].Nullable = true; + +text = openApiDocument.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0); +_ = new OpenApiStringReader().Read(text, out diagnostics); + +if (diagnostics.Errors.Count > 0) +{ + foreach (var error in diagnostics.Errors) + { + Console.WriteLine(error.Message); + } + // Return Exit code 1 + Environment.Exit(1); +} + +await File.WriteAllTextAsync(path, text); \ No newline at end of file diff --git a/src/helpers/GenerateDocs/GenerateDocs.csproj b/src/helpers/GenerateDocs/GenerateDocs.csproj new file mode 100644 index 0000000..f67f521 --- /dev/null +++ b/src/helpers/GenerateDocs/GenerateDocs.csproj @@ -0,0 +1,9 @@ + + + + Exe + net8.0 + enable + + + diff --git a/src/helpers/GenerateDocs/Program.cs b/src/helpers/GenerateDocs/Program.cs new file mode 100644 index 0000000..9c5146c --- /dev/null +++ b/src/helpers/GenerateDocs/Program.cs @@ -0,0 +1,37 @@ +var solutionDirectory = args.ElementAtOrDefault(0) ?? Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "../../../../../..")); +var sampleDirectory = Path.Combine(solutionDirectory, "src", "tests", "Replicate.IntegrationTests"); +var mkDocsPath = Path.Combine(solutionDirectory, "mkdocs.yml"); + +var newDir = Path.Combine(solutionDirectory, "docs", "samples"); +Directory.CreateDirectory(newDir); + +File.Copy( + Path.Combine(solutionDirectory, "README.md"), + Path.Combine(solutionDirectory, "docs", "index.md")); + +Console.WriteLine($"Generating samples from {sampleDirectory}..."); +foreach (var path in Directory.EnumerateFiles(sampleDirectory, "Tests.*.cs", SearchOption.AllDirectories)) +{ + var code = await File.ReadAllTextAsync(path); + + var start = code.IndexOf("\n {", StringComparison.Ordinal); + var end = code.IndexOf("\n }", StringComparison.Ordinal); + code = code.Substring(start + 4, end - start + 4); + + var lines = code.Split('\n')[1..^2]; + code = string.Join('\n', lines.Select(x => x.Length > 8 ? x[8..] : string.Empty)); + + var newPath = Path.Combine(newDir, $"{Path.GetExtension(Path.GetFileNameWithoutExtension(path)).TrimStart('.')}.md"); + await File.WriteAllTextAsync(newPath, $@"```csharp +{code} +```"); +} + +var mkDocs = await File.ReadAllTextAsync(mkDocsPath); +var newMkDocs = mkDocs.Replace( + "# EXAMPLES #", + $"- Examples:{string.Concat(Directory.EnumerateFiles(Path.Combine(solutionDirectory, "docs", "samples"), "*.md") + .Select(x => $@" + - {Path.GetFileNameWithoutExtension(x)}: samples/{Path.GetFileNameWithoutExtension(x)}.md"))}"); +await File.WriteAllTextAsync(mkDocsPath, newMkDocs); + diff --git a/src/helpers/TrimmingHelper/Program.cs b/src/helpers/TrimmingHelper/Program.cs new file mode 100644 index 0000000..3b94c99 --- /dev/null +++ b/src/helpers/TrimmingHelper/Program.cs @@ -0,0 +1 @@ +Console.WriteLine("Build, rebuild or publish this app to see trimming warnings."); \ No newline at end of file diff --git a/src/helpers/TrimmingHelper/TrimmingHelper.csproj b/src/helpers/TrimmingHelper/TrimmingHelper.csproj new file mode 100644 index 0000000..07bdf27 --- /dev/null +++ b/src/helpers/TrimmingHelper/TrimmingHelper.csproj @@ -0,0 +1,30 @@ + + + + Exe + net8.0 + enable + + true + + + + + + + + + + + + win-x64 + osx-arm64 + + true + + + + + + + diff --git a/src/libs/Replicate.Models/Replicate.Models.csproj b/src/libs/Replicate.Models/Replicate.Models.csproj deleted file mode 100644 index bad4e9a..0000000 --- a/src/libs/Replicate.Models/Replicate.Models.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - netstandard2.0;net4.6.2;net6.0;net8.0 - - - - - - - - tryAGI.Replicate.Models - Generated C# SDK based on Replicate OpenAPI specification. - api;client;sdk;dotnet;swagger;openapi;specification;replicate;generated;nswag - - - - Replicate - false - true - true - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - diff --git a/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseType.g.cs b/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseType.g.cs new file mode 100644 index 0000000..e97b4d8 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class AccountGetResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.AccountGetResponseType 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.AccountGetResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.AccountGetResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.AccountGetResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.AccountGetResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseTypeNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseTypeNullable.g.cs new file mode 100644 index 0000000..ca096cd --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.AccountGetResponseTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class AccountGetResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.AccountGetResponseType? 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.AccountGetResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.AccountGetResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.AccountGetResponseType? 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.AccountGetResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..5402c31 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsCreateResponseCurrentReleaseCreatedByTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType 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.DeploymentsCreateResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeNullable.g.cs new file mode 100644 index 0000000..0976166 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsCreateResponseCurrentReleaseCreatedByTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType? 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.DeploymentsCreateResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType? 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.DeploymentsCreateResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..d540e25 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsGetResponseCurrentReleaseCreatedByTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType 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.DeploymentsGetResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeNullable.g.cs new file mode 100644 index 0000000..083b55f --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsGetResponseCurrentReleaseCreatedByTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType? 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.DeploymentsGetResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType? 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.DeploymentsGetResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..89f17ff --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsListResponseResultCurrentReleaseCreatedByTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType 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.DeploymentsListResponseResultCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeNullable.g.cs new file mode 100644 index 0000000..2463051 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsListResponseResultCurrentReleaseCreatedByTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType? 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.DeploymentsListResponseResultCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType? 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.DeploymentsListResponseResultCurrentReleaseCreatedByTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..931d54e --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsUpdateResponseCurrentReleaseCreatedByTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType 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.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeNullable.g.cs new file mode 100644 index 0000000..fd085ed --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class DeploymentsUpdateResponseCurrentReleaseCreatedByTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType? 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.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType? 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.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibility.g.cs b/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibility.g.cs new file mode 100644 index 0000000..eae9a06 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibility.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class ModelsCreateRequestVisibilityJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.ModelsCreateRequestVisibility 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.ModelsCreateRequestVisibilityExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.ModelsCreateRequestVisibility)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.ModelsCreateRequestVisibility value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.ModelsCreateRequestVisibilityExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibilityNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibilityNullable.g.cs new file mode 100644 index 0000000..f7c738c --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.ModelsCreateRequestVisibilityNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class ModelsCreateRequestVisibilityNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.ModelsCreateRequestVisibility? 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.ModelsCreateRequestVisibilityExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.ModelsCreateRequestVisibility)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.ModelsCreateRequestVisibility? 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.ModelsCreateRequestVisibilityExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..0d9f1a5 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class PredictionRequestWebhookEventsFilterItemJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.PredictionRequestWebhookEventsFilterItem 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.PredictionRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.PredictionRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.PredictionRequestWebhookEventsFilterItem value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.PredictionRequestWebhookEventsFilterItemExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItemNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItemNullable.g.cs new file mode 100644 index 0000000..cc4ece9 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.PredictionRequestWebhookEventsFilterItemNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class PredictionRequestWebhookEventsFilterItemNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.PredictionRequestWebhookEventsFilterItem? 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.PredictionRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.PredictionRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.PredictionRequestWebhookEventsFilterItem? 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.PredictionRequestWebhookEventsFilterItemExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..6a42f06 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class TrainingRequestWebhookEventsFilterItemJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.TrainingRequestWebhookEventsFilterItem 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.TrainingRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.TrainingRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.TrainingRequestWebhookEventsFilterItem value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.TrainingRequestWebhookEventsFilterItemExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItemNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItemNullable.g.cs new file mode 100644 index 0000000..8091d11 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.TrainingRequestWebhookEventsFilterItemNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class TrainingRequestWebhookEventsFilterItemNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.TrainingRequestWebhookEventsFilterItem? 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.TrainingRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.TrainingRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.TrainingRequestWebhookEventsFilterItem? 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.TrainingRequestWebhookEventsFilterItemExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..a35efd8 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class VersionPredictionRequestWebhookEventsFilterItemJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.VersionPredictionRequestWebhookEventsFilterItem 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.VersionPredictionRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.VersionPredictionRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.VersionPredictionRequestWebhookEventsFilterItem value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Replicate.VersionPredictionRequestWebhookEventsFilterItemExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItemNullable.g.cs b/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItemNullable.g.cs new file mode 100644 index 0000000..5291dc7 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonConverters.VersionPredictionRequestWebhookEventsFilterItemNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace OpenApiGenerator.JsonConverters +{ + /// + public sealed class VersionPredictionRequestWebhookEventsFilterItemNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Replicate.VersionPredictionRequestWebhookEventsFilterItem? 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.VersionPredictionRequestWebhookEventsFilterItemExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Replicate.VersionPredictionRequestWebhookEventsFilterItem)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Replicate.VersionPredictionRequestWebhookEventsFilterItem? 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.VersionPredictionRequestWebhookEventsFilterItemExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Replicate/Generated/JsonSerializerContext.g.cs b/src/libs/Replicate/Generated/JsonSerializerContext.g.cs new file mode 100644 index 0000000..358e4d7 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonSerializerContext.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant + +namespace Replicate +{ + /// + /// + /// + [global::System.Text.Json.Serialization.JsonSourceGenerationOptions( + DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + Converters = new global::System.Type[] + { + typeof(global::OpenApiGenerator.JsonConverters.PredictionRequestWebhookEventsFilterItemJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.PredictionRequestWebhookEventsFilterItemNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.TrainingRequestWebhookEventsFilterItemJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.TrainingRequestWebhookEventsFilterItemNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.VersionPredictionRequestWebhookEventsFilterItemJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.VersionPredictionRequestWebhookEventsFilterItemNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.ModelsCreateRequestVisibilityJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.ModelsCreateRequestVisibilityNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.AccountGetResponseTypeJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.AccountGetResponseTypeNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeNullableJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeJsonConverter), + typeof(global::OpenApiGenerator.JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeNullableJsonConverter), + })] + + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Replicate.JsonSerializerContextTypes))] + public sealed partial class SourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext + { + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/JsonSerializerContextTypes.g.cs b/src/libs/Replicate/Generated/JsonSerializerContextTypes.g.cs new file mode 100644 index 0000000..b12d695 --- /dev/null +++ b/src/libs/Replicate/Generated/JsonSerializerContextTypes.g.cs @@ -0,0 +1,202 @@ + +#nullable enable + +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Replicate +{ + /// + /// + /// + public sealed partial class JsonSerializerContextTypes + { + /// + /// + /// + public global::Replicate.PredictionRequest? Type0 { get; set; } + /// + /// + /// + public global::Replicate.PredictionRequestInput? Type1 { get; set; } + /// + /// + /// + public bool? Type2 { get; set; } + /// + /// + /// + public string? Type3 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type4 { get; set; } + /// + /// + /// + public global::Replicate.PredictionRequestWebhookEventsFilterItem? Type5 { get; set; } + /// + /// + /// + public global::Replicate.TrainingRequest? Type6 { get; set; } + /// + /// + /// + public global::Replicate.TrainingRequestInput? Type7 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type8 { get; set; } + /// + /// + /// + public global::Replicate.TrainingRequestWebhookEventsFilterItem? Type9 { get; set; } + /// + /// + /// + public global::Replicate.VersionPredictionRequest? Type10 { get; set; } + /// + /// + /// + public global::Replicate.VersionPredictionRequestInput? Type11 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type12 { get; set; } + /// + /// + /// + public global::Replicate.VersionPredictionRequestWebhookEventsFilterItem? Type13 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateRequest? Type14 { get; set; } + /// + /// + /// + public int? Type15 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateRequest? Type16 { get; set; } + /// + /// + /// + public global::Replicate.ModelsCreateRequest? Type17 { get; set; } + /// + /// + /// + public global::Replicate.ModelsCreateRequestVisibility? Type18 { get; set; } + /// + /// + /// + public global::Replicate.AccountGetResponse? Type19 { get; set; } + /// + /// + /// + public global::Replicate.AccountGetResponseType? Type20 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponse? Type21 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type22 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponseResult? Type23 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponseResultCurrentRelease? Type24 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponseResultCurrentReleaseConfiguration? Type25 { get; set; } + /// + /// + /// + public global::System.DateTime? Type26 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedBy? Type27 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType? Type28 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateResponse? Type29 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateResponseCurrentRelease? Type30 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateResponseCurrentReleaseConfiguration? Type31 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedBy? Type32 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType? Type33 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsGetResponse? Type34 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsGetResponseCurrentRelease? Type35 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsGetResponseCurrentReleaseConfiguration? Type36 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedBy? Type37 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType? Type38 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateResponse? Type39 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateResponseCurrentRelease? Type40 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseConfiguration? Type41 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedBy? Type42 { get; set; } + /// + /// + /// + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType? Type43 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type44 { get; set; } + /// + /// + /// + public global::Replicate.HardwareListResponseItem? Type45 { get; set; } + /// + /// + /// + public global::Replicate.WebhooksDefaultSecretGetResponse? Type46 { get; set; } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponse.g.cs new file mode 100644 index 0000000..92ba558 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponse.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class AccountGetResponse + { + /// + /// The GitHub URL of the account. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The name of the account. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The account type. Can be a user or an organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AccountGetResponseTypeJsonConverter))] + public global::Replicate.AccountGetResponseType? Type { get; set; } + + /// + /// The username of the account. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("username")] + public string? Username { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponseType.g.cs b/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponseType.g.cs new file mode 100644 index 0000000..675cc68 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.AccountGetResponseType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The account type. Can be a user or an organization. + /// + public enum AccountGetResponseType + { + /// + /// + /// + Organization, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class AccountGetResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this AccountGetResponseType value) + { + return value switch + { + AccountGetResponseType.Organization => "organization", + AccountGetResponseType.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static AccountGetResponseType? ToEnum(string value) + { + return value switch + { + "organization" => AccountGetResponseType.Organization, + "user" => AccountGetResponseType.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateRequest.g.cs new file mode 100644 index 0000000..c807d9a --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateRequest.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsCreateRequest + { + /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MinInstances { get; set; } + + /// + /// The full name of the model that you want to deploy e.g. stability-ai/sdxl. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Model { get; set; } + + /// + /// The name of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// The 64-character string ID of the model version that you want to deploy. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponse.g.cs new file mode 100644 index 0000000..c690275 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponse.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsCreateResponse + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("current_release")] + public global::Replicate.DeploymentsCreateResponseCurrentRelease? CurrentRelease { get; set; } + + /// + /// The name of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The owner of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("owner")] + public string? Owner { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentRelease.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentRelease.g.cs new file mode 100644 index 0000000..5ef4dc4 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentRelease.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsCreateResponseCurrentRelease + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("configuration")] + public global::Replicate.DeploymentsCreateResponseCurrentReleaseConfiguration? Configuration { get; set; } + + /// + /// The time the release was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_by")] + public global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedBy? CreatedBy { get; set; } + + /// + /// The model identifier string in the format of `{model_owner}/{model_name}`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// The release number. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("number")] + public int Number { get; set; } + + /// + /// The ID of the model version used in the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + public string? Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseConfiguration.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseConfiguration.g.cs new file mode 100644 index 0000000..1f7b9e7 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseConfiguration.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsCreateResponseCurrentReleaseConfiguration + { + /// + /// The SKU for the hardware used to run the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + public string? Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + public int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + public int MinInstances { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedBy.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedBy.g.cs new file mode 100644 index 0000000..d941274 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedBy.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsCreateResponseCurrentReleaseCreatedBy + { + /// + /// The GitHub URL of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The name of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The account type of the creator. Can be a user or an organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.DeploymentsCreateResponseCurrentReleaseCreatedByTypeJsonConverter))] + public global::Replicate.DeploymentsCreateResponseCurrentReleaseCreatedByType? Type { get; set; } + + /// + /// The username of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("username")] + public string? Username { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..b4ed9ca --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsCreateResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The account type of the creator. Can be a user or an organization. + /// + public enum DeploymentsCreateResponseCurrentReleaseCreatedByType + { + /// + /// + /// + Organization, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class DeploymentsCreateResponseCurrentReleaseCreatedByTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this DeploymentsCreateResponseCurrentReleaseCreatedByType value) + { + return value switch + { + DeploymentsCreateResponseCurrentReleaseCreatedByType.Organization => "organization", + DeploymentsCreateResponseCurrentReleaseCreatedByType.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static DeploymentsCreateResponseCurrentReleaseCreatedByType? ToEnum(string value) + { + return value switch + { + "organization" => DeploymentsCreateResponseCurrentReleaseCreatedByType.Organization, + "user" => DeploymentsCreateResponseCurrentReleaseCreatedByType.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponse.g.cs new file mode 100644 index 0000000..6741baa --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponse.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsGetResponse + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("current_release")] + public global::Replicate.DeploymentsGetResponseCurrentRelease? CurrentRelease { get; set; } + + /// + /// The name of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The owner of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("owner")] + public string? Owner { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentRelease.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentRelease.g.cs new file mode 100644 index 0000000..f4b2ab3 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentRelease.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsGetResponseCurrentRelease + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("configuration")] + public global::Replicate.DeploymentsGetResponseCurrentReleaseConfiguration? Configuration { get; set; } + + /// + /// The time the release was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_by")] + public global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedBy? CreatedBy { get; set; } + + /// + /// The model identifier string in the format of `{model_owner}/{model_name}`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// The release number. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("number")] + public int Number { get; set; } + + /// + /// The ID of the model version used in the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + public string? Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseConfiguration.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseConfiguration.g.cs new file mode 100644 index 0000000..fe01437 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseConfiguration.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsGetResponseCurrentReleaseConfiguration + { + /// + /// The SKU for the hardware used to run the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + public string? Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + public int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + public int MinInstances { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedBy.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedBy.g.cs new file mode 100644 index 0000000..c9d956c --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedBy.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsGetResponseCurrentReleaseCreatedBy + { + /// + /// The GitHub URL of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The name of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The account type of the creator. Can be a user or an organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.DeploymentsGetResponseCurrentReleaseCreatedByTypeJsonConverter))] + public global::Replicate.DeploymentsGetResponseCurrentReleaseCreatedByType? Type { get; set; } + + /// + /// The username of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("username")] + public string? Username { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..275cf82 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsGetResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The account type of the creator. Can be a user or an organization. + /// + public enum DeploymentsGetResponseCurrentReleaseCreatedByType + { + /// + /// + /// + Organization, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class DeploymentsGetResponseCurrentReleaseCreatedByTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this DeploymentsGetResponseCurrentReleaseCreatedByType value) + { + return value switch + { + DeploymentsGetResponseCurrentReleaseCreatedByType.Organization => "organization", + DeploymentsGetResponseCurrentReleaseCreatedByType.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static DeploymentsGetResponseCurrentReleaseCreatedByType? ToEnum(string value) + { + return value switch + { + "organization" => DeploymentsGetResponseCurrentReleaseCreatedByType.Organization, + "user" => DeploymentsGetResponseCurrentReleaseCreatedByType.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponse.g.cs new file mode 100644 index 0000000..46f21f8 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponse.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsListResponse + { + /// + /// A URL pointing to the next page of deployment objects if any + /// + [global::System.Text.Json.Serialization.JsonPropertyName("next")] + public string? Next { get; set; } + + /// + /// A URL pointing to the previous page of deployment objects if any + /// + [global::System.Text.Json.Serialization.JsonPropertyName("previous")] + public string? Previous { get; set; } + + /// + /// An array containing a page of deployment objects + /// + [global::System.Text.Json.Serialization.JsonPropertyName("results")] + public global::System.Collections.Generic.IList? Results { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResult.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResult.g.cs new file mode 100644 index 0000000..a553df6 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResult.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsListResponseResult + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("current_release")] + public global::Replicate.DeploymentsListResponseResultCurrentRelease? CurrentRelease { get; set; } + + /// + /// The name of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The owner of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("owner")] + public string? Owner { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentRelease.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentRelease.g.cs new file mode 100644 index 0000000..766e3fb --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentRelease.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsListResponseResultCurrentRelease + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("configuration")] + public global::Replicate.DeploymentsListResponseResultCurrentReleaseConfiguration? Configuration { get; set; } + + /// + /// The time the release was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_by")] + public global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedBy? CreatedBy { get; set; } + + /// + /// The model identifier string in the format of `{model_owner}/{model_name}`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("number")] + public int Number { get; set; } + + /// + /// The ID of the model version used in the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + public string? Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseConfiguration.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseConfiguration.g.cs new file mode 100644 index 0000000..2001b18 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseConfiguration.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsListResponseResultCurrentReleaseConfiguration + { + /// + /// The SKU for the hardware used to run the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + public string? Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + public int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + public int MinInstances { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedBy.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedBy.g.cs new file mode 100644 index 0000000..d37e81e --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedBy.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsListResponseResultCurrentReleaseCreatedBy + { + /// + /// The GitHub URL of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The name of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The account type of the creator. Can be a user or an organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.DeploymentsListResponseResultCurrentReleaseCreatedByTypeJsonConverter))] + public global::Replicate.DeploymentsListResponseResultCurrentReleaseCreatedByType? Type { get; set; } + + /// + /// The username of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("username")] + public string? Username { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..e832208 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsListResponseResultCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The account type of the creator. Can be a user or an organization. + /// + public enum DeploymentsListResponseResultCurrentReleaseCreatedByType + { + /// + /// + /// + Organization, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class DeploymentsListResponseResultCurrentReleaseCreatedByTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this DeploymentsListResponseResultCurrentReleaseCreatedByType value) + { + return value switch + { + DeploymentsListResponseResultCurrentReleaseCreatedByType.Organization => "organization", + DeploymentsListResponseResultCurrentReleaseCreatedByType.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static DeploymentsListResponseResultCurrentReleaseCreatedByType? ToEnum(string value) + { + return value switch + { + "organization" => DeploymentsListResponseResultCurrentReleaseCreatedByType.Organization, + "user" => DeploymentsListResponseResultCurrentReleaseCreatedByType.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateRequest.g.cs new file mode 100644 index 0000000..7d83f8a --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateRequest.g.cs @@ -0,0 +1,41 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsUpdateRequest + { + /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + public string? Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + public int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + public int MinInstances { get; set; } + + /// + /// The ID of the model version that you want to deploy + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + public string? Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponse.g.cs new file mode 100644 index 0000000..a55643c --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponse.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsUpdateResponse + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("current_release")] + public global::Replicate.DeploymentsUpdateResponseCurrentRelease? CurrentRelease { get; set; } + + /// + /// The name of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The owner of the deployment. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("owner")] + public string? Owner { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentRelease.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentRelease.g.cs new file mode 100644 index 0000000..161f617 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentRelease.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsUpdateResponseCurrentRelease + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("configuration")] + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseConfiguration? Configuration { get; set; } + + /// + /// The time the release was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_by")] + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedBy? CreatedBy { get; set; } + + /// + /// The model identifier string in the format of `{model_owner}/{model_name}`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// The release number. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("number")] + public int Number { get; set; } + + /// + /// The ID of the model version used in the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + public string? Version { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseConfiguration.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseConfiguration.g.cs new file mode 100644 index 0000000..0d19e39 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseConfiguration.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsUpdateResponseCurrentReleaseConfiguration + { + /// + /// The SKU for the hardware used to run the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + public string? Hardware { get; set; } + + /// + /// The maximum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("max_instances")] + public int MaxInstances { get; set; } + + /// + /// The minimum number of instances for scaling. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_instances")] + public int MinInstances { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedBy.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedBy.g.cs new file mode 100644 index 0000000..2814923 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedBy.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class DeploymentsUpdateResponseCurrentReleaseCreatedBy + { + /// + /// The GitHub URL of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The name of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The account type of the creator. Can be a user or an organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.DeploymentsUpdateResponseCurrentReleaseCreatedByTypeJsonConverter))] + public global::Replicate.DeploymentsUpdateResponseCurrentReleaseCreatedByType? Type { get; set; } + + /// + /// The username of the account that created the release. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("username")] + public string? Username { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs new file mode 100644 index 0000000..1bdd0ae --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.DeploymentsUpdateResponseCurrentReleaseCreatedByType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The account type of the creator. Can be a user or an organization. + /// + public enum DeploymentsUpdateResponseCurrentReleaseCreatedByType + { + /// + /// + /// + Organization, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class DeploymentsUpdateResponseCurrentReleaseCreatedByTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this DeploymentsUpdateResponseCurrentReleaseCreatedByType value) + { + return value switch + { + DeploymentsUpdateResponseCurrentReleaseCreatedByType.Organization => "organization", + DeploymentsUpdateResponseCurrentReleaseCreatedByType.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static DeploymentsUpdateResponseCurrentReleaseCreatedByType? ToEnum(string value) + { + return value switch + { + "organization" => DeploymentsUpdateResponseCurrentReleaseCreatedByType.Organization, + "user" => DeploymentsUpdateResponseCurrentReleaseCreatedByType.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.HardwareListResponseItem.g.cs b/src/libs/Replicate/Generated/Replicate.Models.HardwareListResponseItem.g.cs new file mode 100644 index 0000000..7f0ad04 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.HardwareListResponseItem.g.cs @@ -0,0 +1,29 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class HardwareListResponseItem + { + /// + /// The name of the hardware. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The SKU of the hardware. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("sku")] + public string? Sku { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequest.g.cs new file mode 100644 index 0000000..0abf3b6 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequest.g.cs @@ -0,0 +1,76 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class ModelsCreateRequest + { + /// + /// A URL for the model's cover image. This should be an image file. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cover_image_url")] + public string? CoverImageUrl { get; set; } + + /// + /// A description of the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// A URL for the model's source code on GitHub. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("github_url")] + public string? GithubUrl { get; set; } + + /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("hardware")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Hardware { get; set; } + + /// + /// A URL for the model's license. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("license_url")] + public string? LicenseUrl { get; set; } + + /// + /// The name of the model. This must be unique among all models owned by the user or organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("owner")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Owner { get; set; } + + /// + /// A URL for the model's paper. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("paper_url")] + public string? PaperUrl { get; set; } + + /// + /// Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("visibility")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ModelsCreateRequestVisibilityJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Replicate.ModelsCreateRequestVisibility Visibility { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequestVisibility.g.cs b/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequestVisibility.g.cs new file mode 100644 index 0000000..12e1eaa --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.ModelsCreateRequestVisibility.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model. + /// + public enum ModelsCreateRequestVisibility + { + /// + /// + /// + Public, + /// + /// + /// + Private, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ModelsCreateRequestVisibilityExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ModelsCreateRequestVisibility value) + { + return value switch + { + ModelsCreateRequestVisibility.Public => "public", + ModelsCreateRequestVisibility.Private => "private", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ModelsCreateRequestVisibility? ToEnum(string value) + { + return value switch + { + "public" => ModelsCreateRequestVisibility.Public, + "private" => ModelsCreateRequestVisibility.Private, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.PredictionRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequest.g.cs new file mode 100644 index 0000000..65e0621 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequest.g.cs @@ -0,0 +1,68 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class PredictionRequest + { + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Replicate.PredictionRequestInput Input { get; set; } + + /// + /// **This field is deprecated.**
+ /// Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
+ /// This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool Stream { get; set; } + + /// + /// An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("webhook")] + public string? Webhook { get; set; } + + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:
+ /// - `start`: immediately on prediction start
+ /// - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a prediction
+ /// - `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("webhook_events_filter")] + public global::System.Collections.Generic.IList? WebhookEventsFilter { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestInput.g.cs b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestInput.g.cs new file mode 100644 index 0000000..d36d61f --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + ///
+ public sealed partial class PredictionRequestInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..aa63d9f --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.PredictionRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public enum PredictionRequestWebhookEventsFilterItem + { + /// + /// + /// + Start, + /// + /// + /// + Output, + /// + /// + /// + Logs, + /// + /// + /// + Completed, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PredictionRequestWebhookEventsFilterItemExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PredictionRequestWebhookEventsFilterItem value) + { + return value switch + { + PredictionRequestWebhookEventsFilterItem.Start => "start", + PredictionRequestWebhookEventsFilterItem.Output => "output", + PredictionRequestWebhookEventsFilterItem.Logs => "logs", + PredictionRequestWebhookEventsFilterItem.Completed => "completed", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PredictionRequestWebhookEventsFilterItem? ToEnum(string value) + { + return value switch + { + "start" => PredictionRequestWebhookEventsFilterItem.Start, + "output" => PredictionRequestWebhookEventsFilterItem.Output, + "logs" => PredictionRequestWebhookEventsFilterItem.Logs, + "completed" => PredictionRequestWebhookEventsFilterItem.Completed, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.TrainingRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequest.g.cs new file mode 100644 index 0000000..d76ff3d --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequest.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class TrainingRequest + { + /// + /// A string representing the desired model to push to in the format `{destination_model_owner}/{destination_model_name}`. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("destination")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Destination { get; set; } + + /// + /// An object containing inputs to the Cog model's `train()` function. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Replicate.TrainingRequestInput Input { get; set; } + + /// + /// An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("webhook")] + public string? Webhook { get; set; } + + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the training request:
+ /// - `start`: immediately on training start
+ /// - `output`: each time a training generates an output (note that trainings can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a training
+ /// - `completed`: when the training reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the training, you would provide:
+ /// ```json
+ /// {
+ /// "destination": "my-organization/my-model",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("webhook_events_filter")] + public global::System.Collections.Generic.IList? WebhookEventsFilter { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestInput.g.cs b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestInput.g.cs new file mode 100644 index 0000000..36f506c --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestInput.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// An object containing inputs to the Cog model's `train()` function. + /// + public sealed partial class TrainingRequestInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..5059185 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.TrainingRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public enum TrainingRequestWebhookEventsFilterItem + { + /// + /// + /// + Start, + /// + /// + /// + Output, + /// + /// + /// + Logs, + /// + /// + /// + Completed, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class TrainingRequestWebhookEventsFilterItemExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this TrainingRequestWebhookEventsFilterItem value) + { + return value switch + { + TrainingRequestWebhookEventsFilterItem.Start => "start", + TrainingRequestWebhookEventsFilterItem.Output => "output", + TrainingRequestWebhookEventsFilterItem.Logs => "logs", + TrainingRequestWebhookEventsFilterItem.Completed => "completed", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static TrainingRequestWebhookEventsFilterItem? ToEnum(string value) + { + return value switch + { + "start" => TrainingRequestWebhookEventsFilterItem.Start, + "output" => TrainingRequestWebhookEventsFilterItem.Output, + "logs" => TrainingRequestWebhookEventsFilterItem.Logs, + "completed" => TrainingRequestWebhookEventsFilterItem.Completed, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequest.g.cs b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequest.g.cs new file mode 100644 index 0000000..0fc40ff --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequest.g.cs @@ -0,0 +1,76 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class VersionPredictionRequest + { + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Replicate.VersionPredictionRequestInput Input { get; set; } + + /// + /// **This field is deprecated.**
+ /// Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
+ /// This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool Stream { get; set; } + + /// + /// The ID of the model version that you want to run. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("version")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Version { get; set; } + + /// + /// An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("webhook")] + public string? Webhook { get; set; } + + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:
+ /// - `start`: immediately on prediction start
+ /// - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a prediction
+ /// - `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:
+ /// ```json
+ /// {
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("webhook_events_filter")] + public global::System.Collections.Generic.IList? WebhookEventsFilter { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestInput.g.cs b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestInput.g.cs new file mode 100644 index 0000000..24586c4 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + ///
+ public sealed partial class VersionPredictionRequestInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestWebhookEventsFilterItem.g.cs b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestWebhookEventsFilterItem.g.cs new file mode 100644 index 0000000..e383f10 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.VersionPredictionRequestWebhookEventsFilterItem.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public enum VersionPredictionRequestWebhookEventsFilterItem + { + /// + /// + /// + Start, + /// + /// + /// + Output, + /// + /// + /// + Logs, + /// + /// + /// + Completed, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class VersionPredictionRequestWebhookEventsFilterItemExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this VersionPredictionRequestWebhookEventsFilterItem value) + { + return value switch + { + VersionPredictionRequestWebhookEventsFilterItem.Start => "start", + VersionPredictionRequestWebhookEventsFilterItem.Output => "output", + VersionPredictionRequestWebhookEventsFilterItem.Logs => "logs", + VersionPredictionRequestWebhookEventsFilterItem.Completed => "completed", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static VersionPredictionRequestWebhookEventsFilterItem? ToEnum(string value) + { + return value switch + { + "start" => VersionPredictionRequestWebhookEventsFilterItem.Start, + "output" => VersionPredictionRequestWebhookEventsFilterItem.Output, + "logs" => VersionPredictionRequestWebhookEventsFilterItem.Logs, + "completed" => VersionPredictionRequestWebhookEventsFilterItem.Completed, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Models.WebhooksDefaultSecretGetResponse.g.cs b/src/libs/Replicate/Generated/Replicate.Models.WebhooksDefaultSecretGetResponse.g.cs new file mode 100644 index 0000000..81c1900 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Models.WebhooksDefaultSecretGetResponse.g.cs @@ -0,0 +1,23 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public sealed partial class WebhooksDefaultSecretGetResponse + { + /// + /// The signing secret. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.Polyfills.g.cs b/src/libs/Replicate/Generated/Replicate.Polyfills.g.cs new file mode 100644 index 0000000..ee3fd46 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.Polyfills.g.cs @@ -0,0 +1,53 @@ + +#if !NET6_0_OR_GREATER +#nullable enable + +namespace Replicate +{ + /// + /// + /// + public static partial class OpenApiGeneratorPolyfills + { + /// + /// + /// + /// + /// + /// + public static global::System.Threading.Tasks.Task ReadAsStringAsync( + this global::System.Net.Http.HttpContent content, + global::System.Threading.CancellationToken cancellationToken) + { + content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + return content.ReadAsStringAsync(); + } + /// + /// + /// + /// + /// + /// + public static global::System.Threading.Tasks.Task ReadAsStreamAsync( + this global::System.Net.Http.HttpContent content, + global::System.Threading.CancellationToken cancellationToken) + { + content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + return content.ReadAsStreamAsync(); + } + /// + /// + /// + /// + /// + /// + public static global::System.Threading.Tasks.Task ReadAsByteArrayAsync( + this global::System.Net.Http.HttpContent content, + global::System.Threading.CancellationToken cancellationToken) + { + content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + return content.ReadAsByteArrayAsync(); + } + } +} +#endif \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.AccountGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.AccountGet.g.cs new file mode 100644 index 0000000..ef19bd6 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.AccountGet.g.cs @@ -0,0 +1,99 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareAccountGetArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareAccountGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessAccountGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessAccountGetResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get the authenticated account
+ /// Returns information about the user or organization associated with the provided API token.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/account
+ /// ```
+ /// The response will be a JSON object describing the account:
+ /// ```json
+ /// {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// }
+ /// ``` + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task AccountGetAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareAccountGetArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/account", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareAccountGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessAccountGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessAccountGetResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.AccountGetResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.Authorizations.Bearer.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.Authorizations.Bearer.g.cs new file mode 100644 index 0000000..fc374b2 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.Authorizations.Bearer.g.cs @@ -0,0 +1,22 @@ + +#nullable enable + +namespace Replicate +{ + public sealed partial class ReplicateApi + { + /// + /// Authorize using bearer authentication. + /// + /// + public void AuthorizeUsingBearer( + string apiKey) + { + apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); + + _httpClient.DefaultRequestHeaders.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: "Bearer", + parameter: apiKey); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsGet.g.cs new file mode 100644 index 0000000..23d41e1 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsGet.g.cs @@ -0,0 +1,76 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareCollectionsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string collectionSlug); + partial void PrepareCollectionsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string collectionSlug); + partial void ProcessCollectionsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Get a collection of models
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/collections/super-resolution
+ /// ```
+ /// The response will be a collection object with a nested list of the models in that collection:
+ /// ```json
+ /// {
+ /// "name": "Super resolution",
+ /// "slug": "super-resolution",
+ /// "description": "Upscaling models that create high-quality images from low-quality images.",
+ /// "models": [...]
+ /// }
+ /// ``` + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CollectionsGetAsync( + string collectionSlug, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareCollectionsGetArguments( + httpClient: _httpClient, + collectionSlug: ref collectionSlug); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/collections/{collectionSlug}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareCollectionsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + collectionSlug: collectionSlug); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessCollectionsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsList.g.cs new file mode 100644 index 0000000..df1fd58 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsList.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareCollectionsListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareCollectionsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessCollectionsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// List collections of models
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/collections
+ /// ```
+ /// The response will be a paginated JSON list of collection objects:
+ /// ```json
+ /// {
+ /// "next": "null",
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "name": "Super resolution",
+ /// "slug": "super-resolution",
+ /// "description": "Upscaling models that create high-quality images from low-quality images."
+ /// }
+ /// ]
+ /// }
+ /// ``` + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CollectionsListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareCollectionsListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/collections", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareCollectionsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessCollectionsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsCreate.g.cs new file mode 100644 index 0000000..7e9ac6f --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsCreate.g.cs @@ -0,0 +1,226 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + global::Replicate.DeploymentsCreateRequest request); + partial void PrepareDeploymentsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Replicate.DeploymentsCreateRequest request); + partial void ProcessDeploymentsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeploymentsCreateResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a deployment
+ /// Create a new deployment:
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -X POST \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Content-Type: application/json" \
+ /// -d '{
+ /// "name": "my-app-image-generator",
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 0,
+ /// "max_instances": 3
+ /// }' \
+ /// https://api.replicate.com/v1/deployments
+ /// ```
+ /// The response will be a JSON object describing the deployment:
+ /// ```json
+ /// {
+ /// "owner": "acme",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 1,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 1,
+ /// "max_instances": 5
+ /// }
+ /// }
+ /// }
+ /// ``` + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsCreateAsync( + global::Replicate.DeploymentsCreateRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareDeploymentsCreateArguments( + httpClient: _httpClient, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/deployments", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.DeploymentsCreateRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessDeploymentsCreateResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.DeploymentsCreateResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + + /// + /// Create a deployment
+ /// Create a new deployment:
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -X POST \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Content-Type: application/json" \
+ /// -d '{
+ /// "name": "my-app-image-generator",
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 0,
+ /// "max_instances": 3
+ /// }' \
+ /// https://api.replicate.com/v1/deployments
+ /// ```
+ /// The response will be a JSON object describing the deployment:
+ /// ```json
+ /// {
+ /// "owner": "acme",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 1,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 1,
+ /// "max_instances": 5
+ /// }
+ /// }
+ /// }
+ /// ``` + ///
+ /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + /// + /// The maximum number of instances for scaling. + /// + /// + /// The minimum number of instances for scaling. + /// + /// + /// The full name of the model that you want to deploy e.g. stability-ai/sdxl. + /// + /// + /// The name of the deployment. + /// + /// + /// The 64-character string ID of the model version that you want to deploy. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsCreateAsync( + string hardware, + int maxInstances, + int minInstances, + string model, + string name, + string version, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.DeploymentsCreateRequest + { + Hardware = hardware, + MaxInstances = maxInstances, + MinInstances = minInstances, + Model = model, + Name = name, + Version = version, + }; + + return await DeploymentsCreateAsync( + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsDelete.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsDelete.g.cs new file mode 100644 index 0000000..d8d23fe --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsDelete.g.cs @@ -0,0 +1,77 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsDeleteArguments( + global::System.Net.Http.HttpClient httpClient, + ref string deploymentOwner, + ref string deploymentName); + partial void PrepareDeploymentsDeleteRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string deploymentOwner, + string deploymentName); + partial void ProcessDeploymentsDeleteResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Delete a deployment
+ /// Delete a deployment
+ /// Deployment deletion has some restrictions:
+ /// - You can only delete deployments that have been offline and unused for at least 15 minutes.
+ /// Example cURL request:
+ /// ```command
+ /// curl -s -X DELETE \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
+ /// ```
+ /// The response will be an empty 204, indicating the deployment has been deleted. + ///
+ /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsDeleteAsync( + string deploymentOwner, + string deploymentName, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareDeploymentsDeleteArguments( + httpClient: _httpClient, + deploymentOwner: ref deploymentOwner, + deploymentName: ref deploymentName); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/deployments/{deploymentOwner}/{deploymentName}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsDeleteRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + deploymentOwner: deploymentOwner, + deploymentName: deploymentName); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsDeleteResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsGet.g.cs new file mode 100644 index 0000000..3c70dfa --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsGet.g.cs @@ -0,0 +1,126 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string deploymentOwner, + ref string deploymentName); + partial void PrepareDeploymentsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string deploymentOwner, + string deploymentName); + partial void ProcessDeploymentsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeploymentsGetResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get a deployment
+ /// Get information about a deployment by name including the current release.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/deployments/replicate/my-app-image-generator
+ /// ```
+ /// The response will be a JSON object describing the deployment:
+ /// ```json
+ /// {
+ /// "owner": "acme",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 1,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 1,
+ /// "max_instances": 5
+ /// }
+ /// }
+ /// }
+ /// ``` + ///
+ /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsGetAsync( + string deploymentOwner, + string deploymentName, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareDeploymentsGetArguments( + httpClient: _httpClient, + deploymentOwner: ref deploymentOwner, + deploymentName: ref deploymentName); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/deployments/{deploymentOwner}/{deploymentName}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + deploymentOwner: deploymentOwner, + deploymentName: deploymentName); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessDeploymentsGetResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.DeploymentsGetResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsList.g.cs new file mode 100644 index 0000000..1d32ba6 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsList.g.cs @@ -0,0 +1,120 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareDeploymentsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessDeploymentsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeploymentsListResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List deployments
+ /// Get a list of deployments associated with the current account, including the latest release configuration for each deployment.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/deployments
+ /// ```
+ /// The response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:
+ /// ```json
+ /// {
+ /// "next": "http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw",
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "owner": "replicate",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 1,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 1,
+ /// "max_instances": 5
+ /// }
+ /// }
+ /// }
+ /// ]
+ /// }
+ /// ``` + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareDeploymentsListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/deployments", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessDeploymentsListResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.DeploymentsListResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.cs new file mode 100644 index 0000000..7007fb2 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.cs @@ -0,0 +1,228 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsPredictionsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + ref string deploymentOwner, + ref string deploymentName, + global::Replicate.PredictionRequest request); + partial void PrepareDeploymentsPredictionsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string deploymentOwner, + string deploymentName, + global::Replicate.PredictionRequest request); + partial void ProcessDeploymentsPredictionsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Create a prediction using a deployment
+ /// Start a new prediction for a deployment of a model using inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "text": "Alice"
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"input": {"text": "Alice"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "86b6trbv99rgp0cf1h886f69ew",
+ /// "model": "replicate/hello-world",
+ /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2024-04-23T18:55:52.138Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsPredictionsCreateAsync( + string deploymentOwner, + string deploymentName, + global::Replicate.PredictionRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareDeploymentsPredictionsCreateArguments( + httpClient: _httpClient, + deploymentOwner: ref deploymentOwner, + deploymentName: ref deploymentName, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/deployments/{deploymentOwner}/{deploymentName}/predictions", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.PredictionRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsPredictionsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + deploymentOwner: deploymentOwner, + deploymentName: deploymentName, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsPredictionsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + + /// + /// Create a prediction using a deployment
+ /// Start a new prediction for a deployment of a model using inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "text": "Alice"
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"input": {"text": "Alice"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "86b6trbv99rgp0cf1h886f69ew",
+ /// "model": "replicate/hello-world",
+ /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2024-04-23T18:55:52.138Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + /// + /// + /// **This field is deprecated.**
+ /// Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
+ /// This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. + /// + /// + /// An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:
+ /// - `start`: immediately on prediction start
+ /// - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a prediction
+ /// - `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsPredictionsCreateAsync( + string deploymentOwner, + string deploymentName, + global::Replicate.PredictionRequestInput input, + bool stream = default, + string? webhook = default, + global::System.Collections.Generic.IList? webhookEventsFilter = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.PredictionRequest + { + Input = input, + Stream = stream, + Webhook = webhook, + WebhookEventsFilter = webhookEventsFilter, + }; + + await DeploymentsPredictionsCreateAsync( + deploymentOwner: deploymentOwner, + deploymentName: deploymentName, + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsUpdate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsUpdate.g.cs new file mode 100644 index 0000000..bf7ee22 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsUpdate.g.cs @@ -0,0 +1,222 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareDeploymentsUpdateArguments( + global::System.Net.Http.HttpClient httpClient, + ref string deploymentOwner, + ref string deploymentName, + global::Replicate.DeploymentsUpdateRequest request); + partial void PrepareDeploymentsUpdateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string deploymentOwner, + string deploymentName, + global::Replicate.DeploymentsUpdateRequest request); + partial void ProcessDeploymentsUpdateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeploymentsUpdateResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Update a deployment
+ /// Update properties of an existing deployment, including hardware, min/max instances, and the deployment's underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -X PATCH \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Content-Type: application/json" \
+ /// -d '{"min_instances": 3, "max_instances": 10}' \
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
+ /// ```
+ /// The response will be a JSON object describing the deployment:
+ /// ```json
+ /// {
+ /// "owner": "acme",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 2,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 3,
+ /// "max_instances": 10
+ /// }
+ /// }
+ /// }
+ /// ```
+ /// Updating any deployment properties will increment the `number` field of the `current_release`. + ///
+ /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsUpdateAsync( + string deploymentOwner, + string deploymentName, + global::Replicate.DeploymentsUpdateRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareDeploymentsUpdateArguments( + httpClient: _httpClient, + deploymentOwner: ref deploymentOwner, + deploymentName: ref deploymentName, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/deployments/{deploymentOwner}/{deploymentName}", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.DeploymentsUpdateRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareDeploymentsUpdateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + deploymentOwner: deploymentOwner, + deploymentName: deploymentName, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessDeploymentsUpdateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessDeploymentsUpdateResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.DeploymentsUpdateResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + + /// + /// Update a deployment
+ /// Update properties of an existing deployment, including hardware, min/max instances, and the deployment's underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -X PATCH \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Content-Type: application/json" \
+ /// -d '{"min_instances": 3, "max_instances": 10}' \
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
+ /// ```
+ /// The response will be a JSON object describing the deployment:
+ /// ```json
+ /// {
+ /// "owner": "acme",
+ /// "name": "my-app-image-generator",
+ /// "current_release": {
+ /// "number": 2,
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "created_at": "2024-02-15T16:32:57.018467Z",
+ /// "created_by": {
+ /// "type": "organization",
+ /// "username": "acme",
+ /// "name": "Acme Corp, Inc.",
+ /// "github_url": "https://github.com/acme",
+ /// },
+ /// "configuration": {
+ /// "hardware": "gpu-t4",
+ /// "min_instances": 3,
+ /// "max_instances": 10
+ /// }
+ /// }
+ /// }
+ /// ```
+ /// Updating any deployment properties will increment the `number` field of the `current_release`. + ///
+ /// + /// + /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + /// + /// The maximum number of instances for scaling. + /// + /// + /// The minimum number of instances for scaling. + /// + /// + /// The ID of the model version that you want to deploy + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeploymentsUpdateAsync( + string deploymentOwner, + string deploymentName, + string? hardware = default, + int maxInstances = default, + int minInstances = default, + string? version = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.DeploymentsUpdateRequest + { + Hardware = hardware, + MaxInstances = maxInstances, + MinInstances = minInstances, + Version = version, + }; + + return await DeploymentsUpdateAsync( + deploymentOwner: deploymentOwner, + deploymentName: deploymentName, + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.HardwareList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.HardwareList.g.cs new file mode 100644 index 0000000..febd98d --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.HardwareList.g.cs @@ -0,0 +1,98 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareHardwareListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareHardwareListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessHardwareListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessHardwareListResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List available hardware for models
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/hardware
+ /// ```
+ /// The response will be a JSON array of hardware objects:
+ /// ```json
+ /// [
+ /// {"name": "CPU", "sku": "cpu"},
+ /// {"name": "Nvidia T4 GPU", "sku": "gpu-t4"},
+ /// {"name": "Nvidia A40 GPU", "sku": "gpu-a40-small"},
+ /// {"name": "Nvidia A40 (Large) GPU", "sku": "gpu-a40-large"},
+ /// ]
+ /// ``` + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> HardwareListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareHardwareListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/hardware", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareHardwareListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessHardwareListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessHardwareListResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.IListHardwareListResponseItem) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsCreate.g.cs new file mode 100644 index 0000000..3451f2a --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsCreate.g.cs @@ -0,0 +1,185 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + global::Replicate.ModelsCreateRequest request); + partial void PrepareModelsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Replicate.ModelsCreateRequest request); + partial void ProcessModelsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Create a model
+ /// Create a model.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
+ /// https://api.replicate.com/v1/models
+ /// ```
+ /// The response will be a model object in the following format:
+ /// ```json
+ /// {
+ /// "url": "https://replicate.com/alice/my-model",
+ /// "owner": "alice",
+ /// "name": "my-model",
+ /// "description": "An example model",
+ /// "visibility": "public",
+ /// "github_url": null,
+ /// "paper_url": null,
+ /// "license_url": null,
+ /// "run_count": 0,
+ /// "cover_image_url": null,
+ /// "default_example": null,
+ /// "latest_version": null,
+ /// }
+ /// ```
+ /// Note that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it. + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsCreateAsync( + global::Replicate.ModelsCreateRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareModelsCreateArguments( + httpClient: _httpClient, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/models", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.ModelsCreateRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + + /// + /// Create a model
+ /// Create a model.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
+ /// https://api.replicate.com/v1/models
+ /// ```
+ /// The response will be a model object in the following format:
+ /// ```json
+ /// {
+ /// "url": "https://replicate.com/alice/my-model",
+ /// "owner": "alice",
+ /// "name": "my-model",
+ /// "description": "An example model",
+ /// "visibility": "public",
+ /// "github_url": null,
+ /// "paper_url": null,
+ /// "license_url": null,
+ /// "run_count": 0,
+ /// "cover_image_url": null,
+ /// "default_example": null,
+ /// "latest_version": null,
+ /// }
+ /// ```
+ /// Note that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it. + ///
+ /// + /// A URL for the model's cover image. This should be an image file. + /// + /// + /// A description of the model. + /// + /// + /// A URL for the model's source code on GitHub. + /// + /// + /// The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + /// + /// + /// A URL for the model's license. + /// + /// + /// The name of the model. This must be unique among all models owned by the user or organization. + /// + /// + /// The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization. + /// + /// + /// A URL for the model's paper. + /// + /// + /// Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsCreateAsync( + string hardware, + string name, + string owner, + global::Replicate.ModelsCreateRequestVisibility visibility, + string? coverImageUrl = default, + string? description = default, + string? githubUrl = default, + string? licenseUrl = default, + string? paperUrl = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.ModelsCreateRequest + { + CoverImageUrl = coverImageUrl, + Description = description, + GithubUrl = githubUrl, + Hardware = hardware, + LicenseUrl = licenseUrl, + Name = name, + Owner = owner, + PaperUrl = paperUrl, + Visibility = visibility, + }; + + await ModelsCreateAsync( + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsDelete.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsDelete.g.cs new file mode 100644 index 0000000..a0956ac --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsDelete.g.cs @@ -0,0 +1,79 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsDeleteArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName); + partial void PrepareModelsDeleteRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName); + partial void ProcessModelsDeleteResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Delete a model
+ /// Delete a model
+ /// Model deletion has some restrictions:
+ /// - You can only delete models you own.
+ /// - You can only delete private models.
+ /// - You can only delete models that have no versions associated with them. Currently you'll need to [delete the model's versions](#models.versions.delete) before you can delete the model itself.
+ /// Example cURL request:
+ /// ```command
+ /// curl -s -X DELETE \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models/replicate/hello-world
+ /// ```
+ /// The response will be an empty 204, indicating the model has been deleted. + ///
+ /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsDeleteAsync( + string modelOwner, + string modelName, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsDeleteArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsDeleteRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsDeleteResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsGet.g.cs new file mode 100644 index 0000000..3355fe4 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsGet.g.cs @@ -0,0 +1,97 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName); + partial void PrepareModelsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName); + partial void ProcessModelsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Get a model
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models/replicate/hello-world
+ /// ```
+ /// The response will be a model object in the following format:
+ /// ```json
+ /// {
+ /// "url": "https://replicate.com/replicate/hello-world",
+ /// "owner": "replicate",
+ /// "name": "hello-world",
+ /// "description": "A tiny model that says hello",
+ /// "visibility": "public",
+ /// "github_url": "https://github.com/replicate/cog-examples",
+ /// "paper_url": null,
+ /// "license_url": null,
+ /// "run_count": 5681081,
+ /// "cover_image_url": "...",
+ /// "default_example": {...},
+ /// "latest_version": {...},
+ /// }
+ /// ```
+ /// The `cover_image_url` string is an HTTPS URL for an image file. This can be:
+ /// - An image uploaded by the model author.
+ /// - The output file of the example prediction, if the model author has not set a cover image.
+ /// - The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.
+ /// - A generic fallback image.
+ /// The `default_example` object is a [prediction](#predictions.get) created with this model.
+ /// The `latest_version` object is the model's most recently pushed [version](#models.versions.get). + ///
+ /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsGetAsync( + string modelOwner, + string modelName, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsGetArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsList.g.cs new file mode 100644 index 0000000..240acbb --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsList.g.cs @@ -0,0 +1,90 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareModelsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessModelsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// List public models
+ /// Get a paginated list of public models.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models
+ /// ```
+ /// The response will be a paginated JSON array of model objects:
+ /// ```json
+ /// {
+ /// "next": null,
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "url": "https://replicate.com/acme/hello-world",
+ /// "owner": "acme",
+ /// "name": "hello-world",
+ /// "description": "A tiny model that says hello",
+ /// "visibility": "public",
+ /// "github_url": "https://github.com/replicate/cog-examples",
+ /// "paper_url": null,
+ /// "license_url": null,
+ /// "run_count": 5681081,
+ /// "cover_image_url": "...",
+ /// "default_example": {...},
+ /// "latest_version": {...}
+ /// }
+ /// ]
+ /// }
+ /// ```
+ /// The `cover_image_url` string is an HTTPS URL for an image file. This can be:
+ /// - An image uploaded by the model author.
+ /// - The output file of the example prediction, if the model author has not set a cover image.
+ /// - The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.
+ /// - A generic fallback image. + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/models", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.cs new file mode 100644 index 0000000..4af29a9 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.cs @@ -0,0 +1,228 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsPredictionsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName, + global::Replicate.PredictionRequest request); + partial void PrepareModelsPredictionsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName, + global::Replicate.PredictionRequest request); + partial void ProcessModelsPredictionsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Create a prediction using an official model
+ /// Start a new prediction for an official model using the inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "prompt": "Write a short poem about the weather."
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
+ /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
+ /// "version": "dp-cf04fe09351e25db628e8b6181276547",
+ /// "input": {
+ /// "prompt": "Write a short poem about the weather."
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2024-04-23T19:36:28.355Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsPredictionsCreateAsync( + string modelOwner, + string modelName, + global::Replicate.PredictionRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareModelsPredictionsCreateArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}/predictions", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.PredictionRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsPredictionsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsPredictionsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + + /// + /// Create a prediction using an official model
+ /// Start a new prediction for an official model using the inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "prompt": "Write a short poem about the weather."
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
+ /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
+ /// "version": "dp-cf04fe09351e25db628e8b6181276547",
+ /// "input": {
+ /// "prompt": "Write a short poem about the weather."
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2024-04-23T19:36:28.355Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// + /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + /// + /// + /// **This field is deprecated.**
+ /// Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
+ /// This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. + /// + /// + /// An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:
+ /// - `start`: immediately on prediction start
+ /// - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a prediction
+ /// - `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:
+ /// ```json
+ /// {
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsPredictionsCreateAsync( + string modelOwner, + string modelName, + global::Replicate.PredictionRequestInput input, + bool stream = default, + string? webhook = default, + global::System.Collections.Generic.IList? webhookEventsFilter = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.PredictionRequest + { + Input = input, + Stream = stream, + Webhook = webhook, + WebhookEventsFilter = webhookEventsFilter, + }; + + await ModelsPredictionsCreateAsync( + modelOwner: modelOwner, + modelName: modelName, + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsDelete.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsDelete.g.cs new file mode 100644 index 0000000..62ddb3c --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsDelete.g.cs @@ -0,0 +1,88 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsVersionsDeleteArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName, + ref string versionId); + partial void PrepareModelsVersionsDeleteRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName, + string versionId); + partial void ProcessModelsVersionsDeleteResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Delete a model version
+ /// Delete a model version and all associated predictions, including all output files.
+ /// Model version deletion has some restrictions:
+ /// - You can only delete versions from models you own.
+ /// - You can only delete versions from private models.
+ /// - You cannot delete a version if someone other than you has run predictions with it.
+ /// - You cannot delete a version if it is being used as the base model for a fine tune/training.
+ /// - You cannot delete a version if it has an associated deployment.
+ /// - You cannot delete a version if another model version is overridden to use it.
+ /// Example cURL request:
+ /// ```command
+ /// curl -s -X DELETE \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
+ /// ```
+ /// The response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed. + ///
+ /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsVersionsDeleteAsync( + string modelOwner, + string modelName, + string versionId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsVersionsDeleteArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName, + versionId: ref versionId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}/versions/{versionId}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsVersionsDeleteRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName, + versionId: versionId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsVersionsDeleteResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsGet.g.cs new file mode 100644 index 0000000..a5d8b29 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsGet.g.cs @@ -0,0 +1,115 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsVersionsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName, + ref string versionId); + partial void PrepareModelsVersionsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName, + string versionId); + partial void ProcessModelsVersionsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Get a model version
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
+ /// ```
+ /// The response will be the version object:
+ /// ```json
+ /// {
+ /// "id": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "created_at": "2022-04-26T19:29:04.418669Z",
+ /// "cog_version": "0.3.0",
+ /// "openapi_schema": {...}
+ /// }
+ /// ```
+ /// Every model describes its inputs and outputs with [OpenAPI Schema Objects](https://spec.openapis.org/oas/latest.html#schemaObject) in the `openapi_schema` property.
+ /// The `openapi_schema.components.schemas.Input` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:
+ /// ```json
+ /// {
+ /// "type": "object",
+ /// "title": "Input",
+ /// "required": [
+ /// "text"
+ /// ],
+ /// "properties": {
+ /// "text": {
+ /// "x-order": 0,
+ /// "type": "string",
+ /// "title": "Text",
+ /// "description": "Text to prefix with 'hello '"
+ /// }
+ /// }
+ /// }
+ /// ```
+ /// The `openapi_schema.components.schemas.Output` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:
+ /// ```json
+ /// {
+ /// "type": "string",
+ /// "title": "Output"
+ /// }
+ /// ```
+ /// For more details, see the docs on [Cog's supported input and output types](https://github.com/replicate/cog/blob/75b7802219e7cd4cee845e34c4c22139558615d4/docs/python.md#input-and-output-types) + ///
+ /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsVersionsGetAsync( + string modelOwner, + string modelName, + string versionId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsVersionsGetArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName, + versionId: ref versionId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}/versions/{versionId}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsVersionsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName, + versionId: versionId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsVersionsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsList.g.cs new file mode 100644 index 0000000..e4a68c3 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsList.g.cs @@ -0,0 +1,88 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareModelsVersionsListArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName); + partial void PrepareModelsVersionsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName); + partial void ProcessModelsVersionsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// List model versions
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/models/replicate/hello-world/versions
+ /// ```
+ /// The response will be a JSON array of model version objects, sorted with the most recent version first:
+ /// ```json
+ /// {
+ /// "next": null,
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "id": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "created_at": "2022-04-26T19:29:04.418669Z",
+ /// "cog_version": "0.3.0",
+ /// "openapi_schema": {...}
+ /// }
+ /// ]
+ /// }
+ /// ``` + ///
+ /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ModelsVersionsListAsync( + string modelOwner, + string modelName, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareModelsVersionsListArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}/versions", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareModelsVersionsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessModelsVersionsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCancel.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCancel.g.cs new file mode 100644 index 0000000..8390461 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCancel.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PreparePredictionsCancelArguments( + global::System.Net.Http.HttpClient httpClient, + ref string predictionId); + partial void PreparePredictionsCancelRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string predictionId); + partial void ProcessPredictionsCancelResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Cancel a prediction + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PredictionsCancelAsync( + string predictionId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PreparePredictionsCancelArguments( + httpClient: _httpClient, + predictionId: ref predictionId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/predictions/{predictionId}/cancel", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PreparePredictionsCancelRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + predictionId: predictionId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessPredictionsCancelResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.cs new file mode 100644 index 0000000..715b350 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.cs @@ -0,0 +1,220 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PreparePredictionsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + global::Replicate.VersionPredictionRequest request); + partial void PreparePredictionsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Replicate.VersionPredictionRequest request); + partial void ProcessPredictionsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Create a prediction
+ /// Start a new prediction for the model version and inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/predictions
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
+ /// "model": "replicate/hello-world",
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "output": null,
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2023-09-08T16:19:34.765994657Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PredictionsCreateAsync( + global::Replicate.VersionPredictionRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PreparePredictionsCreateArguments( + httpClient: _httpClient, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/predictions", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.VersionPredictionRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PreparePredictionsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessPredictionsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + + /// + /// Create a prediction
+ /// Start a new prediction for the model version and inputs you provide.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// }
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/predictions
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
+ /// "model": "replicate/hello-world",
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "output": null,
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2023-09-08T16:19:34.765994657Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
+ /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
+ /// Files should be passed as HTTP URLs or data URLs.
+ /// Use an HTTP URL when:
+ /// - you have a large file > 256kb
+ /// - you want to be able to use the file multiple times
+ /// - you want your prediction metadata to be associable with your input files
+ /// Use a data URL when:
+ /// - you have a small file <= 256kb
+ /// - you don't want to upload and host the file somewhere
+ /// - you don't need to use the file again (Replicate will not store it) + /// + /// + /// **This field is deprecated.**
+ /// Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
+ /// This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. + /// + /// + /// The ID of the model version that you want to run. + /// + /// + /// An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:
+ /// - `start`: immediately on prediction start
+ /// - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a prediction
+ /// - `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:
+ /// ```json
+ /// {
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PredictionsCreateAsync( + global::Replicate.VersionPredictionRequestInput input, + string version, + bool stream = default, + string? webhook = default, + global::System.Collections.Generic.IList? webhookEventsFilter = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.VersionPredictionRequest + { + Input = input, + Stream = stream, + Version = version, + Webhook = webhook, + WebhookEventsFilter = webhookEventsFilter, + }; + + await PredictionsCreateAsync( + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsGet.g.cs new file mode 100644 index 0000000..72bad17 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsGet.g.cs @@ -0,0 +1,106 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PreparePredictionsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string predictionId); + partial void PreparePredictionsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string predictionId); + partial void ProcessPredictionsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Get a prediction
+ /// Get the current state of a prediction.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
+ /// ```
+ /// The response will be the prediction object:
+ /// ```json
+ /// {
+ /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
+ /// "model": "replicate/hello-world",
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "logs": "",
+ /// "output": "hello Alice",
+ /// "error": null,
+ /// "status": "succeeded",
+ /// "created_at": "2023-09-08T16:19:34.765994Z",
+ /// "data_removed": false,
+ /// "started_at": "2023-09-08T16:19:34.779176Z",
+ /// "completed_at": "2023-09-08T16:19:34.791859Z",
+ /// "metrics": {
+ /// "predict_time": 0.012683
+ /// },
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
+ /// }
+ /// }
+ /// ```
+ /// `status` will be one of:
+ /// - `starting`: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.
+ /// - `processing`: the `predict()` method of the model is currently running.
+ /// - `succeeded`: the prediction completed successfully.
+ /// - `failed`: the prediction encountered an error during processing.
+ /// - `canceled`: the prediction was canceled by its creator.
+ /// In the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.
+ /// In the case of failure, `error` will contain the error encountered during the prediction.
+ /// Terminated predictions (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start.
+ /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
+ /// You must save a copy of any data or files in the output if you'd like to continue using them. The `output` key will still be present, but it's value will be `null` after the output has been removed.
+ /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PredictionsGetAsync( + string predictionId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PreparePredictionsGetArguments( + httpClient: _httpClient, + predictionId: ref predictionId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/predictions/{predictionId}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PreparePredictionsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + predictionId: predictionId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessPredictionsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsList.g.cs new file mode 100644 index 0000000..aedcb03 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsList.g.cs @@ -0,0 +1,101 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PreparePredictionsListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PreparePredictionsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessPredictionsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// List predictions
+ /// Get a paginated list of predictions that you've created. This will include predictions created from the API and the website. It will return 100 records per page.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/predictions
+ /// ```
+ /// The response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:
+ /// ```json
+ /// {
+ /// "next": null,
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "completed_at": "2023-09-08T16:19:34.791859Z",
+ /// "created_at": "2023-09-08T16:19:34.907244Z",
+ /// "data_removed": false,
+ /// "error": null,
+ /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "metrics": {
+ /// "predict_time": 0.012683
+ /// },
+ /// "output": "hello Alice",
+ /// "started_at": "2023-09-08T16:19:34.779176Z",
+ /// "source": "api",
+ /// "status": "succeeded",
+ /// "urls": {
+ /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu",
+ /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel"
+ /// },
+ /// "model": "replicate/hello-world",
+ /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
+ /// }
+ /// ]
+ /// }
+ /// ```
+ /// `id` will be the unique ID of the prediction.
+ /// `source` will indicate how the prediction was created. Possible values are `web` or `api`.
+ /// `status` will be the status of the prediction. Refer to [get a single prediction](#predictions.get) for possible values.
+ /// `urls` will be a convenience object that can be used to construct new API requests for the given prediction. If the requested model version supports streaming, this will have a `stream` entry with an HTTPS URL that you can use to construct an [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).
+ /// `model` will be the model identifier string in the format of `{model_owner}/{model_name}`.
+ /// `version` will be the unique ID of model version used to create the prediction.
+ /// `data_removed` will be `true` if the input and output data has been deleted. + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PredictionsListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PreparePredictionsListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/predictions", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PreparePredictionsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessPredictionsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCancel.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCancel.g.cs new file mode 100644 index 0000000..c942fc9 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCancel.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareTrainingsCancelArguments( + global::System.Net.Http.HttpClient httpClient, + ref string trainingId); + partial void PrepareTrainingsCancelRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string trainingId); + partial void ProcessTrainingsCancelResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Cancel a training + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TrainingsCancelAsync( + string trainingId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareTrainingsCancelArguments( + httpClient: _httpClient, + trainingId: ref trainingId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/trainings/{trainingId}/cancel", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareTrainingsCancelRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + trainingId: trainingId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessTrainingsCancelResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCreate.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCreate.g.cs new file mode 100644 index 0000000..3a3b482 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsCreate.g.cs @@ -0,0 +1,231 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareTrainingsCreateArguments( + global::System.Net.Http.HttpClient httpClient, + ref string modelOwner, + ref string modelName, + ref string versionId, + global::Replicate.TrainingRequest request); + partial void PrepareTrainingsCreateRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string modelOwner, + string modelName, + string versionId, + global::Replicate.TrainingRequest request); + partial void ProcessTrainingsCreateResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Create a training
+ /// Start a new training of the model version you specify.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "destination": "{new_owner}/{new_name}",
+ /// "input": {
+ /// "train_data": "https://example.com/my-input-images.zip",
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
+ /// ```
+ /// The response will be the training object:
+ /// ```json
+ /// {
+ /// "id": "zz4ibbonubfz7carwiefibzgga",
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "input": {
+ /// "input_images": "https://example.com/my-input-images.zip"
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2023-09-08T16:32:56.990893084Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.
+ /// When a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.
+ /// To find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models). + ///
+ /// + /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TrainingsCreateAsync( + string modelOwner, + string modelName, + string versionId, + global::Replicate.TrainingRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: _httpClient); + PrepareTrainingsCreateArguments( + httpClient: _httpClient, + modelOwner: ref modelOwner, + modelName: ref modelName, + versionId: ref versionId, + request: request); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/models/{modelOwner}/{modelName}/versions/{versionId}/trainings", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Replicate.SourceGenerationContext.Default.TrainingRequest); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareTrainingsCreateRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + modelOwner: modelOwner, + modelName: modelName, + versionId: versionId, + request: request); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessTrainingsCreateResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + + /// + /// Create a training
+ /// Start a new training of the model version you specify.
+ /// Example request body:
+ /// ```json
+ /// {
+ /// "destination": "{new_owner}/{new_name}",
+ /// "input": {
+ /// "train_data": "https://example.com/my-input-images.zip",
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// }
+ /// ```
+ /// Example cURL request:
+ /// ```console
+ /// curl -s -X POST \
+ /// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H 'Content-Type: application/json' \
+ /// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
+ /// ```
+ /// The response will be the training object:
+ /// ```json
+ /// {
+ /// "id": "zz4ibbonubfz7carwiefibzgga",
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// "input": {
+ /// "input_images": "https://example.com/my-input-images.zip"
+ /// },
+ /// "logs": "",
+ /// "error": null,
+ /// "status": "starting",
+ /// "created_at": "2023-09-08T16:32:56.990893084Z",
+ /// "urls": {
+ /// "cancel": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel",
+ /// "get": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga"
+ /// }
+ /// }
+ /// ```
+ /// As models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.
+ /// When a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.
+ /// To find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models). + ///
+ /// + /// + /// + /// + /// A string representing the desired model to push to in the format `{destination_model_owner}/{destination_model_name}`. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response. + /// + /// + /// An object containing inputs to the Cog model's `train()` function. + /// + /// + /// An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. + /// + /// + /// By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the training request:
+ /// - `start`: immediately on training start
+ /// - `output`: each time a training generates an output (note that trainings can generate multiple outputs)
+ /// - `logs`: each time log output is generated by a training
+ /// - `completed`: when the training reaches a terminal state (succeeded/canceled/failed)
+ /// For example, if you only wanted requests to be sent at the start and end of the training, you would provide:
+ /// ```json
+ /// {
+ /// "destination": "my-organization/my-model",
+ /// "input": {
+ /// "text": "Alice"
+ /// },
+ /// "webhook": "https://example.com/my-webhook",
+ /// "webhook_events_filter": ["start", "completed"]
+ /// }
+ /// ```
+ /// Requests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TrainingsCreateAsync( + string modelOwner, + string modelName, + string versionId, + string destination, + global::Replicate.TrainingRequestInput input, + string? webhook = default, + global::System.Collections.Generic.IList? webhookEventsFilter = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var request = new global::Replicate.TrainingRequest + { + Destination = destination, + Input = input, + Webhook = webhook, + WebhookEventsFilter = webhookEventsFilter, + }; + + await TrainingsCreateAsync( + modelOwner: modelOwner, + modelName: modelName, + versionId: versionId, + request: request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsGet.g.cs new file mode 100644 index 0000000..660578f --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsGet.g.cs @@ -0,0 +1,105 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareTrainingsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string trainingId); + partial void PrepareTrainingsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string trainingId); + partial void ProcessTrainingsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Get a training
+ /// Get the current state of a training.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga
+ /// ```
+ /// The response will be the training object:
+ /// ```json
+ /// {
+ /// "completed_at": "2023-09-08T16:41:19.826523Z",
+ /// "created_at": "2023-09-08T16:32:57.018467Z",
+ /// "error": null,
+ /// "id": "zz4ibbonubfz7carwiefibzgga",
+ /// "input": {
+ /// "input_images": "https://example.com/my-input-images.zip"
+ /// },
+ /// "logs": "...",
+ /// "metrics": {
+ /// "predict_time": 502.713876
+ /// },
+ /// "output": {
+ /// "version": "...",
+ /// "weights": "..."
+ /// },
+ /// "started_at": "2023-09-08T16:32:57.112647Z",
+ /// "status": "succeeded",
+ /// "urls": {
+ /// "get": "https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga",
+ /// "cancel": "https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel"
+ /// },
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// }
+ /// ```
+ /// `status` will be one of:
+ /// - `starting`: the training is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the training.
+ /// - `processing`: the `train()` method of the model is currently running.
+ /// - `succeeded`: the training completed successfully.
+ /// - `failed`: the training encountered an error during processing.
+ /// - `canceled`: the training was canceled by its creator.
+ /// In the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.
+ /// In the case of failure, `error` will contain the error encountered during the training.
+ /// Terminated trainings (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the training used while running. It won't include time waiting for the training to start. + ///
+ /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TrainingsGetAsync( + string trainingId, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareTrainingsGetArguments( + httpClient: _httpClient, + trainingId: ref trainingId); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/trainings/{trainingId}", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareTrainingsGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest, + trainingId: trainingId); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessTrainingsGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsList.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsList.g.cs new file mode 100644 index 0000000..d567802 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.TrainingsList.g.cs @@ -0,0 +1,101 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareTrainingsListArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareTrainingsListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessTrainingsListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// List trainings
+ /// Get a paginated list of trainings that you've created. This will include trainings created from the API and the website. It will return 100 records per page.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/trainings
+ /// ```
+ /// The response will be a paginated JSON array of training objects, sorted with the most recent training first:
+ /// ```json
+ /// {
+ /// "next": null,
+ /// "previous": null,
+ /// "results": [
+ /// {
+ /// "completed_at": "2023-09-08T16:41:19.826523Z",
+ /// "created_at": "2023-09-08T16:32:57.018467Z",
+ /// "error": null,
+ /// "id": "zz4ibbonubfz7carwiefibzgga",
+ /// "input": {
+ /// "input_images": "https://example.com/my-input-images.zip"
+ /// },
+ /// "metrics": {
+ /// "predict_time": 502.713876
+ /// },
+ /// "output": {
+ /// "version": "...",
+ /// "weights": "..."
+ /// },
+ /// "started_at": "2023-09-08T16:32:57.112647Z",
+ /// "source": "api",
+ /// "status": "succeeded",
+ /// "urls": {
+ /// "get": "https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga",
+ /// "cancel": "https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel"
+ /// },
+ /// "model": "stability-ai/sdxl",
+ /// "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
+ /// }
+ /// ]
+ /// }
+ /// ```
+ /// `id` will be the unique ID of the training.
+ /// `source` will indicate how the training was created. Possible values are `web` or `api`.
+ /// `status` will be the status of the training. Refer to [get a single training](#trainings.get) for possible values.
+ /// `urls` will be a convenience object that can be used to construct new API requests for the given training.
+ /// `version` will be the unique ID of model version used to create the training. + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TrainingsListAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareTrainingsListArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/trainings", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareTrainingsListRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessTrainingsListResponse( + httpClient: _httpClient, + httpResponseMessage: response); + response.EnsureSuccessStatusCode(); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.WebhooksDefaultSecretGet.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.WebhooksDefaultSecretGet.g.cs new file mode 100644 index 0000000..8daac25 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.WebhooksDefaultSecretGet.g.cs @@ -0,0 +1,96 @@ + +#nullable enable + +namespace Replicate +{ + public partial class ReplicateApi + { + partial void PrepareWebhooksDefaultSecretGetArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareWebhooksDefaultSecretGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessWebhooksDefaultSecretGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessWebhooksDefaultSecretGetResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get the signing secret for the default webhook
+ /// Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.
+ /// Example cURL request:
+ /// ```console
+ /// curl -s \
+ /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// https://api.replicate.com/v1/webhooks/default/secret
+ /// ```
+ /// The response will be a JSON object with a `key` property:
+ /// ```json
+ /// {
+ /// "key": "..."
+ /// }
+ /// ``` + ///
+ /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task WebhooksDefaultSecretGetAsync( + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: _httpClient); + PrepareWebhooksDefaultSecretGetArguments( + httpClient: _httpClient); + + using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/webhooks/default/secret", global::System.UriKind.RelativeOrAbsolute)); + + PrepareRequest( + client: _httpClient, + request: httpRequest); + PrepareWebhooksDefaultSecretGetRequest( + httpClient: _httpClient, + httpRequestMessage: httpRequest); + + using var response = await _httpClient.SendAsync( + request: httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: _httpClient, + response: response); + ProcessWebhooksDefaultSecretGetResponse( + httpClient: _httpClient, + httpResponseMessage: response); + + var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: _httpClient, + response: response, + content: ref __content); + ProcessWebhooksDefaultSecretGetResponseContent( + httpClient: _httpClient, + httpResponseMessage: response, + content: ref __content); + + try + { + response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException ex) + { + throw new global::System.InvalidOperationException(__content, ex); + } + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Replicate.SourceGenerationContext.Default.WebhooksDefaultSecretGetResponse) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Generated/Replicate.ReplicateApi.g.cs b/src/libs/Replicate/Generated/Replicate.ReplicateApi.g.cs new file mode 100644 index 0000000..89a4417 --- /dev/null +++ b/src/libs/Replicate/Generated/Replicate.ReplicateApi.g.cs @@ -0,0 +1,56 @@ + +#nullable enable + +namespace Replicate +{ + /// + /// A web service for running Replicate models
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public sealed partial class ReplicateApi : global::System.IDisposable + { + /// + /// + /// + public const string BaseUrl = "https://api.replicate.com/v1"; + + private readonly global::System.Net.Http.HttpClient _httpClient; + + + /// + /// Creates a new instance of the ReplicateApi. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// + /// + public ReplicateApi( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null + ) + { + _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); + } + + /// + public void Dispose() + { + _httpClient.Dispose(); + } + + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Replicate/Replicate.csproj b/src/libs/Replicate/Replicate.csproj index 06ce9b3..b16d3fb 100644 --- a/src/libs/Replicate/Replicate.csproj +++ b/src/libs/Replicate/Replicate.csproj @@ -14,48 +14,25 @@ Generated C# SDK based on Replicate OpenAPI specification. api;client;sdk;dotnet;swagger;openapi;specification;replicate;generated;nswag - - - Replicate - ReplicateApi - false - true - true - OperationIdWithDots - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - all runtime; build; native; contentfiles; analyzers; buildtransitive - - + - + - - - - - + diff --git a/src/libs/Replicate/SourceGenerationContext.cs b/src/libs/Replicate/SourceGenerationContext.cs deleted file mode 100644 index c458701..0000000 --- a/src/libs/Replicate/SourceGenerationContext.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Replicate; - -[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] -[JsonSerializable(typeof(OpenApiGeneratorTrimmableSupport))] -internal sealed partial class SourceGenerationContext : JsonSerializerContext; \ No newline at end of file diff --git a/src/libs/Replicate/generate.sh b/src/libs/Replicate/generate.sh new file mode 100755 index 0000000..705aac7 --- /dev/null +++ b/src/libs/Replicate/generate.sh @@ -0,0 +1,13 @@ +dotnet tool install --global openapigenerator.cli --prerelease +curl -o openapi.yaml https://api.replicate.com/openapi.json +dotnet run --project ../../helpers/FixOpenApiSpec openapi.yaml +if [ $? -ne 0 ]; then + echo "Failed, exiting..." + exit 1 +fi +rm -rf Generated +oag generate openapi.yaml \ + --namespace Replicate \ + --clientClassName ReplicateApi \ + --targetFramework net8.0 \ + --output Generated \ No newline at end of file diff --git a/src/libs/Replicate/openapi.yaml b/src/libs/Replicate/openapi.yaml new file mode 100644 index 0000000..5e46d31 --- /dev/null +++ b/src/libs/Replicate/openapi.yaml @@ -0,0 +1,913 @@ +openapi: 3.0.1 +info: + title: Replicate HTTP API + description: A web service for running Replicate models + termsOfService: https://replicate.com/terms + contact: + email: team@replicate.com + version: 1.0.0-a1 +servers: + - url: https://api.replicate.com/v1 +paths: + /account: + get: + summary: Get the authenticated account + description: "Returns information about the user or organization associated with the provided API token.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/account\n```\n\nThe response will be a JSON object describing the account:\n\n```json\n{\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n}\n```\n" + operationId: account.get + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + github_url: + type: string + description: The GitHub URL of the account. + format: uri + name: + type: string + description: The name of the account. + type: + enum: + - organization + - user + type: string + description: The account type. Can be a user or an organization. + username: + type: string + description: The username of the account. + /collections: + get: + summary: List collections of models + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/collections\n```\n\nThe response will be a paginated JSON list of collection objects:\n\n```json\n{\n \"next\": \"null\",\n \"previous\": null,\n \"results\": [\n {\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\"\n }\n ]\n}\n```\n" + operationId: collections.list + responses: + '200': + description: Success + '/collections/{collection_slug}': + get: + summary: Get a collection of models + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/collections/super-resolution\n```\n\nThe response will be a collection object with a nested list of the models in that collection:\n\n```json\n{\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\",\n \"models\": [...]\n}\n```\n" + operationId: collections.get + parameters: + - name: collection_slug + in: path + description: "The slug of the collection, like `super-resolution` or `image-restoration`. See [replicate.com/collections](https://replicate.com/collections).\n" + required: true + schema: + type: string + responses: + '200': + description: Success + /deployments: + get: + summary: List deployments + description: "Get a list of deployments associated with the current account, including the latest release configuration for each deployment.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:\n\n```json\n{\n \"next\": \"http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw\",\n \"previous\": null,\n \"results\": [\n {\n \"owner\": \"replicate\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n }\n ]\n}\n```\n" + operationId: deployments.list + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + next: + type: string + description: A URL pointing to the next page of deployment objects if any + nullable: true + previous: + type: string + description: A URL pointing to the previous page of deployment objects if any + nullable: true + results: + type: array + items: + type: object + properties: + current_release: + type: object + properties: + configuration: + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. + max_instances: + type: integer + description: The maximum number of instances for scaling. + min_instances: + type: integer + description: The minimum number of instances for scaling. + created_at: + type: string + description: The time the release was created. + format: date-time + created_by: + type: object + properties: + github_url: + type: string + description: The GitHub URL of the account that created the release. + format: uri + name: + type: string + description: The name of the account that created the release. + type: + enum: + - organization + - user + type: string + description: The account type of the creator. Can be a user or an organization. + username: + type: string + description: The username of the account that created the release. + model: + type: string + description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' + number: + type: integer + description: 'The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created.' + version: + type: string + description: The ID of the model version used in the release. + name: + type: string + description: The name of the deployment. + owner: + type: string + description: The owner of the deployment. + description: An array containing a page of deployment objects + post: + summary: Create a deployment + description: "Create a new deployment:\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X POST \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-app-image-generator\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 0,\n \"max_instances\": 3\n }' \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" + operationId: deployments.create + requestBody: + content: + application/json: + schema: + required: + - name + - model + - version + - hardware + - min_instances + - max_instances + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + max_instances: + maximum: 20 + minimum: 0 + type: integer + description: The maximum number of instances for scaling. + min_instances: + maximum: 5 + minimum: 0 + type: integer + description: The minimum number of instances for scaling. + model: + type: string + description: The full name of the model that you want to deploy e.g. stability-ai/sdxl. + name: + type: string + description: The name of the deployment. + version: + type: string + description: The 64-character string ID of the model version that you want to deploy. + required: true + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + current_release: + type: object + properties: + configuration: + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. + max_instances: + type: integer + description: The maximum number of instances for scaling. + min_instances: + type: integer + description: The minimum number of instances for scaling. + created_at: + type: string + description: The time the release was created. + format: date-time + created_by: + type: object + properties: + github_url: + type: string + description: The GitHub URL of the account that created the release. + format: uri + name: + type: string + description: The name of the account that created the release. + type: + enum: + - organization + - user + type: string + description: The account type of the creator. Can be a user or an organization. + username: + type: string + description: The username of the account that created the release. + model: + type: string + description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' + number: + type: integer + description: The release number. + version: + type: string + description: The ID of the model version used in the release. + name: + type: string + description: The name of the deployment. + owner: + type: string + description: The owner of the deployment. + '/deployments/{deployment_owner}/{deployment_name}': + delete: + summary: Delete a deployment + description: "Delete a deployment\n\nDeployment deletion has some restrictions:\n\n- You can only delete deployments that have been offline and unused for at least 15 minutes.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be an empty 204, indicating the deployment has been deleted.\n" + operationId: deployments.delete + parameters: + - name: deployment_owner + in: path + description: "The name of the user or organization that owns the deployment.\n" + required: true + schema: + type: string + - name: deployment_name + in: path + description: "The name of the deployment.\n" + required: true + schema: + type: string + responses: + '204': + description: Success + get: + summary: Get a deployment + description: "Get information about a deployment by name including the current release.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments/replicate/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" + operationId: deployments.get + parameters: + - name: deployment_owner + in: path + description: "The name of the user or organization that owns the deployment.\n" + required: true + schema: + type: string + - name: deployment_name + in: path + description: "The name of the deployment.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + current_release: + type: object + properties: + configuration: + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. + max_instances: + type: integer + description: The maximum number of instances for scaling. + min_instances: + type: integer + description: The minimum number of instances for scaling. + created_at: + type: string + description: The time the release was created. + format: date-time + created_by: + type: object + properties: + github_url: + type: string + description: The GitHub URL of the account that created the release. + format: uri + name: + type: string + description: The name of the account that created the release. + type: + enum: + - organization + - user + type: string + description: The account type of the creator. Can be a user or an organization. + username: + type: string + description: The username of the account that created the release. + model: + type: string + description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' + number: + type: integer + description: The release number. + version: + type: string + description: The ID of the model version used in the release. + name: + type: string + description: The name of the deployment. + owner: + type: string + description: The owner of the deployment. + patch: + summary: Update a deployment + description: "Update properties of an existing deployment, including hardware, min/max instances, and the deployment's underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X PATCH \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"min_instances\": 3, \"max_instances\": 10}' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 2,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 3,\n \"max_instances\": 10\n }\n }\n}\n```\n\nUpdating any deployment properties will increment the `number` field of the `current_release`.\n" + operationId: deployments.update + parameters: + - name: deployment_owner + in: path + description: "The name of the user or organization that owns the deployment.\n" + required: true + schema: + type: string + - name: deployment_name + in: path + description: "The name of the deployment.\n" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + max_instances: + maximum: 20 + minimum: 0 + type: integer + description: The maximum number of instances for scaling. + min_instances: + maximum: 5 + minimum: 0 + type: integer + description: The minimum number of instances for scaling. + version: + type: string + description: The ID of the model version that you want to deploy + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + current_release: + type: object + properties: + configuration: + type: object + properties: + hardware: + type: string + description: The SKU for the hardware used to run the model. + max_instances: + type: integer + description: The maximum number of instances for scaling. + min_instances: + type: integer + description: The minimum number of instances for scaling. + created_at: + type: string + description: The time the release was created. + format: date-time + created_by: + type: object + properties: + github_url: + type: string + description: The GitHub URL of the account that created the release. + format: uri + name: + type: string + description: The name of the account that created the release. + type: + enum: + - organization + - user + type: string + description: The account type of the creator. Can be a user or an organization. + username: + type: string + description: The username of the account that created the release. + model: + type: string + description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' + number: + type: integer + description: The release number. + version: + type: string + description: The ID of the model version used in the release. + name: + type: string + description: The name of the deployment. + owner: + type: string + description: The owner of the deployment. + '/deployments/{deployment_owner}/{deployment_name}/predictions': + post: + summary: Create a prediction using a deployment + description: "Start a new prediction for a deployment of a model using inputs you provide.\n\nExample request body:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"input\": {\"text\": \"Alice\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n \"https://api.replicate.com/v1/deployments/replicate/hello-world/predictions\"\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"86b6trbv99rgp0cf1h886f69ew\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"dp-8e43d61c333b5ddc7a921130bc3ab3ea\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2024-04-23T18:55:52.138Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nInput and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" + operationId: deployments.predictions.create + parameters: + - name: deployment_owner + in: path + description: "The name of the user or organization that owns the deployment.\n" + required: true + schema: + type: string + - name: deployment_name + in: path + description: "The name of the deployment.\n" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/prediction_request' + responses: + '200': + description: Success + /hardware: + get: + summary: List available hardware for models + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/hardware\n```\n\nThe response will be a JSON array of hardware objects:\n\n```json\n[\n {\"name\": \"CPU\", \"sku\": \"cpu\"},\n {\"name\": \"Nvidia T4 GPU\", \"sku\": \"gpu-t4\"},\n {\"name\": \"Nvidia A40 GPU\", \"sku\": \"gpu-a40-small\"},\n {\"name\": \"Nvidia A40 (Large) GPU\", \"sku\": \"gpu-a40-large\"},\n]\n```\n" + operationId: hardware.list + responses: + '200': + description: Success + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + description: The name of the hardware. + sku: + type: string + description: The SKU of the hardware. + /models: + get: + summary: List public models + description: "Get a paginated list of public models.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON array of model objects:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"url\": \"https://replicate.com/acme/hello-world\",\n \"owner\": \"acme\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...}\n }\n ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n" + operationId: models.list + responses: + '200': + description: Success + post: + summary: Create a model + description: "Create a model.\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n -d '{\"owner\": \"alice\", \"name\": \"my-model\", \"description\": \"An example model\", \"visibility\": \"public\", \"hardware\": \"cpu\"}' \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/alice/my-model\",\n \"owner\": \"alice\",\n \"name\": \"my-model\",\n \"description\": \"An example model\",\n \"visibility\": \"public\",\n \"github_url\": null,\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 0,\n \"cover_image_url\": null,\n \"default_example\": null,\n \"latest_version\": null,\n}\n```\n\nNote that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it.\n" + operationId: models.create + requestBody: + content: + application/json: + schema: + required: + - owner + - name + - visibility + - hardware + type: object + properties: + cover_image_url: + type: string + description: A URL for the model's cover image. This should be an image file. + description: + type: string + description: A description of the model. + github_url: + type: string + description: A URL for the model's source code on GitHub. + hardware: + type: string + description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. + license_url: + type: string + description: A URL for the model's license. + name: + type: string + description: The name of the model. This must be unique among all models owned by the user or organization. + owner: + type: string + description: 'The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization.' + paper_url: + type: string + description: A URL for the model's paper. + visibility: + enum: + - public + - private + type: string + description: 'Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model.' + required: true + responses: + '201': + description: Success + '/models/{model_owner}/{model_name}': + delete: + summary: Delete a model + description: "Delete a model\n\nModel deletion has some restrictions:\n\n- You can only delete models you own.\n- You can only delete private models.\n- You can only delete models that have no versions associated with them. Currently you'll need to [delete the model's versions](#models.versions.delete) before you can delete the model itself.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be an empty 204, indicating the model has been deleted.\n" + operationId: models.delete + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + responses: + '204': + description: Success + get: + summary: Get a model + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/replicate/hello-world\",\n \"owner\": \"replicate\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...},\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n\nThe `default_example` object is a [prediction](#predictions.get) created with this model.\n\nThe `latest_version` object is the model's most recently pushed [version](#models.versions.get).\n" + operationId: models.get + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + '/models/{model_owner}/{model_name}/predictions': + post: + summary: Create a prediction using an official model + description: "Start a new prediction for an official model using the inputs you provide.\n\nExample request body:\n\n```json\n{\n \"input\": {\n \"prompt\": \"Write a short poem about the weather.\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"25s2s4n7rdrgg0cf1httb3myk0\",\n \"model\": \"replicate-internal/llama3-70b-chat-vllm-unquantized\",\n \"version\": \"dp-cf04fe09351e25db628e8b6181276547\",\n \"input\": {\n \"prompt\": \"Write a short poem about the weather.\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2024-04-23T19:36:28.355Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" + operationId: models.predictions.create + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/prediction_request' + responses: + '200': + description: Success + '/models/{model_owner}/{model_name}/versions': + get: + summary: List model versions + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions\n```\n\nThe response will be a JSON array of model version objects, sorted with the most recent version first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n }\n ]\n}\n```\n" + operationId: models.versions.list + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + '/models/{model_owner}/{model_name}/versions/{version_id}': + delete: + summary: Delete a model version + description: "Delete a model version and all associated predictions, including all output files.\n\nModel version deletion has some restrictions:\n\n- You can only delete versions from models you own.\n- You can only delete versions from private models.\n- You cannot delete a version if someone other than you has run predictions with it.\n- You cannot delete a version if it is being used as the base model for a fine tune/training.\n- You cannot delete a version if it has an associated deployment.\n- You cannot delete a version if another model version is overridden to use it.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed.\n" + operationId: models.versions.delete + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + - name: version_id + in: path + description: "The ID of the version.\n" + required: true + schema: + type: string + responses: + '202': + description: Deletion request has been accepted. It might take a few minutes to be processed. + get: + summary: Get a model version + description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be the version object:\n\n```json\n{\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n}\n```\n\nEvery model describes its inputs and outputs with [OpenAPI Schema Objects](https://spec.openapis.org/oas/latest.html#schemaObject) in the `openapi_schema` property.\n\nThe `openapi_schema.components.schemas.Input` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"object\",\n \"title\": \"Input\",\n \"required\": [\n \"text\"\n ],\n \"properties\": {\n \"text\": {\n \"x-order\": 0,\n \"type\": \"string\",\n \"title\": \"Text\",\n \"description\": \"Text to prefix with 'hello '\"\n }\n }\n}\n```\n\nThe `openapi_schema.components.schemas.Output` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"string\",\n \"title\": \"Output\"\n}\n```\n\nFor more details, see the docs on [Cog's supported input and output types](https://github.com/replicate/cog/blob/75b7802219e7cd4cee845e34c4c22139558615d4/docs/python.md#input-and-output-types)\n" + operationId: models.versions.get + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + - name: version_id + in: path + description: "The ID of the version.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + '/models/{model_owner}/{model_name}/versions/{version_id}/trainings': + post: + summary: Create a training + description: "Start a new training of the model version you specify.\n\nExample request body:\n\n```json\n{\n \"destination\": \"{new_owner}/{new_name}\",\n \"input\": {\n \"train_data\": \"https://example.com/my-input-images.zip\",\n },\n \"webhook\": \"https://example.com/my-webhook\",\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"destination\": \"{new_owner}/{new_name}\", \"input\": {\"input_images\": \"https://example.com/my-input-images.zip\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings\n```\n\nThe response will be the training object:\n\n```json\n{\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2023-09-08T16:32:56.990893084Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga\"\n }\n}\n```\n\nAs models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.\n\nWhen a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.\n\nTo find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models).\n" + operationId: trainings.create + parameters: + - name: model_owner + in: path + description: "The name of the user or organization that owns the model.\n" + required: true + schema: + type: string + - name: model_name + in: path + description: "The name of the model.\n" + required: true + schema: + type: string + - name: version_id + in: path + description: "The ID of the version.\n" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/training_request' + responses: + '201': + description: Success + /predictions: + get: + summary: List predictions + description: "Get a paginated list of predictions that you've created. This will include predictions created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/predictions\n```\n\nThe response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"created_at\": \"2023-09-08T16:19:34.907244Z\",\n \"data_removed\": false,\n \"error\": null,\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"output\": \"hello Alice\",\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\",\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\"\n },\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the prediction.\n\n`source` will indicate how the prediction was created. Possible values are `web` or `api`.\n\n`status` will be the status of the prediction. Refer to [get a single prediction](#predictions.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given prediction. If the requested model version supports streaming, this will have a `stream` entry with an HTTPS URL that you can use to construct an [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).\n\n`model` will be the model identifier string in the format of `{model_owner}/{model_name}`.\n\n`version` will be the unique ID of model version used to create the prediction.\n\n`data_removed` will be `true` if the input and output data has been deleted.\n" + operationId: predictions.list + responses: + '200': + description: Success + post: + summary: Create a prediction + description: "Start a new prediction for the model version and inputs you provide.\n\nExample request body:\n\n```json\n{\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\", \"input\": {\"text\": \"Alice\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/predictions\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"output\": null,\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2023-09-08T16:19:34.765994657Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nInput and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" + operationId: predictions.create + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/version_prediction_request' + responses: + '200': + description: Success + '/predictions/{prediction_id}': + get: + summary: Get a prediction + description: "Get the current state of a prediction.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"logs\": \"\",\n \"output\": \"hello Alice\",\n \"error\": null,\n \"status\": \"succeeded\",\n \"created_at\": \"2023-09-08T16:19:34.765994Z\",\n \"data_removed\": false,\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\"\n }\n}\n```\n\n`status` will be one of:\n\n- `starting`: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.\n- `processing`: the `predict()` method of the model is currently running.\n- `succeeded`: the prediction completed successfully.\n- `failed`: the prediction encountered an error during processing.\n- `canceled`: the prediction was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the prediction.\n\nTerminated predictions (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nYou must save a copy of any data or files in the output if you'd like to continue using them. The `output` key will still be present, but it's value will be `null` after the output has been removed.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" + operationId: predictions.get + parameters: + - name: prediction_id + in: path + description: "The ID of the prediction to get.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + '/predictions/{prediction_id}/cancel': + post: + summary: Cancel a prediction + operationId: predictions.cancel + parameters: + - name: prediction_id + in: path + description: "The ID of the prediction to cancel.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + /trainings: + get: + summary: List trainings + description: "Get a paginated list of trainings that you've created. This will include trainings created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/trainings\n```\n\nThe response will be a paginated JSON array of training objects, sorted with the most recent training first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the training.\n\n`source` will indicate how the training was created. Possible values are `web` or `api`.\n\n`status` will be the status of the training. Refer to [get a single training](#trainings.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given training.\n\n`version` will be the unique ID of model version used to create the training.\n" + operationId: trainings.list + responses: + '200': + description: Success + '/trainings/{training_id}': + get: + summary: Get a training + description: "Get the current state of a training.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\n```\n\nThe response will be the training object:\n\n```json\n{\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"...\",\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n}\n```\n\n`status` will be one of:\n\n- `starting`: the training is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the training.\n- `processing`: the `train()` method of the model is currently running.\n- `succeeded`: the training completed successfully.\n- `failed`: the training encountered an error during processing.\n- `canceled`: the training was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the training.\n\nTerminated trainings (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the training used while running. It won't include time waiting for the training to start.\n" + operationId: trainings.get + parameters: + - name: training_id + in: path + description: "The ID of the training to get.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + '/trainings/{training_id}/cancel': + post: + summary: Cancel a training + operationId: trainings.cancel + parameters: + - name: training_id + in: path + description: "The ID of the training you want to cancel.\n" + required: true + schema: + type: string + responses: + '200': + description: Success + /webhooks/default/secret: + get: + summary: Get the signing secret for the default webhook + description: "Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/webhooks/default/secret\n```\n\nThe response will be a JSON object with a `key` property:\n\n```json\n{\n \"key\": \"...\"\n}\n```\n" + operationId: webhooks.default.secret.get + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + properties: + key: + type: string + description: The signing secret. +components: + schemas: + prediction_request: + required: + - input + type: object + properties: + input: + type: object + description: "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file > 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file <= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n" + stream: + type: boolean + description: "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n" + webhook: + type: string + description: "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n" + webhook_events_filter: + type: array + items: + enum: + - start + - output + - logs + - completed + type: string + description: "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" + additionalProperties: false + training_request: + required: + - destination + - input + type: object + properties: + destination: + type: string + description: "A string representing the desired model to push to in the format `{destination_model_owner}/{destination_model_name}`. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response.\n" + input: + type: object + description: "An object containing inputs to the Cog model's `train()` function.\n" + webhook: + type: string + description: 'An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.' + webhook_events_filter: + type: array + items: + enum: + - start + - output + - logs + - completed + type: string + description: "By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the training request:\n\n- `start`: immediately on training start\n- `output`: each time a training generates an output (note that trainings can generate multiple outputs)\n- `logs`: each time log output is generated by a training\n- `completed`: when the training reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the training, you would provide:\n\n```json\n{\n \"destination\": \"my-organization/my-model\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" + version_prediction_request: + required: + - version + - input + type: object + properties: + input: + type: object + description: "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file > 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file <= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n" + stream: + type: boolean + description: "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n" + version: + type: string + description: The ID of the model version that you want to run. + webhook: + type: string + description: "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n" + webhook_events_filter: + type: array + items: + enum: + - start + - output + - logs + - completed + type: string + description: "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" + additionalProperties: false + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: "All API requests must include a valid API token in the `Authorization` request header. The token must be prefixed by \"Bearer\", followed by a space and the token value.\nExample: `Authorization: Bearer r8_Hw***********************************`\nFind your tokens at https://replicate.com/account/api-tokens\n" +security: + - bearerAuth: [ ] +externalDocs: + description: Replicate HTTP API + url: https://replicate.com/docs/reference/http \ No newline at end of file diff --git a/src/tests/Replicate.IntegrationTests/Tests.cs b/src/tests/Replicate.IntegrationTests/Tests.CreatePrediction.cs similarity index 50% rename from src/tests/Replicate.IntegrationTests/Tests.cs rename to src/tests/Replicate.IntegrationTests/Tests.CreatePrediction.cs index 67f94b9..ed38bec 100755 --- a/src/tests/Replicate.IntegrationTests/Tests.cs +++ b/src/tests/Replicate.IntegrationTests/Tests.CreatePrediction.cs @@ -4,7 +4,7 @@ namespace Replicate.IntegrationTests; public class GeneralTests { [TestMethod] - public async Task Generate() + public async Task CreatePrediction() { var apiKey = Environment.GetEnvironmentVariable("REPLICATE_API_KEY") ?? @@ -13,11 +13,14 @@ public async Task Generate() using var api = new ReplicateApi(); api.AuthorizeUsingBearer(apiKey); - await api.CreatePredictionsAsync( - input: new + await api.PredictionsCreateAsync( + input: new VersionPredictionRequestInput { - prompt = "I forgot how to kill a process in Linux, can you help?", - assistant = "Sure! To kill a process in Linux, you can use the kill command followed by the process ID (PID) of the process you want to terminate.", + AdditionalProperties = new Dictionary + { + ["prompt"] = "I forgot how to kill a process in Linux, can you help?", + ["assistant"] = "Sure! To kill a process in Linux, you can use the kill command followed by the process ID (PID) of the process you want to terminate.", + }, }, version: "b063023ee937f28e922982abdbf97b041ffe34ad3b35a53d33e1d74bb19b36c4"); }