Skip to content

[capital] Code generation: update services and models - #525

Open
AdyenAutomationBot wants to merge 1 commit into
mainfrom
sdk-automation/capital
Open

[capital] Code generation: update services and models#525
AdyenAutomationBot wants to merge 1 commit into
mainfrom
sdk-automation/capital

Conversation

@AdyenAutomationBot

Copy link
Copy Markdown
Collaborator

This PR contains the automated changes for the capital service.

The commit history of this PR reflects the adyen-openapi commits that have been applied.

@AdyenAutomationBot
AdyenAutomationBot requested review from a team as code owners January 28, 2026 13:57
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AdyenAutomationBot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the capital service by incorporating newly generated code. It introduces a comprehensive set of API endpoints and data models, enabling interactions with grant accounts, offers, and disbursements within the Capital API.

Highlights

  • New Capital API Integration: Introduced a new Capital API service, enabling comprehensive management of grant accounts, offers, and disbursements.
  • Automated Code Generation: The changes are automatically generated from the latest OpenAPI specification, ensuring up-to-date and consistent API definitions.
  • Extensive Data Models: Added a wide array of new data models to support various financial entities, including detailed bank account identifications for multiple regions (AU, BR, CA, CZ, DK, HK, HU, NZ, PL, SE, SG, UK, US).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces auto-generated code for the capital service. The generated code is largely functional, but I've identified a few areas for improvement that likely stem from the OpenAPI generator configuration or templates.

The most significant issue is that API methods return struct values instead of pointers. This is not idiomatic Go and can lead to incorrect handling of error cases. I've recommended changing these to return pointers.

Additionally, I've found some unexported and unused validation functions (isValid...) in the model files, which are dead code and should be removed. There are also minor formatting issues in some comments that affect readability.

Addressing these issues in the generator templates will improve the quality and maintainability of the generated code.

Comment on lines +48 to +66
func (a *GrantAccountsApi) GetGrantAccountInformation(ctx context.Context, r GrantAccountsApiGetGrantAccountInformationInput) (GrantAccount, *http.Response, error) {
res := &GrantAccount{}
path := "/grantAccounts/{id}"
path = strings.Replace(path, "{"+"id"+"}", url.PathEscape(common.ParameterValueToString(r.id, "id")), -1)
queryParams := url.Values{}
headerParams := make(map[string]string)
httpRes, err := common.SendAPIRequest(
ctx,
a.Client,
nil,
res,
http.MethodGet,
a.BasePath()+path,
queryParams,
headerParams,
)

return *res, httpRes, err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The function GetGrantAccountInformation returns a struct value GrantAccount instead of a pointer *GrantAccount. In Go, it's idiomatic for functions that can fail to return a pointer type for structs. This allows returning nil on error, making it clear to the caller that the returned object is invalid.

Currently, if an error occurs, this function returns a zero-value GrantAccount struct along with the error. A caller might mistakenly use this zero-value struct without checking the error.

It is recommended to change the function signature to return (*GrantAccount, *http.Response, error) and return nil for the GrantAccount on error.

Comment on lines +52 to +72
func (a *GrantOffersApi) GetAllGrantOffers(ctx context.Context, r GrantOffersApiGetAllGrantOffersInput) (GrantOffers, *http.Response, error) {
res := &GrantOffers{}
path := "/grantOffers"
queryParams := url.Values{}
headerParams := make(map[string]string)
if r.accountHolderId != nil {
common.ParameterAddToQuery(queryParams, "accountHolderId", r.accountHolderId, "")
}
httpRes, err := common.SendAPIRequest(
ctx,
a.Client,
nil,
res,
http.MethodGet,
a.BasePath()+path,
queryParams,
headerParams,
)

return *res, httpRes, err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The function GetAllGrantOffers returns a struct value GrantOffers instead of a pointer *GrantOffers. In Go, it's idiomatic for functions that can fail to return a pointer type for structs. This allows returning nil on error, making it clear to the caller that the returned object is invalid.

Currently, if an error occurs, this function returns a zero-value GrantOffers struct along with the error. A caller might mistakenly use this zero-value struct without checking the error.

It is recommended to change the function signature to return (*GrantOffers, *http.Response, error) and return nil for the GrantOffers on error. This recommendation also applies to GetGrantOffer in this file.

Comment thread src/capital/api_grants.go
Comment on lines +48 to +66
func (a *GrantsApi) GetAllGrantDisbursements(ctx context.Context, r GrantsApiGetAllGrantDisbursementsInput) (Disbursements, *http.Response, error) {
res := &Disbursements{}
path := "/grants/{grantId}/disbursements"
path = strings.Replace(path, "{"+"grantId"+"}", url.PathEscape(common.ParameterValueToString(r.grantId, "grantId")), -1)
queryParams := url.Values{}
headerParams := make(map[string]string)
httpRes, err := common.SendAPIRequest(
ctx,
a.Client,
nil,
res,
http.MethodGet,
a.BasePath()+path,
queryParams,
headerParams,
)

return *res, httpRes, err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The function GetAllGrantDisbursements returns a struct value Disbursements instead of a pointer *Disbursements. In Go, it's idiomatic for functions that can fail to return a pointer type for structs. This allows returning nil on error, making it clear to the caller that the returned object is invalid.

Currently, if an error occurs, this function returns a zero-value Disbursements struct along with the error. A caller might mistakenly use this zero-value struct without checking the error.

It is recommended to change the function signature to return (*Disbursements, *http.Response, error) and return nil for the Disbursements on error. This recommendation applies to all API methods in this file that return a struct value.

Comment thread src/capital/api_grants.go

/*
Prepare a request for GetGrantDisbursement
@param grantId The unique identifier of the grant reference.@param disbursementId The unique identifier of the disbursement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There's a formatting issue in the comment. The descriptions for @param grantId and @param disbursementId are concatenated without a space or newline, which makes it harder to read. This should be fixed for better documentation clarity. A similar issue exists on line 273.

Suggested change
@param grantId The unique identifier of the grant reference.@param disbursementId The unique identifier of the disbursement.
@param grantId The unique identifier of the grant reference. @param disbursementId The unique identifier of the disbursement.

Comment on lines +375 to +383
func (o *GrantOffer) isValidContractType() bool {
var allowedEnumValues = []string{"cashAdvance", "loan"}
for _, allowed := range allowedEnumValues {
if o.GetContractType() == allowed {
return true
}
}
return false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The function isValidContractType is unexported and appears to be unused within the codebase. This constitutes dead code, which can increase maintenance overhead and cause confusion. It should be removed if it's not intended to be used. A similar unused function isValidCode exists in model_status.go.

@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 2 times, most recently from 7a5a54f to 40b2723 Compare February 10, 2026 13:43
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 2 times, most recently from 4d5af33 to 728a61c Compare March 10, 2026 14:04
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 4 times, most recently from 5d54866 to ff132da Compare April 2, 2026 09:16
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 5 times, most recently from f53d69c to c453642 Compare April 13, 2026 10:16
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 4 times, most recently from 4050bb9 to ef82008 Compare April 20, 2026 10:48
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 2 times, most recently from bbaf2f8 to b3581bb Compare April 30, 2026 10:00
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 6 times, most recently from 21f247f to 9735718 Compare May 5, 2026 15:05
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 5 times, most recently from 6acd6e5 to 9779a09 Compare June 19, 2026 10:29
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 5 times, most recently from d7d8287 to 1593bb2 Compare June 24, 2026 08:32
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 3 times, most recently from db85eab to b0280fa Compare July 7, 2026 09:20
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 7 times, most recently from 4b163be to e4a62e9 Compare July 15, 2026 14:59
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 5 times, most recently from ad89b29 to d2ab79e Compare July 22, 2026 11:24
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/capital branch 3 times, most recently from 8709d3b to edc05df Compare July 27, 2026 10:29
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.

1 participant