(Go: >> BACK << -|- >> HOME <<)

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

Feature request: Add support for something like QueryMap in RestEase #252

Closed
ravensorb opened this issue Jul 31, 2016 · 5 comments
Closed

Comments

@ravensorb
Copy link

It would be great to see support for something like the Querymap in RestEase. I am looking for some why to leverage an entire object as possible query string parameters (or at least all non null values). This would make it easier to support search for more complex APIs

public class ProductItem {
    string name { get; set; }
    string brand { get; set; }
    string sku { get; set; }
    decimal? defaultCost { get; set; }
    bool? archived { get; set; }
}

[Get("/Account/{AccountID}/Item")]
Task<ProductItem> GetItemAsync([QueryMap(QuerySerializationMethod.QueryString)] ProductItem item);

This would generate different query strings based on which propertied are non-null/non-empty values.

@RaminMT
Copy link
RaminMT commented May 24, 2017

Hi,
Any solutions or answers on this?

@ravensorb
Copy link
Author

Yes, there is a pretty elegant solution that I found with @paulcbetts help. Basically you can create an IRequestQueryParmSerializer and implement the SerializeQueryParam method, In that method, I take "value" and using a little bit of reflection I convert it to a Dictionary<string, string> object. So far this is working extremely well.

@RaminMT
Copy link
RaminMT commented May 30, 2017

Hi again,
I didn't find any IRequestQueryParmSerializer (or sth near to this), So I guess I should create that, but after creating the interface & implementing the method, Where & How I should use that?!

Thanks

@clairernovotny
Copy link
Member

Closing due to age. Please try Refit v6 and reopen if still an issue.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants