Skip to content

feat(ai): add ai gateway provider methods support#366

Open
innomaxx wants to merge 1 commit intomainfrom
feature/issue-359_add-ai-gateway-methods
Open

feat(ai): add ai gateway provider methods support#366
innomaxx wants to merge 1 commit intomainfrom
feature/issue-359_add-ai-gateway-methods

Conversation

@innomaxx
Copy link
Copy Markdown
Collaborator

Closes #359

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds SDK support for the Crowdin AI Gateway provider methods (GET/POST/PUT/PATCH/DELETE) so consumers can manage provider gateway configuration through the .NET client.

Changes:

  • Introduces IAiGatewayApiExecutor and AiGatewayApiExecutor to call AI Gateway endpoints and return raw JObject responses.
  • Exposes AI-related executors on ICrowdinApiClient / CrowdinApiClient via new AI and AiGateway properties.
  • Adds unit tests covering the new gateway executor methods.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Crowdin.Api.UnitTesting/Tests/AI/AiGatewayTests.cs Adds unit tests validating request routing for AI Gateway methods.
src/Crowdin.Api/ICrowdinApiClient.cs Exposes new AI executors on the public client interface.
src/Crowdin.Api/CrowdinApiClient.cs Instantiates and exposes AI and AiGateway executors on the concrete client.
src/Crowdin.Api/AI/Gateway/IAiGatewayApiExecutor.cs Defines the AI Gateway executor contract (GET/POST/PUT/PATCH/DELETE).
src/Crowdin.Api/AI/Gateway/AiGatewayApiExecutor.cs Implements the AI Gateway calls and URL formation logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +26
private readonly IJsonParser _jsonParser;

public AiGatewayApiExecutor(ICrowdinApiClient apiClient)
{
_apiClient = apiClient;
_jsonParser = apiClient.DefaultJsonParser;
}

public AiGatewayApiExecutor(ICrowdinApiClient apiClient, IJsonParser jsonParser)
{
_apiClient = apiClient;
_jsonParser = jsonParser;
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

AiGatewayApiExecutor stores _jsonParser (and has a ctor overload that accepts it) but never uses it anywhere in the class. This leaves dead code and will produce an unused-field warning; consider removing _jsonParser and the (ICrowdinApiClient, IJsonParser) constructor, or add typed Execute*<T>() methods that actually use the parser.

Suggested change
private readonly IJsonParser _jsonParser;
public AiGatewayApiExecutor(ICrowdinApiClient apiClient)
{
_apiClient = apiClient;
_jsonParser = apiClient.DefaultJsonParser;
}
public AiGatewayApiExecutor(ICrowdinApiClient apiClient, IJsonParser jsonParser)
{
_apiClient = apiClient;
_jsonParser = jsonParser;
}
public AiGatewayApiExecutor(ICrowdinApiClient apiClient)
{
_apiClient = apiClient;
}

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +58
// ReSharper disable once InconsistentNaming
IAiApiExecutor AI { get; }

IAiGatewayApiExecutor AiGateway { get; }

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

Adding new members to ICrowdinApiClient (AI / AiGateway) is a binary breaking change for any external implementations of this public interface. If backwards compatibility is a goal, consider exposing these executors only on CrowdinApiClient (or via a separate interface/extension methods), or ensure the package versioning reflects this breaking API change.

Suggested change
// ReSharper disable once InconsistentNaming
IAiApiExecutor AI { get; }
IAiGatewayApiExecutor AiGateway { get; }

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for AI Gateway provider methods

2 participants