Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ partial void ProcessPostEditImageResponseContent(
/// </param>
/// <param name="magicPromptOption">
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </param>
/// <param name="seed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public partial interface IGenerateClient
/// </param>
/// <param name="magicPromptOption">
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </param>
/// <param name="seed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ public partial interface IInternalTestingClient
/// Testing<br/>
/// Just a testing endpoint
/// </summary>
/// <param name="xTestHeader"></param>
/// <param name="xTestHeader2"></param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Ideogram.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Ideogram.PostInternalTesting200Response> PostInternalTestingAsync(
global::Ideogram.InternalTestingRequest request,
string? xTestHeader = default,
string? xTestHeader2 = default,
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Testing<br/>
/// Just a testing endpoint
/// </summary>
/// <param name="xTestHeader"></param>
/// <param name="xTestHeader2"></param>
/// <param name="xPosition"></param>
/// <param name="imageFile"></param>
/// <param name="imageFilename"></param>
Expand All @@ -37,6 +43,8 @@ public partial interface IInternalTestingClient
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Ideogram.PostInternalTesting200Response> PostInternalTestingAsync(
global::System.DateTime requiredDateTypeField,
string? xTestHeader = default,
string? xTestHeader2 = default,
int? xPosition = default,
byte[]? imageFile = default,
string? imageFilename = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ public partial class InternalTestingClient
{
partial void PreparePostInternalTestingArguments(
global::System.Net.Http.HttpClient httpClient,
ref string? xTestHeader,
ref string? xTestHeader2,
global::Ideogram.InternalTestingRequest request);
partial void PreparePostInternalTestingRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string? xTestHeader,
string? xTestHeader2,
global::Ideogram.InternalTestingRequest request);
partial void ProcessPostInternalTestingResponse(
global::System.Net.Http.HttpClient httpClient,
Expand All @@ -25,11 +29,15 @@ partial void ProcessPostInternalTestingResponseContent(
/// Testing<br/>
/// Just a testing endpoint
/// </summary>
/// <param name="xTestHeader"></param>
/// <param name="xTestHeader2"></param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Ideogram.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Ideogram.PostInternalTesting200Response> PostInternalTestingAsync(
global::Ideogram.InternalTestingRequest request,
string? xTestHeader = default,
string? xTestHeader2 = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand All @@ -38,6 +46,8 @@ partial void ProcessPostInternalTestingResponseContent(
client: HttpClient);
PreparePostInternalTestingArguments(
httpClient: HttpClient,
xTestHeader: ref xTestHeader,
xTestHeader2: ref xTestHeader2,
request: request);

var __pathBuilder = new PathBuilder(
Expand Down Expand Up @@ -67,7 +77,29 @@ partial void ProcessPostInternalTestingResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

if (xTestHeader != default)
{
__httpRequest.Headers.TryAddWithoutValidation("X-Test-Header", xTestHeader.ToString());
}
if (xTestHeader2 != default)
{
__httpRequest.Headers.TryAddWithoutValidation("X-Test-Header-2", xTestHeader2.ToString());
}

using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
if (xTestHeader != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{xTestHeader}"),
name: "X-Test-Header");
}
if (xTestHeader2 != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{xTestHeader2}"),
name: "X-Test-Header-2");
}
if (request.XPosition != default)
{
__httpRequestContent.Add(
Expand Down Expand Up @@ -147,6 +179,8 @@ partial void ProcessPostInternalTestingResponseContent(
PreparePostInternalTestingRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
xTestHeader: xTestHeader,
xTestHeader2: xTestHeader2,
request: request);

using var __response = await HttpClient.SendAsync(
Expand Down Expand Up @@ -229,6 +263,8 @@ partial void ProcessPostInternalTestingResponseContent(
/// Testing<br/>
/// Just a testing endpoint
/// </summary>
/// <param name="xTestHeader"></param>
/// <param name="xTestHeader2"></param>
/// <param name="xPosition"></param>
/// <param name="imageFile"></param>
/// <param name="imageFilename"></param>
Expand All @@ -247,6 +283,8 @@ partial void ProcessPostInternalTestingResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Ideogram.PostInternalTesting200Response> PostInternalTestingAsync(
global::System.DateTime requiredDateTypeField,
string? xTestHeader = default,
string? xTestHeader2 = default,
int? xPosition = default,
byte[]? imageFile = default,
string? imageFilename = default,
Expand Down Expand Up @@ -281,6 +319,8 @@ partial void ProcessPostInternalTestingResponseContent(
};

return await PostInternalTestingAsync(
xTestHeader: xTestHeader,
xTestHeader2: xTestHeader2,
request: __request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public sealed partial class EditImageRequest

/// <summary>
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </summary>
/// <example>ON</example>
Expand Down Expand Up @@ -115,7 +114,6 @@ public sealed partial class EditImageRequest
/// </param>
/// <param name="magicPromptOption">
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </param>
/// <param name="seed">
Expand Down
2 changes: 0 additions & 2 deletions src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public sealed partial class ImageRequest

/// <summary>
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </summary>
/// <example>ON</example>
Expand Down Expand Up @@ -110,7 +109,6 @@ public sealed partial class ImageRequest
/// </param>
/// <param name="magicPromptOption">
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </param>
/// <param name="seed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Ideogram
{
/// <summary>
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </summary>
public enum MagicPromptOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public sealed partial class UpscaleInitialImageRequest

/// <summary>
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </summary>
/// <example>ON</example>
Expand Down Expand Up @@ -72,7 +71,6 @@ public sealed partial class UpscaleInitialImageRequest
/// </param>
/// <param name="magicPromptOption">
/// Determine if MagicPrompt should be used in generating the request or not<br/>
/// Default Value: AUTO<br/>
/// Example: ON
/// </param>
/// <param name="seed">
Expand Down
14 changes: 13 additions & 1 deletion src/libs/Ideogram/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ paths:
summary: Testing
description: "Just a testing endpoint\n"
operationId: post_internal_testing
parameters:
- name: X-Test-Header
in: header
description: Test header
style: simple
schema:
type: string
- name: X-Test-Header-2
in: header
description: Test header
style: simple
schema:
type: string
Comment on lines +134 to +145
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve header parameter documentation and add validation.

The header parameters need distinct descriptions and proper validation:

  1. Each header should have a unique, descriptive purpose
  2. Add examples and format constraints where applicable

Apply this diff to enhance the header parameters:

    parameters:
      - name: X-Test-Header
        in: header
-       description: Test header
+       description: Primary test header for basic string validation
        style: simple
        schema:
          type: string
+         minLength: 1
+         maxLength: 50
+         pattern: '^[a-zA-Z0-9-_]+$'
+       example: "test-header-value"
+       required: true
      - name: X-Test-Header-2
        in: header
-       description: Test header
+       description: Secondary test header for optional metadata
        style: simple
        schema:
          type: string
+         format: uuid
+       example: "123e4567-e89b-12d3-a456-426614174000"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: X-Test-Header
in: header
description: Test header
style: simple
schema:
type: string
- name: X-Test-Header-2
in: header
description: Test header
style: simple
schema:
type: string
- name: X-Test-Header
in: header
description: Primary test header for basic string validation
style: simple
schema:
type: string
minLength: 1
maxLength: 50
pattern: '^[a-zA-Z0-9-_]+$'
example: "test-header-value"
required: true
- name: X-Test-Header-2
in: header
description: Secondary test header for optional metadata
style: simple
schema:
type: string
format: uuid
example: "123e4567-e89b-12d3-a456-426614174000"

Comment on lines +133 to +145
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Enhance security measures for the internal testing endpoint.

The internal testing endpoint needs additional security safeguards:

  1. Add IP whitelist for test environments
  2. Require special testing credentials
  3. Add rate limiting specific to test endpoints

Apply this diff to improve security:

    post:
      tags:
        - internal-testing
      summary: Testing
+     security:
+       - ApiKeyAuth: []
+       - TestEnvironmentAuth: []
+     x-security-options:
+       ip-whitelist:
+         - "127.0.0.1/32"
+         - "10.0.0.0/8"
+       rate-limit:
+         requests: 10
+         period: 1m

Add the following security scheme to the components section:

  securitySchemes:
+   TestEnvironmentAuth:
+     type: apiKey
+     description: Special API key for test environment access
+     name: Test-Environment-Key
+     in: header

Committable suggestion skipped: line range outside the PR's diff.


🛠️ Refactor suggestion

Enhance documentation and add environment restrictions for the internal testing endpoint.

The internal testing endpoint requires additional documentation and safeguards:

  1. Expand the description to clearly state the testing purpose and expected behavior
  2. Add environment-specific restrictions to prevent accidental usage in production

Apply this diff to improve the endpoint definition:

  post:
    tags:
      - internal-testing
    summary: Testing
-   description: "Just a testing endpoint\n"
+   description: |
+     Internal testing endpoint for validating multipart/form-data request handling.
+     WARNING: This endpoint is for internal testing purposes only and should not be used in production.
+     
+     Test coverage:
+     - Header parameter validation
+     - Complex nested object serialization
+     - File upload handling
+     - Date/DateTime format validation
    operationId: post_internal_testing
+   servers:
+     - url: http://localhost:8080
+       description: Local development
+     - url: http://test.ideogram.ai
+       description: Test environment

Committable suggestion skipped: line range outside the PR's diff.

requestBody:
description: A request for testing.
content:
Expand Down Expand Up @@ -1105,7 +1118,6 @@ components:
- OFF
type: string
description: Determine if MagicPrompt should be used in generating the request or not
default: AUTO
externalDocs:
url: https://docs.ideogram.ai/using-ideogram/ideogram-features/magic-prompt
example: ON
Expand Down
Loading