Skip to content

Commit

Permalink
Add x-konfig-prefix support in python generator (#595)
Browse files Browse the repository at this point in the history
* Add x-konfig-prefix support in python generator

* update integration test SDKs
  • Loading branch information
eddiechayes authored Feb 27, 2024
1 parent 897ddd1 commit 5e83dde
Show file tree
Hide file tree
Showing 32 changed files with 103 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ conf = {{{packageName}}}.Configuration(
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
{{#each apiKeyMethods}}
{{#if vendorExtensions.x-konfig-prefix}}
self.api_key_prefix['{{{name}}}'] = "{{{vendorExtensions.x-konfig-prefix}}}"
{{/if}}
{{/each}}
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -548,7 +555,7 @@ conf = {{{packageName}}}.Configuration(
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key
{{#unless removeDefaultConfigurationParameters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -361,7 +363,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
self.api_key_prefix['accessToken'] = "Token "
self.api_key_prefix['apiKey'] = "Bearer "
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -350,7 +354,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -362,7 +364,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -361,7 +363,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(self, host=None,
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
else:
pass
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand Down Expand Up @@ -347,7 +349,7 @@ def get_api_key_with_prefix(self, identifier, alias=None):
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
return "%s%s" % (prefix, key)
else:
return key

Expand Down
Loading

0 comments on commit 5e83dde

Please sign in to comment.