Skip to content

Add SetQueryParamInt/Bool methods to directly serialize bool and int for resty.Request #1027

@takanuva15

Description

@takanuva15

Right now the SetQueryParam method only accepts string, which forces developers to write conversion code to reformat bools and ints to string. bool is a very common query parameter type used for filtering results from an endpoint, while int is used all the time for things like pagination.

To make resty easier to use with these common go types, I would like to add two methods to the client:
SetQueryParamInt(param string, value int)
and
SetQueryParamBool(param string, value bool).

These can call strconv.Itoa and strconv.FormatBool in their implementation to generate the required strings for the query param url.

EDIT: If we can add a similar method for Path Params like SetPathParamInt, that would be great as well

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions