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

feat(clients): add generateSecuredApiKey to java #3167

Merged
merged 5 commits into from
Jun 13, 2024
Merged

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented Jun 12, 2024

🧭 What and Why

🎟 JIRA Ticket: DI-1775

Add generateSecuredApiKey and getSecuredApiKeyRemainingValidity for java, it is tested in #2798.

@millotp millotp self-assigned this Jun 12, 2024
@millotp millotp requested a review from a team as a code owner June 12, 2024 12:06
@millotp millotp requested review from damcou and Fluf22 June 12, 2024 12:06
@algolia-bot
Copy link
Collaborator

algolia-bot commented Jun 12, 2024

✗ 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.

Copy link

github-actions bot commented Jun 12, 2024

@github-actions github-actions bot temporarily deployed to pull request June 12, 2024 12:27 Inactive
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

looks great

.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
.disable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
Copy link
Member

Choose a reason for hiding this comment

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

this should be configurable no?

Copy link
Member

Choose a reason for hiding this comment

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

disabled by default is nice anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually this is only used for the generateSecuredApiKey helper, the other json serializer used for http body is configurable.
I'm not sure if I can make this one configurable since its static

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is how it's done in the legacy client too, it's just a way to have a json serializer in hard to reach places

Copy link
Member

Choose a reason for hiding this comment

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

ah oki i'm fine with that then

@@ -181,10 +181,10 @@ public GetApiKeyResponse waitForApiKey(
}

/**
* Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
* Helper: Wait for an API key to be added or deleted based on a given `operation`.
Copy link
Member

Choose a reason for hiding this comment

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

how come it's not updated anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is just an override, because the apiKey param is optional, if you don't provide it you can't do an update, but just below you have the version with apiKey, they supports update

Copy link
Member

Choose a reason for hiding this comment

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

ahhh yes my bad then all good

*/
public Duration getSecuredApiKeyRemainingValidity(@Nonnull String securedApiKey) {
if (securedApiKey == null || securedApiKey.trim().isEmpty()) {
throw new AlgoliaRuntimeException("securedAPIKey must not be empty, null or whitespaces");
Copy link
Member

Choose a reason for hiding this comment

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

technically not possible if they used generateSecuredApiKey, right? we should maybe be more precise here and recommend to report the bug or something

non blocking

Copy link
Collaborator Author

@millotp millotp Jun 13, 2024

Choose a reason for hiding this comment

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

nothing forces the user to use this with generateSecuredApiKey, this is just a safety check, in other language we don't do any check, I'm not sure how to guide the user better

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

:yes:

@millotp millotp enabled auto-merge (squash) June 13, 2024 09:10
@shortcuts shortcuts disabled auto-merge June 13, 2024 09:11
@github-actions github-actions bot temporarily deployed to pull request June 13, 2024 09:20 Inactive
@millotp millotp enabled auto-merge (squash) June 13, 2024 09:30
@github-actions github-actions bot temporarily deployed to pull request June 13, 2024 09:41 Inactive
@millotp millotp merged commit a58e883 into main Jun 13, 2024
13 checks passed
@millotp millotp deleted the feat/java-generate branch June 13, 2024 09:41
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.

3 participants