File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,11 @@ def setup(args):
44
44
###########################################################################
45
45
# Generate command
46
46
generate_parser = subparsers .add_parser ("generate" , help = "Generates Poly library" )
47
+ generate_parser .add_argument ("--no-types" , action = "store_true" , help = "Generate SDK without type definitions" )
47
48
48
49
def generate_command (args ):
49
50
initialize_config ()
50
- generate ()
51
+ generate (no_types = args . no_types )
51
52
52
53
generate_parser .set_defaults (command = generate_command )
53
54
Original file line number Diff line number Diff line change 36
36
path:'''
37
37
38
38
39
- def get_specs () -> List :
39
+ def get_specs (no_types : bool = False ) -> List :
40
40
api_key , api_url = get_api_key_and_url ()
41
41
assert api_key
42
42
headers = get_auth_headers (api_key )
43
43
url = f"{ api_url } /specs"
44
- resp = requests .get (url , headers = headers )
44
+ params = {"noTypes" : str (no_types ).lower ()}
45
+ resp = requests .get (url , headers = headers , params = params )
45
46
if resp .status_code == 200 :
46
47
return resp .json ()
47
48
else :
@@ -196,11 +197,11 @@ def remove_old_library():
196
197
shutil .rmtree (path )
197
198
198
199
199
- def generate () -> None :
200
+ def generate (no_types : bool = False ) -> None :
200
201
print ("Generating Poly Python SDK..." , end = "" , flush = True )
201
202
remove_old_library ()
202
203
203
- specs = get_specs ()
204
+ specs = get_specs (no_types = no_types )
204
205
cache_specs (specs )
205
206
206
207
limit_ids : List [str ] = [] # useful for narrowing down generation to a single function to debug
Original file line number Diff line number Diff line change @@ -35,11 +35,12 @@ def update_rendered_spec(spec: SpecificationDto):
35
35
assert resp .status_code == 201 , (resp .text , resp .status_code )
36
36
37
37
38
- def _get_spec (spec_id : str ) -> Optional [SpecificationDto ]:
38
+ def _get_spec (spec_id : str , no_types : bool = False ) -> Optional [SpecificationDto ]:
39
39
api_key , base_url = get_api_key_and_url ()
40
40
url = f"{ base_url } /specs"
41
41
headers = {"Authorization" : f"Bearer { api_key } " }
42
- resp = requests .get (url , headers = headers )
42
+ params = {"noTypes" : str (no_types ).lower ()}
43
+ resp = requests .get (url , headers = headers , params = params )
43
44
if resp .status_code == 200 :
44
45
specs = resp .json ()
45
46
for spec in specs :
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
3
3
4
4
[project ]
5
5
name = " polyapi-python"
6
- version = " 0.3.4.dev1 "
6
+ version = " 0.3.4.dev2 "
7
7
description = " The Python Client for PolyAPI, the IPaaS by Developers for Developers"
8
8
authors = [{ name = " Dan Fellin" , email = " dan@polyapi.io" }]
9
9
dependencies = [
You can’t perform that action at this time.
0 commit comments