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(functions): Invoke function with custom query params #926

Merged
merged 2 commits into from
May 13, 2024

Conversation

Cteq3132
Copy link
Contributor

@Cteq3132 Cteq3132 commented May 13, 2024

What kind of change does this PR introduce?

Adding query parameters support for edge functions.
Closes #924

Additional context

Largely inspired from supabase/supabase-swift#376.

cc @dshukertjr

@Cteq3132 Cteq3132 changed the title feat(functions): invoke function with custom query params Feat(functions): invoke function with custom query params May 13, 2024
@Cteq3132 Cteq3132 changed the title Feat(functions): invoke function with custom query params feat(functions): Invoke function with custom query params May 13, 2024
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

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

Thanks for this PR and for adding tests for it as well! I just had one comment regarding the naming of the parameter, but other than that it looks great!

packages/functions_client/lib/src/functions_client.dart Outdated Show resolved Hide resolved
@@ -71,11 +71,13 @@ class FunctionsClient {
String functionName, {
Map<String, String>? headers,
Map<String, dynamic>? body,
Map<String, String>? queryParameters,
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the Uri constructor documentation

A value in the map must be either null, a string, or an Iterable of strings. An iterable corresponds to multiple values for the same key, and an empty iterable or null corresponds to no value for the key.

So I think we could adapt the same type and use Map<String,dynamic> instead of Map<String,String> for the query parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's a good point, I'm updating this part right now.

Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

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

Thanks for the amazing contribution 🎉

@dshukertjr dshukertjr merged commit 7ded898 into supabase:main May 13, 2024
9 checks passed
@Cteq3132 Cteq3132 deleted the feat/add-functions-query-params branch May 13, 2024 14:01
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.

Allow to pass query params when invoking function
3 participants