Skip to content
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

fix(specs): allow POST methods to send read requests #525

Merged
merged 8 commits into from
May 23, 2022

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented May 20, 2022

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/APIC-495

Changes included:

Some POST methods of the REST API are sent using the read requester in the current clients.

🧪 Test

CI :D

@shortcuts shortcuts self-assigned this May 20, 2022
@netlify
Copy link

netlify bot commented May 20, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit 95010e9
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/6287a6f572179e00082d8469

@algolia-bot
Copy link
Collaborator

algolia-bot commented May 20, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

Comment on lines +330 to +332
if (useReadTransporter) {
reqBuilder.tag(new UseReadTransporter());
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only difference, the rest is indenting sorry

@@ -401,18 +412,4 @@ public class ApiClient {
}
}
}

/**
Copy link
Member Author

Choose a reason for hiding this comment

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

It was not used, could you confirm?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I concur

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok my lord

Comment on lines +281 to +287
return $this->api->sendRequest(
$method,
$resourcePath . ($query ? "?{$query}" : ''),
$httpBody,
$requestOptions,
$useReadTransporter
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Since there was basically no difference between both, I've made the conditional stuff in the sendRequest method, which reduces the duplication

millotp
millotp previously approved these changes May 20, 2022
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

flawless !

playground/javascript/node/search.ts Outdated Show resolved Hide resolved
@@ -401,18 +412,4 @@ public class ApiClient {
}
}
}

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

I concur

@shortcuts shortcuts marked this pull request as ready for review May 20, 2022 13:45
Copy link
Contributor

@damcou damcou left a comment

Choose a reason for hiding this comment

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

On a coding POV, this looks fine (and the CI seems to approve that). I'm just a little bit confused with the fact that we should use GET over POST for these methods. Is this DSN thing new ?

@shortcuts
Copy link
Member Author

shortcuts commented May 20, 2022

On a coding POV, this looks fine (and the CI seems to approve that).

My only issue is that it's not controlled on the CI for PHP and Java yet (client tests), so if you can please test via the plaground :D

I'm just a little bit confused with the fact that we should use GET over POST for these methods. Is this DSN thing new ?

Looking at the current clients, that's what we are already doing, we leverage the READ hosts and options to send POST methods 🤷🏼‍♂️

edit: Not all READ methods are concerned, just a few

damcou
damcou previously approved these changes May 20, 2022
@shortcuts shortcuts requested review from damcou and Haroenv May 20, 2022 14:45
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

seems correct!

@shortcuts shortcuts merged commit bf42712 into main May 23, 2022
@shortcuts shortcuts deleted the fix/specs-write-but-read branch May 23, 2022 07:18
@shortcuts shortcuts mentioned this pull request May 23, 2022
3 tasks
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.

None yet

5 participants