Skip to content

feat: Expose functions that allow making generic API calls #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

AgustinBettati
Copy link
Member

@AgustinBettati AgustinBettati commented Mar 25, 2025

Description

Link to any related issue(s): CLOUDP-303927

NOTE: Explicitly left as draft so it is not merged, branch is currently used for terraform autogeneration PoC in https://github.com/mongodb/terraform-provider-mongodbatlas/tree/CLOUDP-301808-poc-autogeneration

Exposes the following functions from APIClient:

  • CallAPI
  • PrepareRequest
  • MakeApiError

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Required Checklist:

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.client.callAPI(req)
localVarHTTPResponse, err := a.client.CallAPI(req)
Copy link
Member

Choose a reason for hiding this comment

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

if prepareRequest, callAPI, etc. are kept lowercase and create the uppercase ones calling the lowercase ones, there won't be so many changes in this PR. (although it's true that at some moment we should leave only the uppercase ones)

@@ -387,7 +387,7 @@ func (c *APIClient) prepareRequest(
return localVarRequest, nil
}

func (c *APIClient) makeApiError(res *http.Response, httpMethod, httpPath string) error {
func (c *APIClient) MakeApiError(res *http.Response, httpMethod, httpPath string) error {
Copy link
Member

Choose a reason for hiding this comment

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

as with the other func we changed, I suggest to keep makeApiError and create MakeApiError calling it so we minimize changes

@lantoli
Copy link
Member

lantoli commented Apr 10, 2025

is good the base branch to be main, or should it be the branch we're using?

@AgustinBettati
Copy link
Member Author

Not intended to be merged at the moment (leaving draft for visibility of needed changes). Eventually we have to make a call if we move forward with exposing these 3 functions or duplicate logic into tf repo. Likely wont make this decision during PoC phase.

Copy link
Contributor

This PR has gone 30 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@github-actions github-actions bot added the stale label May 11, 2025
@lantoli
Copy link
Member

lantoli commented May 26, 2025

closing as this functionality is already in master

@lantoli lantoli closed this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants