-
Notifications
You must be signed in to change notification settings - Fork 120
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(surveys): return API only surveys method #736
Conversation
Size Change: +2.59 kB (0%) Total Size: 668 kB
ℹ️ View Unchanged
|
Hmm, this doesn't make sense to me - why are we excluding API survey type from |
Also, why is API a separate type? 🤔 |
Because we don't want to display API surveys in our use of the call 🤔 Basically users who are creating custom UI surveys only need API type surveys through the new method |
I think Annika suggested it as a survey type which makes a lot of sense to me, where do you think storing that a survey is an API type belongs to instead? |
This might make more sense as I push my PR up for the app API survey type @neilkakkar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting on the general approach
Why do we have separate endpoints? Why not just filter after the fact?
It's pretty straightforward for devs to do filtering after the fact so I would much prefer a simple and minimal API rather than custom methods for every sub-type of survey. We will end up in the future with dozens of top level methods that are all just doing some simple filtering.
posthog.getAllSurveys(surveys => {
handleCustomSurveys(surveys.filter(s => s.type === "API"))
})
getActiveMatchingAPISurveys
for example just sounds confusing. getAllSurveyMatches
is even more confusing 😅
Being highly opinionated here as these choices we will have to live with and support for basically ever.
🙈 I was actually going to do that but then I thought once I did it you guys would tell me to add in separate methods for it in the library to make dev lives easier so they don't have to even filter for their survey types lol. If filtering is fine I'm going to close this PR then and just add it to the docs and surveys app instead |
Changes
Add a new method to return API type surveys only. Update the existing
getActiveMatchingSurveys
to return non API surveys only.To go in with: PostHog/posthog#16501
Checklist