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(go): add more playground examples #1447

Merged
merged 2 commits into from
Apr 6, 2023

Conversation

mehmetaligok
Copy link
Contributor

🧭 What and Why

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

More structured playground examples were added for the go client to give more examples to test.

Changes included:

  • Playground examples added for generated go packages.

🧪 Test

can be tested with yarn docker playground go {client}

@mehmetaligok mehmetaligok added the Go label Apr 6, 2023
@mehmetaligok mehmetaligok self-assigned this Apr 6, 2023
@netlify
Copy link

netlify bot commented Apr 6, 2023

Deploy Preview for api-clients-automation ready!

Name Link
🔨 Latest commit 80925df
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/642e978c2f97ec0008315b62
😎 Deploy Preview https://deploy-preview-1447--api-clients-automation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@algolia-bot
Copy link
Collaborator

algolia-bot commented Apr 6, 2023

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

@mehmetaligok mehmetaligok marked this pull request as ready for review April 6, 2023 10:07
@mehmetaligok mehmetaligok requested a review from a team as a code owner April 6, 2023 10:07
Copy link
Contributor

@Fluf22 Fluf22 left a comment

Choose a reason for hiding this comment

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

Niiiiice 👌🏻

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.

Looks nice ! Thanks for adding them 😀

analyticsClient := analytics.NewClient(appID, apiKey, analytics.US)

getTopFilterForAttributeResponse, err := analyticsClient.GetTopFilterForAttribute(
analyticsClient.NewApiGetTopFilterForAttributeRequest("myAttribute1,myAttribute2").WithIndex(indexName),
Copy link
Collaborator

Choose a reason for hiding this comment

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

For a future improvement for DX, what about putting only the optional parameters inside an struct ? And keep the required ones at the first level

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tbh I also noticed that the required param can be handled in a better position, and already took a private note about it when creating these examples 😀
image

--

But directly removing from the struct may bring some other problems, I think more to add in the to New function for the request struct.
For example; using like analyticsClient.NewApiGetTopFilterForAttributeRequest("myAttribute1,myAttribute2", indexName) if the index name is required. So it would be more clear to user what is required when creating the request struct.

@mehmetaligok mehmetaligok merged commit 968aa54 into main Apr 6, 2023
@mehmetaligok mehmetaligok deleted the feat/go-more-playground-templates branch April 6, 2023 10:35
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.

4 participants