Skip to content

Commit 681dcb5

Browse files
KatisticKatsi
andauthored
Convert boolean to lower str in query parameters (#26)
Co-authored-by: Katsi <kat@vocreatures.com>
1 parent 14cb11b commit 681dcb5

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

generate.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ patch ./vrchatapi/rest.py < ./patches/error_2fa_verify_readable.patch
3636

3737
# Add common symbols to safe path parameter symbols
3838
patch ./vrchatapi/configuration.py < ./patches/safe_param_symbols.patch
39+
40+
# Boolean to lower str conversion for query parameters
41+
patch ./vrchatapi/api_client.py < ./patches/query_param_bool.patch

patches/query_param_bool.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/api_client.py b/api_clientpatch.py
2+
index 68529871..f0d06f96 100644
3+
--- a/api_client.py
4+
+++ b/api_clientpatch.py
5+
@@ -151,6 +151,12 @@ class ApiClient(object):
6+
7+
# query parameters
8+
if query_params:
9+
+ ## PATCH -- convert boolean value into lower str for query param
10+
+ for param in query_params:
11+
+ if type(param[1]) == bool:
12+
+ query_params[query_params.index(param)] = \
13+
+ (param[0], "true" if param[1] else "false")
14+
+
15+
query_params = self.sanitize_for_serialization(query_params)
16+
query_params = self.parameters_to_tuples(query_params,
17+
collection_formats)

vrchatapi/api_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ def __call_api(
151151

152152
# query parameters
153153
if query_params:
154+
## PATCH -- convert boolean value into lower str for query param
155+
for param in query_params:
156+
if type(param[1]) == bool:
157+
query_params[query_params.index(param)] = \
158+
(param[0], "true" if param[1] else "false")
159+
154160
query_params = self.sanitize_for_serialization(query_params)
155161
query_params = self.parameters_to_tuples(query_params,
156162
collection_formats)

0 commit comments

Comments
 (0)